Skip to content

Commit

Permalink
GitHub actions workflow optimization (#425)
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford authored Apr 26, 2024
1 parent 70c6afc commit 680568e
Show file tree
Hide file tree
Showing 11 changed files with 2,963 additions and 62 deletions.
169 changes: 130 additions & 39 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,32 @@ defaults:
shell: bash

jobs:
test:
name: Test
build:
name: Jco Build
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 'latest'
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable
- name: Install wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown
- name: Install wasm32-wasi target
run: rustup target add wasm32-wasi
- name: Install NPM packages
run: npm install
- name: Build
run: npm run build
- name: Upload Jco Build
uses: actions/upload-artifact@v4
with:
name: jco-build
path: obj

test-jco:
name: Jco Test Suite
strategy:
matrix:
os: [
Expand All @@ -31,62 +55,129 @@ jobs:
- os: windows-latest
node: 18.x
runs-on: ${{ matrix.os }}
needs: [build]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install Rust
run: rustup update stable --no-self-update && rustup default stable
- name: Install wasm32-unknown-unknown target
run: rustup target add wasm32-unknown-unknown
- name: Install wasm32-wasi target
run: rustup target add wasm32-wasi
- run: |
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-linux.tar.gz -L | tar xzvf -
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-16.0" >> $GITHUB_ENV
if: matrix.os == 'ubuntu-latest'
- run: |
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-macos.tar.gz -L | tar xzvf -
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-16.0" >> $GITHUB_ENV
if: matrix.os == 'macos-latest'
- run: |
curl https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-16/wasi-sdk-16.0-mingw.tar.gz -L | tar xzvf -
echo "WASI_SDK_PATH=`pwd`/wasi-sdk-16.0" >> $GITHUB_ENV
if: matrix.os == 'windows-latest'
- name: Install NPM packages
run: npm install

- name: Build
run: npm run build

- name: Download Build
uses: actions/download-artifact@v4
with:
name: jco-build
path: obj
- name: Test LTS Node.js
run: npm run test:lts
if: matrix.node == '18.x' || matrix.node == '20.x'

- name: Test Latest Node.js
run: npm run test
if: matrix.node == 'latest'

- name: Cache Conformance Tests
id: cache-conformance-tests
build-wasi-tests:
name: WASI Test Generation
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-wasi-tests.outputs.cache-primary-key }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache WASI Tests
id: cache-wasi-tests
uses: actions/cache@v4
with:
path: tests/gen/*.wasm
key: conformance-wasm-${{ hashFiles('.git/modules/submodules/wasmtime/refs/heads/jco-fork') }}

- name: Generate Conformance Tests
if: steps.cache-conformance-tests.outputs.cache-hit != 'true'
path: tests/gen
key: wasi-${{ hashFiles('xtask/src/generate/tests.rs', 'submodules/wasmtime/Cargo.lock') }}
- name: Install Rust
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: rustup update stable --no-self-update && rustup default stable
- name: Install wasm32-unknown-unknown target
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: rustup target add wasm32-unknown-unknown
- name: Install wasm32-wasi target
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: rustup target add wasm32-wasi
- name: Install wasm-tools
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: cargo install wasm-tools
- name: Generate WASI Tests
if: steps.cache-wasi-tests.outputs.cache-hit != 'true'
run: cargo xtask generate tests
- name: Upload Generated WASI Tests
uses: actions/upload-artifact@v4
with:
name: wasi-tests
path: tests/gen

test-wasi-deno:
name: Jco Deno WASI Conformance Tests
runs-on: 'ubuntu-latest'
needs: [build, build-wasi-tests]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 'latest'
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Install NPM packages
run: npm install
- name: Download Build
uses: actions/download-artifact@v4
with:
name: jco-build
path: obj
- name: Download WASI Tests
uses: actions/download-artifact@v4
with:
name: wasi-tests
path: tests/gen
- name: WASI Preview 2 Conformance
run: cargo test deno_

test-wasi:
name: Jco Node.js WASI Conformance Tests
strategy:
matrix:
os: [
ubuntu-latest,
windows-latest,
macos-latest
]
node: [18.x, 20.x, latest]
exclude:
- os: macos-latest
node: 20.x
- os: macos-latest
node: 18.x
- os: windows-latest
node: 20.x
- os: windows-latest
node: 18.x
runs-on: ${{ matrix.os }}
needs: [build, build-wasi-tests]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: Install NPM packages
run: npm install
- name: Download Build
uses: actions/download-artifact@v4
with:
name: jco-build
path: obj
- name: Download WASI Tests
uses: actions/download-artifact@v4
with:
name: wasi-tests
path: tests/gen
- name: WASI Preview 2 Conformance
run: cargo test
run: cargo test node_

test-workspaces:
name: Test Workspaces
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.vscode
node_modules
/target
package-lock.json
/obj
/dist
/test/output
Expand Down
7 changes: 0 additions & 7 deletions lib/console.js

This file was deleted.

Loading

0 comments on commit 680568e

Please sign in to comment.