Skip to content

Commit

Permalink
Add GitHub workflow for wasm-wasi-component
Browse files Browse the repository at this point in the history
This adds a GitHub CI workflow for the new wasm-wasi-component language
module.

Some things of note.

1) We need to special case 'wasm-wasi-component' in the 'Output build
   metadata' section as we are splitting the module names on '-' to
   split them into name and version.

2) Apart from needing to tell bindgen about the njs include paths, we
   also need to explicitly specify which version of clang to use to
   work around an issue with multiple versions of clang installed.

Link: <https://gitlab.freedesktop.org/mesa/mesa/-/issues/7268>
Signed-off-by: Andrew Clayton <[email protected]>
  • Loading branch information
ac000 committed Mar 7, 2024
1 parent 8032ce3 commit 0cee7d1
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ jobs:
os: ubuntu-latest
- build: wasm
os: ubuntu-latest
- build: wasm-wasi-component
os: ubuntu-latest

steps:
- uses: actions/checkout@v4
Expand All @@ -57,8 +59,12 @@ jobs:
- name: Output build metadata
id: metadata
run: |
# Split the build name by '-' into module and version
IFS='-' read -r module version <<< "${{ matrix.build }}"
if [ "${{ matrix.build }}" = "wasm-wasi-component" ]; then
module="wasm-wasi-component"
else
# Split the build name by '-' into module and version
IFS='-' read -r module version <<< "${{ matrix.build }}"
fi
testpath="test/test_${module}*"
Expand Down Expand Up @@ -292,6 +298,27 @@ jobs:
make wasm
if: steps.metadata.outputs.module == 'wasm'

##
## wasm-wasi-component
##

- name: Setup rust
run: |
curl https://sh.rustup.rs | sh -s -- -y
if: steps.metadata.outputs.module == 'wasm-wasi-component'

- name: Configure wasm-wasi-component
run: |
./configure wasm-wasi-component
if: steps.metadata.outputs.module == 'wasm-wasi-component'

- name: Make wasm-wasi-component
run: |
CLANG_PATH=/usr/bin/clang-15 \
BINDGEN_EXTRA_CLANG_ARGS="-I../../njs/src -I../../njs/build" \
make wasm-wasi-component
if: steps.metadata.outputs.module == 'wasm-wasi-component'

##
## Tests
##
Expand All @@ -307,15 +334,18 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: '3'
if: steps.metadata.outputs.module != 'wasm'
if: steps.metadata.outputs.module != 'wasm' &&
steps.metadata.outputs.module != 'wasm-wasi-component'

- name: Install pytest
run: |
sudo -H pip install pytest
if: steps.metadata.outputs.module != 'wasm'
if: steps.metadata.outputs.module != 'wasm' &&
steps.metadata.outputs.module != 'wasm-wasi-component'

- name: Run ${{ steps.metadata.outputs.module }} tests
run: |
sudo -E pytest --print-log ${{ steps.metadata.outputs.testpath }}
# Skip pytest if wasm build, as there are no tests yet
if: steps.metadata.outputs.module != 'wasm'
if: steps.metadata.outputs.module != 'wasm' &&
steps.metadata.outputs.module != 'wasm-wasi-component'

0 comments on commit 0cee7d1

Please sign in to comment.