Skip to content

Commit

Permalink
Merge pull request #20 from jiro4989/chore/date-cache
Browse files Browse the repository at this point in the history
Update README and fix CI #8
  • Loading branch information
jiro4989 authored Jun 1, 2020
2 parents 30ceeef + d9092fc commit 1678937
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 35 deletions.
36 changes: 23 additions & 13 deletions .github/workflows/nim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.choosenim
key: ${{ runner.os }}-choosenim-stable
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-stable
key: ${{ runner.os }}-nimble
- uses: jiro4989/setup-nim-action@v1
- name: Print Nim version
run: nim -v
Expand All @@ -56,23 +50,32 @@ jobs:

test_devel:
runs-on: ubuntu-latest
env:
nim_version: 'devel'
steps:
- uses: actions/checkout@v1

- name: Get Date
id: get-date
run: echo "::set-output name=date::$(date "+%Y-%m-%d")"
shell: bash

- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.choosenim
key: ${{ runner.os }}-choosenim-devel
key: ${{ runner.os }}-choosenim-${{ env.nim_version }}-${{ steps.get-date.outputs.date }}
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-stable
- uses: jiro4989/setup-nim-action@v1
key: ${{ runner.os }}-nimble-${{ env.nim_version }}
- uses: ./
with:
nim-version: devel
nim-version: ${{ env.nim_version }}

- name: Print Nim version
run: nim -v
- name: Print Nimble version
Expand All @@ -86,21 +89,28 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1

- name: Get Date
id: get-date
run: echo "::set-output name=date::$(date "+%Y-%m-%d")"
shell: bash

- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.choosenim
key: ${{ runner.os }}-choosenim-devel-latest
key: ${{ runner.os }}-choosenim-devel-latest-${{ steps.get-date.outputs.date }}
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-stable
key: ${{ runner.os }}-nimble-devel-latest
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: 'devel --latest'

- name: Print Nim version
run: nim -v
- name: Print Nimble version
Expand Down
73 changes: 51 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,27 @@ See [action.yml](action.yml)
Basic:
```yaml
steps:
- uses: actions/checkout@master
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: '1.2.0'
- run: nimble build -Y
- run: nimble test -Y
- uses: actions/checkout@master
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: '1.2.0'
- run: nimble build -Y
- run: nimble test -Y
```
Use cache:
```yaml
steps:
- uses: actions/checkout@master
- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.choosenim
key: ${{ runner.os }}-choosenim-stable
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-stable
- uses: jiro4989/setup-nim-action@v1
- run: nimble build -Y
- run: nimble test -Y
- uses: actions/checkout@master
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-${{ hashFiles('*.nimble') }}
- uses: jiro4989/setup-nim-action@v1
- run: nimble build -Y
- run: nimble test -Y
```
Matrix Testing:
Expand All @@ -58,6 +52,41 @@ jobs:
- run: nimble build
```
Use `date` cache-key if you want to use `stable` or `devel` or `devel --latest` and caching.

```yaml
jobs:
test_devel:
runs-on: ubuntu-latest
env:
nim_version: 'devel'
steps:
- uses: actions/checkout@v1
- name: Get Date
id: get-date
run: echo "::set-output name=date::$(date "+%Y-%m-%d")"
shell: bash
- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.choosenim
key: ${{ runner.os }}-choosenim-${{ env.nim_version }}-${{ steps.get-date.outputs.date }}
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-${{ env.nim_version }}-${{ hashFiles('*.nimble') }}
- uses: jiro4989/setup-nim-action@v1
with:
nim-version: ${{ env.nim_version }}
- run: nimble build
```

# License

MIT

0 comments on commit 1678937

Please sign in to comment.