Skip to content

Commit 8e133a5

Browse files
committed
cache rewatch build too
1 parent feb6677 commit 8e133a5

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,42 @@ jobs:
5454
- name: Checkout
5555
uses: actions/checkout@v4
5656

57+
- name: Restore build cache
58+
id: build-cache
59+
uses: actions/cache@v4
60+
with:
61+
path: rewatch/target
62+
key: rewatch-build-${{ matrix.rust-target }}-${{ hashFiles('rewatch/src/**', 'rewatch/Cargo.lock') }}
63+
5764
- name: Install musl gcc
58-
if: runner.os == 'Linux'
65+
if: steps.build-cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
5966
run: sudo apt-get install -y --no-install-recommends musl-tools
6067

6168
- name: Set up sccache
69+
if: steps.build-cache.outputs.cache-hit != 'true'
6270
uses: mozilla-actions/[email protected]
6371
with:
6472
version: "v0.8.0"
6573

6674
- name: Install rust toolchain
75+
if: steps.build-cache.outputs.cache-hit != 'true'
6776
uses: dtolnay/rust-toolchain@master
6877
with:
6978
toolchain: stable
7079
targets: ${{matrix.rust-target}}
7180

7281
- name: Build rewatch
82+
if: steps.build-cache.outputs.cache-hit != 'true'
7383
run: cargo build --manifest-path rewatch/Cargo.toml --target ${{matrix.rust-target}} --release
7484

7585
- name: Get artifact dir name
86+
id: artifact-dir
7687
run: node .github/workflows/get_artifact_dir_name.js
7788

7889
- name: "Upload artifact: rewatch binary"
7990
uses: actions/upload-artifact@v4
8091
with:
81-
name: rewatch-${{env.artifact_dir_name}}
92+
name: rewatch-${{ steps.artifact-dir.dirname }}
8293
path: rewatch/target/${{matrix.rust-target}}/release/rewatch${{ runner.os == 'Windows' && '.exe' || '' }}
8394

8495
# Build statically linked Linux binaries in an Alpine-based Docker container
@@ -373,6 +384,7 @@ jobs:
373384
- name: Build playground compiler
374385
if: matrix.os == 'ubuntu-latest'
375386
run: |
387+
opam install js_of_ocaml.5.8.1
376388
opam exec -- node packages/playground-bundling/scripts/generate_cmijs.js
377389
opam exec -- dune build --profile browser
378390
cp ./_build/default/jscomp/jsoo/jsoo_playground_main.bc.js playground/compiler.js

.github/workflows/get_artifact_dir_name.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ const { dirName: artifactDirName } = require("../../cli/bin_path.js");
55

66
// Pass artifactDirName to subsequent GitHub actions
77
fs.appendFileSync(
8-
process.env.GITHUB_ENV,
9-
`artifact_dir_name=${artifactDirName}${os.EOL}`
8+
process.env.GITHUB_OUTPUT,
9+
`dirname=${artifactDirName}${os.EOL}`
1010
);

0 commit comments

Comments
 (0)