patched v0.1.37 #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> | |
# SPDX-License-Identifier: MIT | |
name: Test WASM (reusable) | |
on: | |
push: | |
workflow_call: | |
inputs: | |
go-version: | |
required: true | |
type: string | |
permissions: | |
contents: read | |
jobs: | |
test-wasm: | |
runs-on: ubuntu-24.04 | |
name: WASM | |
strategy: | |
matrix: | |
go-version: ['1.22', '1.23'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Go | |
run: | | |
version=$( | |
curl -s 'https://go.dev/dl/?mode=json&include=all' \ | |
| jq -r '.[].version | select(startswith("go${{ matrix.go-version }}."))' \ | |
| sort -V \ | |
| tail -n 1 | |
) | |
curl -sSfL https://dl.google.com/go/${version}.linux-amd64.tar.gz | tar -C ~ -xzf - | |
- name: Node version | |
id: node-version | |
run: | | |
if [ '${{ matrix.go-version }}' = '1.20' ]; then | |
# Go 1.20's wasm_exec_node.js doesn't work with Node v20 | |
# This can be removed once all pion repositories are switched to use Go 1.22 | |
echo 'version=16' | tee -a ${GITHUB_OUTPUT} | |
fi | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '${{ steps.node-version.outputs.version || 20 }}.x' | |
- name: Set Go Root | |
run: echo "GOROOT=${HOME}/go" >> $GITHUB_ENV | |
- name: Set Go Path | |
run: echo "GOPATH=${HOME}/go" >> $GITHUB_ENV | |
- name: Set Go Path | |
run: echo "GO_JS_WASM_EXEC=${GOROOT}/misc/wasm/go_js_wasm_exec" >> $GITHUB_ENV | |
- name: Install NPM modules | |
run: yarn install | |
- name: Run Tests | |
run: | | |
if [ -f .github/.ci.conf ]; then . .github/.ci.conf; fi | |
GOOS=js GOARCH=wasm \ | |
${GOPATH}/bin/go test \ | |
-exec="${GO_JS_WASM_EXEC}" \ | |
-v ./... |