Skip to content

Commit

Permalink
chore(ci): install weval during CI
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Adossi <[email protected]>
  • Loading branch information
vados-cosmonic committed Nov 25, 2024
1 parent dbc24fc commit 98cb7b9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 5 deletions.
44 changes: 43 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@ jobs:
macos-latest
]
node: [18.x, 20.x, latest]
weval-version:
- 'v0.3.2'
include:
- os: windows-latest
weval-bin-path: .weval-bin/weval.exe
- os: ubuntu-latest
weval-bin-path: .weval-bin/weval
- os: macos-latest
weval-bin-path: .weval-bin/weval
exclude:
- os: macos-latest
node: 20.x
Expand All @@ -61,19 +70,52 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}

# Use cached weval bin if present
- name: Cache weval bin
id: cache-weval-bin
uses: actions/cache@v4
with:
path: .weval-bin
key: weval-bin-${{ matrix.weval-version }}-${{ matrix.os }}

# (no cached weval bin) download weval release
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'ubuntu-latest' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ matrix.weval-version }}/weval-${{ matrix.weval-version }}-x86_64-linux.tar.xz
tar -xvJf weval-${{ matrix.weval-version }}-x86_64-linux.tar.xz
mv weval-${{ matrix.weval-version }}-x86_64-linux/weval .weval-bin
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'windows-latest' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ matrix.weval-version }}/weval-${{ matrix.weval-version }}-x86_64-windows.zip
unzip weval-${{ matrix.weval-version }}-x86_64-windows.zip
mv weval-${{ matrix.weval-version }}-x86_64-windows .weval-bin
- if: ${{ steps.cache-weval-bin.outputs.cache-hit != 'true' && matrix.os == 'macos-latest' }}
run: |
curl -LO https://github.com/bytecodealliance/weval/releases/download/${{ matrix.weval-version }}/weval-${{ matrix.weval-version }}-aarch64-macos.tar.xz
tar -xvJf weval-${{ matrix.weval-version }}-aarch64-macos.tar.xz
mkdir .weval-bin
mv weval-${{ matrix.weval-version }}-aarch64-macos/weval .weval-bin/
# Perform NPM install
- name: Install NPM packages
run: npm ci

- 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'
env:
WEVAL_BIN_PATH: ${{ matrix.weval-bin-path }}
run: npm run test

build-wasi-tests:
name: WASI Test Generation
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

11 changes: 8 additions & 3 deletions test/cli.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { resolve } from "node:path";
import { execArgv } from "node:process";
import { execArgv, env } from "node:process";
import { deepStrictEqual, ok, strictEqual } from "node:assert";
import {
mkdir,
Expand Down Expand Up @@ -504,7 +504,7 @@ export async function cliTest(_fixtures) {
});

test("Componentize", async () => {
const { stdout, stderr } = await exec(
const args = [
jcoPath,
"componentize",
"test/fixtures/componentize/source.js",
Expand All @@ -515,7 +515,12 @@ export async function cliTest(_fixtures) {
"test/fixtures/componentize/source.wit",
"-o",
outFile
);
];
if (env.WEVAL_BIN_PATH) {
args.push("--weval-bin", env.WEVAL_BIN_PATH);
}

const { stdout, stderr } = await exec(...args);
strictEqual(stderr, "");
{
const { stderr } = await exec(
Expand Down

0 comments on commit 98cb7b9

Please sign in to comment.