Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no cache found when using a tag as trigger #74

Closed
KonradHoeffner opened this issue Sep 3, 2022 · 12 comments
Closed

no cache found when using a tag as trigger #74

KonradHoeffner opened this issue Sep 3, 2022 · 12 comments

Comments

@KonradHoeffner
Copy link

KonradHoeffner commented Sep 3, 2022

Even though the cache key is the same, GitHub does not restore the cache. What am I doing wrong?

Previous run post run log, see https://github.com/KonradHoeffner/rickview/runs/8167984956?check_suite_focus=true:

Post job cleanup.
Cache Configuration
  Workspaces:
      /home/runner/work/rickview/rickview
  Cache Paths:
      /home/runner/.cargo
      /home/runner/work/rickview/rickview/target
  Restore Key:
      v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544
  Cache Key:
      v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362
  .. Prefix:
    - v0-rust-build-upload
  .. Environment considered:
    - Rust Version: 1.65.0-nightly x86_64-unknown-linux-gnu (2e35f954ada0f0c777844dc4fa66684efe90a035)
    - CARGO_INCREMENTAL
    - CARGO_TERM_COLOR
  .. Lockfiles considered:
    - /home/runner/work/rickview/rickview/Cargo.toml
    - /home/runner/work/rickview/rickview/rust-toolchain.toml

... Cleaning /home/runner/work/rickview/rickview/target ...
... Cleaning cargo registry ...
... Cleaning cargo/bin ...
... Cleaning cargo git cache ...
Warning:  Error: ENOENT: no such file or directory, opendir '/home/runner/.cargo/git/db'
... Saving cache ...
(node:6545) Warning: Closing directory handle on garbage collection
(Use `node --trace-warnings ...` to show where the warning was created)
/usr/bin/tar --posix --use-compress-program zstd -T0 -cf cache.tzst --exclude cache.tzst -P -C /home/runner/work/rickview/rickview --files-from manifest.txt
Cache Size: ~216 MB (226988385 B)
Cache saved successfully

Current run log:

Run Swatinem/rust-cache@v2
  with:
  env:
    NAME: rickview
    CARGO_TERM_COLOR: always
    CARGO_INCREMENTAL: 0
Cache Configuration
  Workspaces:
      /home/runner/work/rickview/rickview
  Cache Paths:
      /home/runner/.cargo
      /home/runner/work/rickview/rickview/target
  Restore Key:
      v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544
  Cache Key:
      v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362
  .. Prefix:
    - v0-rust-build-upload
  .. Environment considered:
    - Rust Version: 1.65.0-nightly x86_64-unknown-linux-gnu (2e35f954ada0f0c777844dc4fa66684efe90a035)
    - CARGO_INCREMENTAL
    - CARGO_TERM_COLOR
  .. Lockfiles considered:
    - /home/runner/work/rickview/rickview/Cargo.toml
    - /home/runner/work/rickview/rickview/rust-toolchain.toml

... Restoring cache ...
No cache found.

This is my .github/workflows/release.yml:

# adapted copy from https://github.com/termapps/enquirer/blob/master/.github/workflows/release.yml
env:
  NAME: rickview
  CARGO_TERM_COLOR: always
  CARGO_INCREMENTAL: 0

name: Release
on:
  create:
    tags: '[0-9]+\.[0-9]+\.[0-9]+'
jobs:
  create-release:
    name: Create release
    runs-on: ubuntu-latest
    outputs:
      upload_url: ${{ steps.create-release.outputs.upload_url }}
    steps:
      - name: Create Release
        id: create-release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ github.token }}
        with:
          tag_name: ${{ github.ref }}
          release_name: ${{ github.ref }}
  read-version:
    name: Read version
    runs-on: ubuntu-latest
    outputs:
      version: ${{ steps.version.outputs.VERSION }}
    steps:
      - name: Read version
        id: version
        env:
          REF: ${{ github.ref }}
        shell: bash
        run: echo ::set-output name=VERSION::${REF/refs\/tags\//}
  build-upload:
    name: Build & Upload
    needs: [create-release, read-version]
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            target: x86_64-unknown-linux-gnu
          # - os: ubuntu-latest
          #   target: i686-unknown-linux-gnu
          # - os: macos-latest
          #   target: x86_64-apple-darwin
          # - os: windows-latest
          #   target: i686-pc-windows-msvc
          # - os: windows-latest
          #   target: x86_64-pc-windows-msvc
    runs-on: ${{ matrix.os }}
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Install rust
        uses: actions-rs/toolchain@v1
        with:
          profile: minimal
          toolchain: nightly-2022-09-02
          target: ${{ matrix.target }}
          override: true
      - uses: Swatinem/rust-cache@v2
      - name: Install linker
        if: matrix.target == 'i686-unknown-linux-gnu'
        run: sudo apt-get install gcc-multilib
      - name: Build
        uses: actions-rs/cargo@v1
        with:
          command: build
          args: --target ${{ matrix.target }} --release
      - name: Set variables
        id: vars
        env:
          BUILD_NAME: ${{ env.NAME }}-${{ needs.read-version.outputs.version }}-${{ matrix.target }}
        shell: bash
        run: echo ::set-output name=BUILD_NAME::$BUILD_NAME
      - name: Ready artifacts
        env:
          BUILD_NAME: ${{ steps.vars.outputs.BUILD_NAME }}
          TARGET: ${{ matrix.target }}
        shell: bash
        run: |
          mkdir $BUILD_NAME
          # cp target/$TARGET/release/$NAME LICENSE *.md $NAME.1 $BUILD_NAME
          cp target/$TARGET/release/$NAME $BUILD_NAME
      - name: Compress artifacts
        uses: papeloto/action-zip@v1
        with:
          files: ${{ steps.vars.outputs.BUILD_NAME }}/
          recursive: false
          dest: ${{ steps.vars.outputs.BUILD_NAME }}.zip
      - name: Upload artifacts
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ github.token }}
        with:
          upload_url: ${{ needs.create-release.outputs.upload_url }}
          asset_path: ./${{ steps.vars.outputs.BUILD_NAME }}.zip
          asset_name: ${{ steps.vars.outputs.BUILD_NAME }}.zip
          asset_content_type: application/zip
@Swatinem
Copy link
Owner

Swatinem commented Sep 4, 2022

Which branches are used to generate or fetch the cache?

The action is using the same mechanism as upstream: https://github.com/Swatinem/rust-cache#cache-limits-and-control
You can also turn on debug logging to try to diagnose this further.

@KonradHoeffner
Copy link
Author

I push the tags to the master branch, do I need to specify this somewhere? I turn on debug logging and investigate this further, thanks for the advice!

@KonradHoeffner
Copy link
Author

When I rerun the job with debug logging enabled, it successfully restores the cache but I don't know why.
Is it possible that the cache won't work when the scope is different because the tag is different? Or is the scope not important? This is included in the logs:

##[debug]{"scope":"refs/tags/0.0.9","cacheKey":"v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362","cacheVersion":"f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84","creationTime":"2022-09-03T07:43:00.47Z","archiveLocation":"***"}

The abbreviated logs are:

##[debug]Evaluating condition for step: 'Run Swatinem/rust-cache@v2'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run Swatinem/rust-cache@v2
##[debug]Register post job cleanup for action: Swatinem/rust-cache@v2
##[debug]Loading inputs
##[debug]Loading env
Run Swatinem/rust-cache@v2
  with:
  env:
    NAME: rickview
    CARGO_TERM_COLOR: always
    CARGO_INCREMENTAL: 0
  
##[debug]followSymbolicLinks 'false'
##[debug]followSymbolicLinks 'false'
##[debug]implicitDescendants 'true'
##[debug]matchDirectories 'true'
##[debug]omitBrokenSymbolicLinks 'true'
##[debug]Search path '/home/runner/work/rickview/rickview'
::save-state name=RUST_CACHE_LOCKFILE_HASH::e3aca5b6233b3840996040561fe198344deaf362
##[debug]Save intra-action state RUST_CACHE_LOCKFILE_HASH = e3aca5b6233b3840996040561fe198344deaf362
::save-state name=RUST_CACHE_LOCKFILES::["/home/runner/work/rickview/rickview/Cargo.toml","/home/runner/work/rickview/rickview/rust-toolchain.toml"]
##[debug]Save intra-action state RUST_CACHE_LOCKFILES = ["/home/runner/work/rickview/rickview/Cargo.toml","/home/runner/work/rickview/rickview/rust-toolchain.toml"]
::group::Cache Configuration
Cache Configuration

::save-state name=RUST_CACHE_BINS::["bindgen","cargo-audit","cargo-outdated","cbindgen"]
##[debug]Save intra-action state RUST_CACHE_BINS = ["bindgen","cargo-audit","cargo-outdated","cbindgen"]
... Restoring cache ...
##[debug]Resolved Keys:
##[debug]["v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362","v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544"]
##[debug]Checking zstd --version
##[debug]*** zstd command line interface 64-bits v1.5.2, by Yann Collet ***
##[debug]Resource Url: https://artifactcache.actions.githubusercontent.com/PPw5tc38Ucs0a32EZqhdiYEiaMtRJlOmh1K90gI9U6LjzferiE/_apis/artifactcache/cache?keys=v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362%2Cv0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544&version=f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84
::add-mask::***
##[debug]Cache Result:
##[debug]{"scope":"refs/tags/0.0.9","cacheKey":"v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362","cacheVersion":"f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84","creationTime":"2022-09-03T07:43:00.47Z","archiveLocation":"***"}
##[debug]Archive Path: /home/runner/work/_temp/76228af9-386d-4bc8-9b9a-c474eabab67f/cache.tzst
##[debug]Use Azure SDK: true
##[debug]Download concurrency: 8
##[debug]Request timeout (ms): 30000
##[debug]Downloading segment at offset 0 with length 226972963...
Received 134217728 of 226972963 (59.1%), 127.9 MBs/sec
Received 226972963 of 226972963 (100.0%), 132.5 MBs/sec
/usr/bin/tar --use-compress-program zstd -d -tf /home/runner/work/_temp/76228af9-386d-4bc8-9b9a-c474eabab67f/cache.tzst -P
../../../.cargo/
../../../.cargo/.crates2.json
[...]
./../.cargo/registry/cache/github.com-1ecc6299db9ec823/weak-table-0.3.2.crate
target/x86_64-unknown-linux-gnu/release/build/cookie-e8be7451f553fc14/invoked.timestamp
Cache Size: ~216 MB (226972963 B)
/usr/bin/tar --use-compress-program zstd -d -xf /home/runner/work/_temp/76228af9-386d-4bc8-9b9a-c474eabab67f/cache.tzst -P -C /home/runner/work/rickview/rickview
Cache restored successfully
Restored from cache key "v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362".
::save-state name=RUST_CACHE_KEY::v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362
##[debug]Save intra-action state RUST_CACHE_KEY = v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362

::set-output name=cache-hit::true
##[debug]='true'
##[debug]Node Action run completed with exit code 0
##[debug]CACHE_ON_FAILURE='false'
##[debug]CARGO_INCREMENTAL='0'
##[debug]Finishing: Run Swatinem/rust-cache@v2

@KonradHoeffner
Copy link
Author

When I create a new tag with debug logging enables, it fails to restore the cache again, with the following logs:

##[debug]Evaluating condition for step: 'Run Swatinem/rust-cache@v2'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run Swatinem/rust-cache@v2
##[debug]Register post job cleanup for action: Swatinem/rust-cache@v2
##[debug]Loading inputs
##[debug]Loading env
Run Swatinem/rust-cache@v2
  with:
  env:
    NAME: rickview
    CARGO_TERM_COLOR: always
    CARGO_INCREMENTAL: 0
##[debug]followSymbolicLinks 'false'
##[debug]followSymbolicLinks 'false'
##[debug]implicitDescendants 'true'
##[debug]matchDirectories 'true'
##[debug]omitBrokenSymbolicLinks 'true'
##[debug]Search path '/home/runner/work/rickview/rickview'
::save-state name=RUST_CACHE_LOCKFILE_HASH::91bb68e35f21e149d74cf2cb21498d24f7589593
##[debug]Save intra-action state RUST_CACHE_LOCKFILE_HASH = 91bb68e35f21e149d74cf2cb21498d24f7589593
::save-state name=RUST_CACHE_LOCKFILES::["/home/runner/work/rickview/rickview/Cargo.toml","/home/runner/work/rickview/rickview/rust-toolchain.toml"]
##[debug]Save intra-action state RUST_CACHE_LOCKFILES = ["/home/runner/work/rickview/rickview/Cargo.toml","/home/runner/work/rickview/rickview/rust-toolchain.toml"]
::group::Cache Configuration
Cache Configuration
  Workspaces:
      /home/runner/work/rickview/rickview
  Cache Paths:
      /home/runner/.cargo
      /home/runner/work/rickview/rickview/target
  Restore Key:
      v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544
  Cache Key:
      v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-91bb68e35f21e149d74cf2cb21498d24f7589593
  .. Prefix:
    - v0-rust-build-upload
  .. Environment considered:
    - Rust Version: 1.65.0-nightly x86_64-unknown-linux-gnu (2e35f954ada0f0c777844dc4fa66684efe90a035)
    - CARGO_INCREMENTAL
    - CARGO_TERM_COLOR
  .. Lockfiles considered:
    - /home/runner/work/rickview/rickview/Cargo.toml
    - /home/runner/work/rickview/rickview/rust-toolchain.toml
  ::endgroup::

::save-state name=RUST_CACHE_BINS::["bindgen","cargo-audit","cargo-outdated","cbindgen"]
##[debug]Save intra-action state RUST_CACHE_BINS = ["bindgen","cargo-audit","cargo-outdated","cbindgen"]
... Restoring cache ...
##[debug]Resolved Keys:
##[debug]["v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-91bb68e35f21e149d74cf2cb21498d24f7589593","v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544"]
##[debug]Checking zstd --version
##[debug]*** zstd command line interface 64-bits v1.5.2, by Yann Collet ***
##[debug]Resource Url: https://artifactcache.actions.githubusercontent.com/PPw5tc38Ucs0a32EZqhdiYEiaMtRJlOmh1K90gI9U6LjzferiE/_apis/artifactcache/cache?keys=v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-91bb68e35f21e149d74cf2cb21498d24f7589593%2Cv0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544&version=f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84
##[debug]Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
No cache found.

::set-output name=cache-hit::false
##[debug]='false'
##[debug]Node Action run completed with exit code 0
##[debug]CACHE_ON_FAILURE='false'
##[debug]CARGO_INCREMENTAL='0'
##[debug]Finishing: Run Swatinem/rust-cache@v2

@KonradHoeffner
Copy link
Author

I created a personal access token and queried my caches using the GitHub REST API with the following result:

$ curl  -H "Accept: application/vnd.github+json"  -H "Authorization: Bearer <REDACTED_TOKEN>"  https://api.github.com/repos/konradhoeffner/rickview/actions/caches                                
{
  "total_count": 7,
  "actions_caches": [
    {
      "id": 7,
      "ref": "refs/tags/0.0.10",
      "key": "v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-91bb68e35f21e149d74cf2cb21498d24f7589593",
      "version": "f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84",
      "last_accessed_at": "2022-09-04T11:21:56.923333300Z",
      "created_at": "2022-09-04T11:21:56.923333300Z",
      "size_in_bytes": 225793529
    },
    {
      "id": 6,
      "ref": "refs/tags/0.0.9",
      "key": "v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-e3aca5b6233b3840996040561fe198344deaf362",
      "version": "f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84",
      "last_accessed_at": "2022-09-04T11:12:15.270000000Z",
      "created_at": "2022-09-03T07:43:00.470000000Z",
      "size_in_bytes": 226972963
    },
[...]

The "ref" field of the token contains the tag name, which is different for each new release tag. What is the purpose of this "ref" key? Could this cause the problem? It would explain why it only works when I rerun the job, where the tag is the same. However for my purpose this would never cache anything, as I don't commit the same tag multiple times except when rerunning a failed job. How can I work around this issue?

@KonradHoeffner KonradHoeffner changed the title no cache found no cache found when using a tag as trigger Sep 4, 2022
@KonradHoeffner
Copy link
Author

I will try to workaround this issue by using a "push" trigger instead of "create". However that probably leads to missing functionality as I assume this will not trigger on manually created tags using the web interface.

@Swatinem
Copy link
Owner

Swatinem commented Sep 4, 2022

What refs/tags are available is rather a restriction of github itself related to permissions and security, nothing I can do on my end related to that.

I notice however that you are using a rust nightly, which will not reuse caches at all if the nightly version happens to change in between.

@KonradHoeffner
Copy link
Author

I use a fixed version of Rust nightly, and the problem occurs even on the same day, so that shouldn't be the reason.
Unfortunately, and I don't know why, even using a push trigger did not fix it:

##[debug]Evaluating condition for step: 'Run Swatinem/rust-cache@v2'
##[debug]Evaluating: success()
##[debug]Evaluating success:
##[debug]=> true
##[debug]Result: true
##[debug]Starting: Run Swatinem/rust-cache@v2
##[debug]Register post job cleanup for action: Swatinem/rust-cache@v2
##[debug]Loading inputs
##[debug]Loading env
Run Swatinem/rust-cache@v2
##[debug]followSymbolicLinks 'false'
##[debug]followSymbolicLinks 'false'
##[debug]implicitDescendants 'true'
##[debug]matchDirectories 'true'
##[debug]omitBrokenSymbolicLinks 'true'
##[debug]Search path '/home/runner/work/rickview/rickview'
::save-state name=RUST_CACHE_LOCKFILE_HASH::2228b0b78308ae915213e629a8ca0cdf1470726b
##[debug]Save intra-action state RUST_CACHE_LOCKFILE_HASH = 2228b0b78308ae915213e629a8ca0cdf1470726b
::save-state name=RUST_CACHE_LOCKFILES::["/home/runner/work/rickview/rickview/Cargo.toml","/home/runner/work/rickview/rickview/rust-toolchain.toml"]
##[debug]Save intra-action state RUST_CACHE_LOCKFILES = ["/home/runner/work/rickview/rickview/Cargo.toml","/home/runner/work/rickview/rickview/rust-toolchain.toml"]
::group::Cache Configuration
Cache Configuration

::save-state name=RUST_CACHE_BINS::["bindgen","cargo-audit","cargo-outdated","cbindgen"]
##[debug]Save intra-action state RUST_CACHE_BINS = ["bindgen","cargo-audit","cargo-outdated","cbindgen"]
... Restoring cache ...
##[debug]Resolved Keys:
##[debug]["v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-2228b0b78308ae915213e629a8ca0cdf1470726b","v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544"]
##[debug]Checking zstd --version
##[debug]*** zstd command line interface 64-bits v1.5.2, by Yann Collet ***
##[debug]Resource Url: https://artifactcache.actions.githubusercontent.com/PPw5tc38Ucs0a32EZqhdiYEiaMtRJlOmh1K90gI9U6LjzferiE/_apis/artifactcache/cache?keys=v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-2228b0b78308ae915213e629a8ca0cdf1470726b%2Cv0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544&version=f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84
##[debug]Failed to delete archive: Error: ENOENT: no such file or directory, unlink ''
No cache found.

::set-output name=cache-hit::false
##[debug]='false'
##[debug]Node Action run completed with exit code 0
##[debug]CACHE_ON_FAILURE='false'
##[debug]CARGO_INCREMENTAL='0'
##[debug]Finishing: Run Swatinem/rust-cache@v2

@KonradHoeffner
Copy link
Author

KonradHoeffner commented Sep 5, 2022

The second part of the key differs:

$ gh api /repos/konradhoeffner/rickview/actions/caches      
{
  "total_count": 9,
  "actions_caches": [
    {
      "id": 9,
      "ref": "refs/tags/0.0.12",
      "key": "v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-2228b0b78308ae915213e629a8ca0cdf1470726b",
      "version": "f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84",
      "last_accessed_at": "2022-09-04T12:00:12.686666700Z",
      "created_at": "2022-09-04T12:00:12.686666700Z",
      "size_in_bytes": 225769805
    },
    {
      "id": 8,
      "ref": "refs/tags/0.0.11",
      "key": "v0-rust-build-upload-23bec24e5dab7b55324e3f0372d66f277a7f8544-37d963d84b9c033e1ef948d4c4f8831739092353",
      "version": "f01be42591250bd35d7c7c4bd7e62a372a21bf52808a04fa8d4d19a904019b84",
      "last_accessed_at": "2022-09-04T11:47:08.860000000Z",
      "created_at": "2022-09-04T11:47:08.860000000Z",
      "size_in_bytes": 225777917
    },

That second part seems to be the lockfile hash, which is strange because I don't have a lock file:

##[debug]Save intra-action state RUST_CACHE_LOCKFILE_HASH = 2228b0b78308ae915213e629a8ca0cdf1470726b

It seems as if the cache does not work at all without a lock file, but the documentation states there are limited benefits. Is that a bug or am I doing something wrong?

@KonradHoeffner
Copy link
Author

According to #70 there is supposed to be a fallback but this does not seem to activate in my case.

Currently there is no way to completely disable this part of the key. But it shouldn’t be such a big problem either, as it falls back to the key prefix without the Cargo.lock portion and reuses caches anyway after cleaning them.

@KonradHoeffner
Copy link
Author

When using a generic GitHub actions cache, adapted from https://ectobit.com/blog/speed-up-github-actions-rust-pipelines/, the same problem occurs.

     - name: Set up cargo cache
        uses: actions/cache@v3
        continue-on-error: false
        with:
          path: |
            ~/.cargo/bin/
            ~/.cargo/registry/index/
            ~/.cargo/registry/cache/
            ~/.cargo/git/db/
            target/
          key: ${{ runner.os }}-cargo

It now seems to me as if the "ref" attribute is the real culprit after all:

{
  "total_count": 10,
  "actions_caches": [
    {
      "id": 10,
      "ref": "refs/tags/0.0.13",
      "key": "Linux-cargo",
      "version": "4464b218375e2702da53c92c2e51ffdd3cdd5aeba23dec304d9c1239b4ef594a",
      "last_accessed_at": "2022-09-05T07:24:51.066666700Z",
      "created_at": "2022-09-05T07:24:51.066666700Z",
      "size_in_bytes": 246555679
    },

@KonradHoeffner
Copy link
Author

I'm closing this because I think it is a general problem with the underlying actions cache when triggered by a tag as the "ref" attribute is set to "refs/tags/..." instead of the branch name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants