Skip to content

Commit

Permalink
Consistent caching in GitHub workflows (#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed May 30, 2024
1 parent acfa3b0 commit e878be5
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
version: "1"
arch: ${{ runner.arch }}
if: steps.julia_in_path.outcome != 'success'
- name: Use Julia cache
uses: julia-actions/cache@v2
- name: "Add the General registry via Git"
run: |
import Pkg
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/Copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
run: julia -e 'using Pkg; pkg"add JuliaFormatter"'
- name: Setup Python
uses: actions/setup-python@v5
with:
cache: pip
- name: Check for update in the template
run: |
pip install copier
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/Docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
- uses: julia-actions/setup-julia@v2
with:
version: "1"
- name: Use Julia cache
uses: julia-actions/cache@v2
- run: |
julia --project=docs -e '
using Pkg
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
run: julia -e 'using Pkg; pkg"add JuliaFormatter"'
- name: Setup Python
uses: actions/setup-python@v5
with:
cache: pip
- name: Cache pre-commit
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,8 @@ jobs:
with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Use Julia cache
uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning].

- More reader-friendly README (#144)
- Add author names to licenses (#145)
- Consistent caching in GitHub workflows (#53)

## [0.3.1] - 2024-05-23

Expand Down
4 changes: 3 additions & 1 deletion template/.github/workflows/CompatHelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CompatHelper

on:
schedule:
- cron: 0 0 * * *
- cron: 0 0 * * * # Every day at 00:00 UTC
workflow_dispatch:

permissions:
Expand All @@ -24,6 +24,8 @@ jobs:
version: "1"
arch: ${{ runner.arch }}
if: steps.julia_in_path.outcome != 'success'
- name: Use Julia cache
uses: julia-actions/cache@v2
- name: "Add the General registry via Git"
run: |
import Pkg
Expand Down
4 changes: 3 additions & 1 deletion template/.github/workflows/Copier.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

on:
schedule:
- cron: 0 7 1/7 * *
- cron: 0 7 1/7 * * # Every 7 days at 7:00 UTC
workflow_dispatch:

jobs:
Expand All @@ -21,6 +21,8 @@ jobs:
run: julia -e 'using Pkg; pkg"add JuliaFormatter"'
- name: Setup Python
uses: actions/setup-python@v5
with:
cache: 'pip'
- name: Check for update in the template
run: |
pip install copier
Expand Down
2 changes: 2 additions & 0 deletions template/.github/workflows/Docs.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
- uses: julia-actions/setup-julia@v2
with:
version: "1"
- name: Use Julia cache
uses: julia-actions/cache@v2
- run: |
julia --project=docs -e '
using Pkg
Expand Down
7 changes: 7 additions & 0 deletions template/.github/workflows/Lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ jobs:
run: julia -e 'using Pkg; pkg"add JuliaFormatter"'
- name: Setup Python
uses: actions/setup-python@v5
with:
cache: "pip"
- name: Cache pre-commit
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit
Expand Down
13 changes: 3 additions & 10 deletions template/.github/workflows/Test.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,9 @@ jobs:
{% raw %}with:
version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: actions/cache@v4
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-{% endraw %}
{% endraw %}
- name: Use Julia cache
uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
Expand Down

0 comments on commit e878be5

Please sign in to comment.