Skip to content

Commit

Permalink
Force a cache save.
Browse files Browse the repository at this point in the history
Related #33
  • Loading branch information
aholmes committed Jan 13, 2024
1 parent e5e2f7f commit 04022dd
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,36 @@ jobs:
steps:
- uses: actions/checkout@v4

- id: repository-build-cache-key
run: |
cache_key='${{ runner.os }}-${{ github.event_name != 'workflow_dispatch' || github.run_attempt }}-${{ hashFiles('pyproject.toml', 'src/*/pyproject.toml') }}'
echo "cache_key=$cache_key" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Cache repository build
id: repository-build-cache
with:
path: ${{ github.workspace }}
# Use the same cache between Workflow runs _except_ when the event is a workflow_dispatch.
# This should result in cache keys like "Linux-true-abc123" for all runs _except_ workflow_dispatch,
# and cache keys like "linux-123-abc123" for workflow_dispatch.
key: ${{ steps.repository-build-cache-key.outputs.cache_key }}

- name: Set up Python ${{ matrix.python-version }}
if: ${{ success() && steps.repository-build-cache.outputs.cache-hit != true }}
uses: actions/setup-python@v4
id: install_python
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Create Venv
if: ${{ success() && steps.repository-build-cache.outputs.cache-hit != true }}
run: |
${{ steps.install_python.outputs.python-path }} -m venv .github-venv
- name: Install dependencies
if: ${{ success() && steps.repository-build-cache.outputs.cache-hit != true }}
run: |
echo Setting up dependencies
python -m pip install -U pip
Expand All @@ -57,21 +75,6 @@ jobs:
source .github-venv/bin/activate
./install_all.sh -e
- id: repository-build-cache-key
run: |
cache_key='${{ runner.os }}-${{ github.event_name != 'workflow_dispatch' || github.run_attempt }}-${{ hashFiles('pyproject.toml', 'src/*/pyproject.toml') }}'
echo "cache_key=$cache_key" >> $GITHUB_OUTPUT
- uses: actions/cache/save@v3
name: Cache repository build
id: repository-build-cache
with:
path: ${{ github.workspace }}
# Use the same cache between Workflow runs _except_ when the event is a workflow_dispatch.
# This should result in cache keys like "Linux-true-abc123" for all runs _except_ workflow_dispatch,
# and cache keys like "linux-123-abc123" for workflow_dispatch.
key: ${{ steps.repository-build-cache-key.outputs.cache_key }}

Pyright:
name: Static type checking
runs-on: ubuntu-latest
Expand All @@ -83,14 +86,13 @@ jobs:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4

- uses: actions/cache/restore@v3
name: Restore repository build
id: restore-repository-build
with:
path: path/to/dependencies
key: ${{ needs.Checkout.outputs.repository-build-cache-key }}
path: ${{ github.workspace }}
fail-on-cache-miss: true

- name: Test with pyright
run: |
Expand All @@ -109,14 +111,13 @@ jobs:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4

- uses: actions/cache/restore@v3
name: Restore repository build
id: restore-repository-build
with:
path: path/to/dependencies
key: ${{ needs.Checkout.outputs.repository-build-cache-key }}
path: ${{ github.workspace }}
fail-on-cache-miss: true

- name: Test with pytest and generate reports
run: |
Expand Down Expand Up @@ -150,14 +151,13 @@ jobs:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4

- uses: actions/cache/restore@v3
name: Restore repository build
id: restore-repository-build
with:
path: path/to/dependencies
key: ${{ needs.Checkout.outputs.repository-build-cache-key }}
path: ${{ github.workspace }}
fail-on-cache-miss: true

- name: Check code style
run: |
Expand Down

0 comments on commit 04022dd

Please sign in to comment.