Fail when cache local path does not exist when trying to cache (#163)

Can be disabled by setting `ignore-nothing-to-cache: true`
This commit is contained in:
Kevin Stillhammer 2024-11-23 16:30:54 +01:00 committed by GitHub
parent 691a091485
commit ed171c292b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 103 additions and 44 deletions

View file

@ -21,7 +21,7 @@ jobs:
uses: ./
with:
enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache
- run: uv sync
working-directory: __tests__/fixtures/uv-project
test-restore-cache:
@ -37,7 +37,7 @@ jobs:
uses: ./
with:
enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache
- name: Cache was hit
run: |
if [ "$CACHE_HIT" != "true" ]; then
@ -59,7 +59,7 @@ jobs:
cache-dependency-glob: |
__tests__/fixtures/uv-project/uv.lock
**/pyproject.toml
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-dependency-glob
- run: uv sync
working-directory: __tests__/fixtures/uv-project
test-restore-cache-dependency-glob:
@ -79,7 +79,8 @@ jobs:
cache-dependency-glob: |
__tests__/fixtures/uv-project/uv.lock
**/pyproject.toml
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-dependency-glob
ignore-nothing-to-cache: true
- name: Cache was not hit
run: |
if [ "$CACHE_HIT" == "true" ]; then
@ -96,7 +97,7 @@ jobs:
uses: ./
with:
enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-local
cache-local-path: /tmp/uv-cache
- run: uv sync
working-directory: __tests__/fixtures/uv-project
@ -110,7 +111,7 @@ jobs:
uses: ./
with:
enable-cache: true
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}
cache-suffix: ${{ github.run_id }}-${{ github.run_attempt }}-test-setup-cache-local
cache-local-path: /tmp/uv-cache
- name: Cache was hit
run: |
@ -122,38 +123,38 @@ jobs:
- run: uv sync
working-directory: __tests__/fixtures/uv-project
prepare-tilde-expansion-tests:
test-tilde-expansion-cache-local-path:
runs-on: selfhosted-ubuntu-arm64
steps:
- uses: actions/checkout@v4
- name: Create cache directory
run: mkdir -p ~/uv-cache
shell: bash
- name: Setup with cache
uses: ./
with:
cache-local-path: ~/uv-cache/cache-local-path
- run: uv sync
working-directory: __tests__/fixtures/uv-project
test-tilde-expansion-cache-dependency-glob:
runs-on: selfhosted-ubuntu-arm64
steps:
- uses: actions/checkout@v4
- name: Create cache directory
run: mkdir -p ~/uv-cache
shell: bash
- name: Create cache dependency glob file
run: touch ~/uv-cache.glob
shell: bash
test-tilde-expansion-cache-local-path:
needs: prepare-tilde-expansion-tests
runs-on: selfhosted-ubuntu-arm64
steps:
- uses: actions/checkout@v4
- name: Setup with cache
uses: ./
with:
enable-cache: true
cache-local-path: ~/uv-cache/cache-local-path
test-tilde-expansion-cache-dependency-glob:
needs: prepare-tilde-expansion-tests
runs-on: selfhosted-ubuntu-arm64
steps:
- uses: actions/checkout@v4
- name: Setup with cache
uses: ./
with:
enable-cache: true
cache-local-path: ~/uv-cache/cache-dependency-glob
cache-dependency-glob: "~/uv-cache.glob"
- run: uv sync
working-directory: __tests__/fixtures/uv-project
cleanup-tilde-expansion-tests:
needs: