Comments (9)
One thing more, don't run updatePackgerIndex
if install_ccache
is false.
from setup-ccache-action.
If set cache_dir to another place,it will make restore cache never success.
I resolved it in 64fc5fd.
Thanks for reporting!
from setup-ccache-action.
Still have problem with env:
example:cache_dir=$GITHUB_WORKSPACE/.ccache
This action will save cache in path /__w/my-repo-name/my-repo-name/.ccache
(run job in a docker image) or /home/runner/work/my-repo-name/my-repo-name/.ccache
, but restore cache using $GITHUB_WORKSPACE/.ccache
.
So restore will always fail.
You can find $GITHUB_WORKSPACE
in https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
@Chocobo1 my pr can fix this, but 64fc5fd can't.
In my opinion, #19 simply solves the problem and avoids the bugs that restore cache and save cache use different paths
from setup-ccache-action.
example:cache_dir=$GITHUB_WORKSPACE/.ccache
Strictly speaking it is invalid to use environment variables here. Use cache_dir=${{ github.workspace }}/.ccache
instead.
Here we are not invoking ccache via shell but from "github actions" context so environment variables aren't resolved (at least github actions chooses not to).
However, I do agree that this is a bit unexpected for the common users. I'll ponder on it.
In my opinion, #19 simply solves the problem and avoids the bugs that restore cache and save cache use different paths
I'm concerned that if the ccache config resides within the cache path and after cache restore it will overwritten the configuration. I don't consider it correct.
from setup-ccache-action.
Strictly speaking it is invalid to use environment variables here. Use cache_dir=${{ github.workspace }}/.ccache instead.
Here we are not invoking ccache via shell but from "github actions" context so environment variables aren't resolved (at least github actions chooses not to).
I think this is the relevant documentation:
https://docs.github.com/en/actions/learn-github-actions/variables#using-the-env-context-to-access-environment-variable-values
The run steps in a workflow, or in a referenced action, are processed by a runner. As a result, you can use runner environment variables here, using the appropriate syntax for the shell you are using on the runner - for example, $NAME for the bash shell on a Linux runner, or
$env:NAME
for PowerShell on a Windows runner. In most cases you can also use contexts, with the syntax ${{ CONTEXT.PROPERTY }}, to access the same value. The difference is that the context will be interpolated and replaced by a string before the job is sent to a runner.However, you cannot use runner environment variables in parts of a workflow that are processed by GitHub Actions and are not sent to the runner. Instead, you must use contexts.
And as I mentioned, setup-ccache-action is processed by GitHub Actions not via a runner/shell.
https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
However, most of the default variables have a corresponding, and similarly named, context property. For example, the value of the GITHUB_REF variable can be read during workflow processing using the ${{ github.ref }} context property.
Also it seems to me that github have already known this (downside) and decided to provide both context properties and runner env variables.
from setup-ccache-action.
Strictly speaking it is invalid to use environment variables here. Use cache_dir=${{ github.workspace }}/.ccache instead.
In most cases you can also use contexts, with the syntax ${{ CONTEXT.PROPERTY }}, to access the same value.
Yes, but $GITHUB_WORKSPACE
and ${{ github.workspace}}
are different for job running in a container.
see this actions/checkout#785 and actions/runner#2058
Example:
name: archlinux
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
container:
image: archlinux/archlinux:base-devel
steps:
- run: echo "${{ github.workspace }}" ; echo "$GITHUB_WORKSPACE"
${{ github.workspace }}
is /home/runner/work/...
, but $GITHUB_WORKSPACE
is /__w/...
Github action does have some weirdness to it.
from setup-ccache-action.
I think the main problem is that the paths to save cache and restore cache have to be exactly the same in terms of characters.
Either both prioritize the value of ccache_options
or both prioritize the value in the config file. Instead of using different values as it is now
setup-ccache-action/src/post.ts
Line 85 in 3c66724
setup-ccache-action/src/main.ts
Line 146 in 3c66724
from setup-ccache-action.
${{ github.workspace }} is /home/runner/work/..., but $GITHUB_WORKSPACE is /__w/...
Github action does have some weirdness to it.
True and they still haven't address it yet...
Not sure if you are still looking for a workaround but just in case, perhaps the following will work:
# export variable
- run: echo "GITHUB_WORKSPACE=$GITHUB_WORKSPACE" >> $GITHUB_ENV
# use variable
- name: Set up ccache
uses: Chocobo1/setup-ccache-action@v1
with:
ccache_options: |
cache_dir=${{ env.GITHUB_WORKSPACE }}/.ccache
from setup-ccache-action.
Earlier you talked about the possibility of overwriting the config file when restoring cache, so set the option after restoring.So maybe we can set the option cache_dir
both before and after restore
from setup-ccache-action.
Related Issues (11)
- Failure on ubuntu-18.04 HOT 1
- Do not add any timestamp to the cached file HOT 1
- Cygwin support HOT 4
- brew exit code 1 HOT 1
- Brew install failing on macOS runners HOT 3
- Consider changing Windows warning to an info printout HOT 3
- Use MSYSTEM_PREFIX HOT 6
- Cache upload failed - ESPIPE: invalid seek HOT 5
- Windows msvc support HOT 2
- Please update to @actions/core 1.10 to avoid warnings about deprecated `set-output` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from setup-ccache-action.