Skip to content

Commit aeeade1

Browse files
committed
CI: avoid mixing caches from different OSes
This is a bug in setup-ocaml@v3 ocaml/setup-ocaml#839 Work it around by defining our own cache prefix based on runner OS version. Unfortunately the version itself doesn't seem to be available as a variable in GH actions. There is 'runner.os', but that is just a generic Linux, there is 'matrix.os', but that is only present when using a matrix, and there is '..container' which is only present when containers are used. Use another GH action to determine the version, and now the cache-prefix looks like this: ``` cache-prefix: v3-Ubuntu-22.04 ``` Signed-off-by: Edwin Török <edwin.torok@cloud.com>
1 parent cb3cd2d commit aeeade1

File tree

1 file changed

+6
-0
lines changed
  • .github/workflows/setup-xapi-environment

1 file changed

+6
-0
lines changed

.github/workflows/setup-xapi-environment/action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ runs:
1212
shell: bash
1313
run: |
1414
curl --fail --silent https://raw.githubusercontent.com/xapi-project/xs-opam/master/tools/xs-opam-ci.env | cut -f2 -d " " > .env
15+
cat /etc/os-release
1516
1617
- name: Download XE_SR_ERRORCODES.xml
1718
shell: bash
@@ -42,6 +43,10 @@ runs:
4243
echo "TMPDIR=${TMPDIR}" >>"$GITHUB_ENV"
4344
echo "XDG_CACHE_HOME=${XDG_CACHE_HOME}" >>"$GITHUB_ENV"
4445
46+
- name: Get runner OS info
47+
uses: kenchan0130/actions-system-info@master
48+
id: system-info
49+
4550
# We set DUNE_CACHE_STORAGE_MODE, it is required for dune cache to work inside opam for now,
4651
# otherwise it gets EXDEV and considers it a cache miss
4752
- name: Use ocaml
@@ -52,6 +57,7 @@ runs:
5257
xs-opam: ${{ steps.dotenv.outputs.repository }}
5358
dune-cache: true
5459
opam-pin: false
60+
cache-prefix: v3-${{ steps.system-info.outputs.name }}-${{ steps.system-info.outputs.release }}
5561
env:
5662
DUNE_CACHE_STORAGE_MODE: copy
5763

0 commit comments

Comments
 (0)