Skip to content

Commit bb528ef

Browse files
committed
build and cache CPython once in test.yaml
i.e. match what we're doing in release.yaml. TODO: Factor out the "Populate cache" job into a reusable action instead of cut-and-pasting it. Signed-off-by: Joel Dice <[email protected]>
1 parent 22b934f commit bb528ef

File tree

1 file changed

+55
-2
lines changed

1 file changed

+55
-2
lines changed

.github/workflows/test.yaml

Lines changed: 55 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,59 @@ env:
1414
WASI_SDK_RELEASE: wasi-sockets-alpha-5
1515

1616
jobs:
17+
linux:
18+
name: Populate cache
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
with:
24+
submodules: "recursive"
25+
26+
- uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.12"
29+
30+
- name: Install latest Rust nightly toolchain
31+
uses: dtolnay/rust-toolchain@nightly
32+
with:
33+
targets: wasm32-wasip1 wasm32-unknown-unknown
34+
35+
- name: Install latest Rust stable toolchain
36+
uses: dtolnay/rust-toolchain@stable
37+
with:
38+
targets: wasm32-wasip1 wasm32-unknown-unknown
39+
components: clippy, rustfmt
40+
41+
- name: Install Rust std source
42+
shell: bash
43+
run: rustup component add rust-src --toolchain nightly
44+
45+
- uses: Swatinem/rust-cache@v2
46+
with:
47+
shared-key: "rust-cache-${{ hashFiles('./Cargo.lock') }}"
48+
cache-on-failure: false
49+
50+
- name: Install WASI-SDK
51+
shell: bash
52+
run: |
53+
cd /tmp
54+
curl -LO https://github.com/dicej/wasi-sdk/releases/download/${WASI_SDK_RELEASE}/wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz
55+
tar xf wasi-sdk-${WASI_SDK_VERSION}-linux.tar.gz
56+
mv wasi-sdk-${WASI_SDK_VERSION} /opt/wasi-sdk
57+
58+
- name: Cache CPython
59+
id: cache-cpython-wasi
60+
uses: actions/cache@v4
61+
with:
62+
path: cpython/builddir/wasi
63+
key: cpython-wasi
64+
enableCrossOsArchive: true
65+
66+
- name: Build
67+
shell: bash
68+
run: cargo build --release
69+
1770
test:
1871
name: Test
1972
strategy:
@@ -67,9 +120,9 @@ jobs:
67120
shell: bash
68121
run: echo "WASI_SDK_PATH=$(cygpath -m /tmp/wasi-sdk-${WASI_SDK_VERSION})" >> ${GITHUB_ENV}
69122

70-
- name: Cache CPython
123+
- name: Restore CPython
71124
id: cache-cpython-wasi
72-
uses: actions/cache@v4
125+
uses: actions/cache/restore@v4
73126
with:
74127
path: cpython/builddir/wasi
75128
key: cpython-wasi

0 commit comments

Comments
 (0)