Skip to content

Commit 680568e

Browse files
author
Guy Bedford
authored
GitHub actions workflow optimization (#425)
1 parent 70c6afc commit 680568e

File tree

11 files changed

+2963
-62
lines changed

11 files changed

+2963
-62
lines changed

.github/workflows/main.yml

Lines changed: 130 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,32 @@ defaults:
1111
shell: bash
1212

1313
jobs:
14-
test:
15-
name: Test
14+
build:
15+
name: Jco Build
16+
runs-on: 'ubuntu-latest'
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: 'latest'
22+
- name: Install Rust
23+
run: rustup update stable --no-self-update && rustup default stable
24+
- name: Install wasm32-unknown-unknown target
25+
run: rustup target add wasm32-unknown-unknown
26+
- name: Install wasm32-wasi target
27+
run: rustup target add wasm32-wasi
28+
- name: Install NPM packages
29+
run: npm install
30+
- name: Build
31+
run: npm run build
32+
- name: Upload Jco Build
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: jco-build
36+
path: obj
37+
38+
test-jco:
39+
name: Jco Test Suite
1640
strategy:
1741
matrix:
1842
os: [
@@ -31,62 +55,129 @@ jobs:
3155
- os: windows-latest
3256
node: 18.x
3357
runs-on: ${{ matrix.os }}
58+
needs: [build]
3459
steps:
3560
- uses: actions/checkout@v4
36-
with:
37-
submodules: recursive
3861
- uses: actions/setup-node@v3
3962
with:
4063
node-version: ${{ matrix.node }}
41-
- uses: denoland/setup-deno@v1
42-
with:
43-
deno-version: v1.x
44-
- name: Install Rust
45-
run: rustup update stable --no-self-update && rustup default stable
46-
- name: Install wasm32-unknown-unknown target
47-
run: rustup target add wasm32-unknown-unknown
48-
- name: Install wasm32-wasi target
49-
run: rustup target add wasm32-wasi
50-
- run: |
51-
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-linux.tar.gz -L | tar xzvf -
52-
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-16.0" >> $GITHUB_ENV
53-
if: matrix.os == 'ubuntu-latest'
54-
- run: |
55-
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-macos.tar.gz -L | tar xzvf -
56-
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-16.0" >> $GITHUB_ENV
57-
if: matrix.os == 'macos-latest'
58-
- run: |
59-
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-mingw.tar.gz -L | tar xzvf -
60-
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-16.0" >> $GITHUB_ENV
61-
if: matrix.os == 'windows-latest'
62-
6364
- name: Install NPM packages
6465
run: npm install
65-
66-
- name: Build
67-
run: npm run build
68-
66+
- name: Download Build
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: jco-build
70+
path: obj
6971
- name: Test LTS Node.js
7072
run: npm run test:lts
7173
if: matrix.node == '18.x' || matrix.node == '20.x'
72-
7374
- name: Test Latest Node.js
7475
run: npm run test
7576
if: matrix.node == 'latest'
7677

77-
- name: Cache Conformance Tests
78-
id: cache-conformance-tests
78+
build-wasi-tests:
79+
name: WASI Test Generation
80+
runs-on: ubuntu-latest
81+
outputs:
82+
cache-key: ${{ steps.cache-wasi-tests.outputs.cache-primary-key }}
83+
steps:
84+
- uses: actions/checkout@v4
85+
with:
86+
submodules: recursive
87+
- name: Cache WASI Tests
88+
id: cache-wasi-tests
7989
uses: actions/cache@v4
8090
with:
81-
path: tests/gen/*.wasm
82-
key: conformance-wasm-${{ hashFiles('.git/modules/submodules/wasmtime/refs/heads/jco-fork') }}
83-
84-
- name: Generate Conformance Tests
85-
if: steps.cache-conformance-tests.outputs.cache-hit != 'true'
91+
path: tests/gen
92+
key: wasi-${{ hashFiles('xtask/src/generate/tests.rs', 'submodules/wasmtime/Cargo.lock') }}
93+
- name: Install Rust
94+
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
95+
run: rustup update stable --no-self-update && rustup default stable
96+
- name: Install wasm32-unknown-unknown target
97+
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
98+
run: rustup target add wasm32-unknown-unknown
99+
- name: Install wasm32-wasi target
100+
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
101+
run: rustup target add wasm32-wasi
102+
- name: Install wasm-tools
103+
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
104+
run: cargo install wasm-tools
105+
- name: Generate WASI Tests
106+
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
86107
run: cargo xtask generate tests
108+
- name: Upload Generated WASI Tests
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: wasi-tests
112+
path: tests/gen
113+
114+
test-wasi-deno:
115+
name: Jco Deno WASI Conformance Tests
116+
runs-on: 'ubuntu-latest'
117+
needs: [build, build-wasi-tests]
118+
steps:
119+
- uses: actions/checkout@v4
120+
- uses: actions/setup-node@v3
121+
with:
122+
node-version: 'latest'
123+
- uses: denoland/setup-deno@v1
124+
with:
125+
deno-version: v1.x
126+
- name: Install NPM packages
127+
run: npm install
128+
- name: Download Build
129+
uses: actions/download-artifact@v4
130+
with:
131+
name: jco-build
132+
path: obj
133+
- name: Download WASI Tests
134+
uses: actions/download-artifact@v4
135+
with:
136+
name: wasi-tests
137+
path: tests/gen
138+
- name: WASI Preview 2 Conformance
139+
run: cargo test deno_
87140

141+
test-wasi:
142+
name: Jco Node.js WASI Conformance Tests
143+
strategy:
144+
matrix:
145+
os: [
146+
ubuntu-latest,
147+
windows-latest,
148+
macos-latest
149+
]
150+
node: [18.x, 20.x, latest]
151+
exclude:
152+
- os: macos-latest
153+
node: 20.x
154+
- os: macos-latest
155+
node: 18.x
156+
- os: windows-latest
157+
node: 20.x
158+
- os: windows-latest
159+
node: 18.x
160+
runs-on: ${{ matrix.os }}
161+
needs: [build, build-wasi-tests]
162+
steps:
163+
- uses: actions/checkout@v4
164+
- uses: actions/setup-node@v3
165+
with:
166+
node-version: ${{ matrix.node }}
167+
- name: Install NPM packages
168+
run: npm install
169+
- name: Download Build
170+
uses: actions/download-artifact@v4
171+
with:
172+
name: jco-build
173+
path: obj
174+
- name: Download WASI Tests
175+
uses: actions/download-artifact@v4
176+
with:
177+
name: wasi-tests
178+
path: tests/gen
88179
- name: WASI Preview 2 Conformance
89-
run: cargo test
180+
run: cargo test node_
90181

91182
test-workspaces:
92183
name: Test Workspaces

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
.vscode
22
node_modules
33
/target
4-
package-lock.json
54
/obj
65
/dist
76
/test/output

lib/console.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)