Skip to content

Reduce flakiness of wasm tests #1481

Reduce flakiness of wasm tests

Reduce flakiness of wasm tests #1481

Workflow file for this run

---
name: "Build & Test"
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- "*"
merge_group:
types:
- "checks_requested"
jobs:
build:
name: "Build Binary"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v5"
- uses: "authzed/actions/setup-go@main"
- uses: "authzed/actions/go-build@main"
image-build:
name: "Build Container Image"
runs-on: "ubuntu-latest"
steps:
- uses: "actions/checkout@v5"
- uses: "authzed/actions/docker-build@main"
unit:
name: "Run Unit Tests"
runs-on: "${{ matrix.os }}"
strategy:
matrix:
os: ["ubuntu-latest"] # TODO(miparnisari): add "windows-latest" after fixing the tests
steps:
- uses: "actions/checkout@v5"
- uses: "authzed/actions/setup-go@main"
- name: "Unit tests with coverage"
run: "go run mage.go test:runWithCoverage"
- name: "Upload coverage to Codecov"
uses: "codecov/[email protected]"
with:
files: "./coverage.txt"
verbose: true
token: "${{ secrets.CODECOV_TOKEN }}"
fail_ci_if_error: false
development:
name: "WASM Tests"
runs-on: "depot-ubuntu-24.04-4"
steps:
- uses: "actions/checkout@v5"
- uses: "authzed/actions/setup-go@main"
with:
# NOTE: This needs to match the toolchain version, or else
# go env gopath won't point at the right install location for the
# wasm tool.
go-version: "1.23.2"
- name: "Disable AppArmor"
if:
"runner.os == 'Linux'"
# Disable AppArmor for Ubuntu 23.10+.
# https://chromium.googlesource.com/chromium/src/+/main/docs/security/apparmor-userns-restrictions.md
run: "echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"
- name: "Install wasmbrowsertest"
run: "go install github.com/agnivade/wasmbrowsertest@latest"
# cleanenv is a util provided by the wasmbrowsertest package that removes
# environment variables from the environment handed to wasmbrowsertest.
# this works around https://github.com/agnivade/wasmbrowsertest/issues/40,
# which we were experiencing on depot.
- name: "Install cleanenv"
run: "go install github.com/agnivade/wasmbrowsertest/cmd/cleanenv@latest"
- name: "Run WASM Tests"
# There's a whole bunch of vars in the environment that aren't needed for running this test, so we clear them out.
# NOTE: if you need to do this in the future, I recommend bashing into the container and running `env | sort | less`
run: |-
GOOS=js \
GOARCH=wasm \
cleanenv \
-remove-prefix GITHUB_ \
-remove-prefix ANDROID_ \
-remove-prefix JAVA_ \
-remove-prefix DOTNET_ \
-remove-prefix RUNNER_ \
-remove-prefix HOMEBREW_ \
-remove-prefix runner_ \
-- \
go test ./pkg/wasm/... -exec $(go env GOPATH)/bin/wasmbrowsertest