-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
cache doesn't work with github workspace directory #833
cache doesn't work with github workspace directory #833
Comments
Thank you for the report. I was able to reproduce this. From the first look, it appears that there is a bug while converting the cache paths to relative paths for compression in the toolkit. I will debug the cause and get back. Contribution are welcome as this will mostly require changes in actions/toolkit and actions/cache. |
It doesn't seems to be fixed for some reason :/ |
Hi @erwan-joly , the above version is for actions/cache npm module and not for the actions/cache action. We are yet to merge toolkit changes into the |
@erwan-joly ,please test now with the latest version of actions/cache using |
@pdotl I confirm it's now fixed 💯 |
One should also consider this issue if he has troubles with
My build job relies on name: Build
on:
push:
tags:
- '*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container:
image: mstorsjo/llvm-mingw:latest
steps:
- name: build stuff
run: |
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
echo "github.workspace=${{ github.workspace }}"
# echo curent working dir which is $GITHUB_WORKSPACE and not ${{ github.workspace }}.
echo "current working dir:"
pwd
# cd to build dir.
# for the example, creates a my_build_dir and cd to it.
cd my_build_dir
# run build command that generates the buil result in ${{ github.workspace }}/output.
# for the example, creates the output dir and touch a result.out file in it.
mkdir -p ${{ github.workspace }}/output
touch ${{ github.workspace }}/output/result.out
# back to $GITHUB_WORKSPACE
cd ..
cp -r ${{ github.workspace }}/output $GITHUB_WORKSPACE
ls -l $GITHUB_WORKSPACE
- name: Cache build output
id: cache-save-build-ouput
uses: actions/cache/save@v3
with:
path: |
./output
key: ${{ runner.os }}-build-output-run_${{ github.run_id }}
enableCrossOsArchive: true
publish:
runs-on: ubuntu-latest
image: mstorsjo/llvm-mingw:latest
needs: build
steps:
- name: Restore build ouput cache
uses: actions/cache/restore@v3
id: cache-restore-build-ouput
with:
path: |
./output
key: ${{ runner.os }}-build-output-run_${{ github.run_id }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- name: archive
run: |
echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE"
echo "github.workspace=${{ github.workspace }}"
# echo curent working dir which is $GITHUB_WORKSPACE and not ${{ github.workspace }}.
echo "current working dir:"
pwd
echo "restored cache output dir:"
ls -l ./ouput Note that restoring a cache in a container image different from the one that saved the cache may fail because the comrpession tool (tar) may be different. For example using
On the other hand, using no container on the my
And using the |
Hi, I'm trying to cache the whole workspace to fetch it between jobs.
Unfortunately it seems like the local directory can not be cached
Using . doesn't work (it cache 22B)
Using ${{ github.workspace }} doesn't work (it also cache 22B)
the only solution I found which work is to list all the files/directory
The text was updated successfully, but these errors were encountered: