Replace wazerox with wazero #254
Workflow file for this run
This file contains 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
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
mode: | |
- cgo | |
- tinygo | |
- wazero | |
os: | |
- macos-12 | |
- ubuntu-22.04 | |
- windows-2022 | |
exclude: | |
# https://github.com/tinygo-org/tinygo/issues/3594 | |
- os: windows-2022 | |
mode: tinygo | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version-file: go.work | |
cache: true | |
- name: setup re2 for cgo (linux) | |
if: ${{ startsWith(matrix.os, 'ubuntu-') && matrix.mode == 'cgo' }} | |
run: sudo apt-get update && sudo apt-get install -y libre2-dev | |
- name: setup re2 for cgo (mac) | |
if: ${{ startsWith(matrix.os, 'macos-') && matrix.mode == 'cgo' }} | |
run: brew install re2 | |
- name: setup msys2 for cgo (windows) | |
if: ${{ startsWith(matrix.os, 'windows-') && matrix.mode == 'cgo' }} | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: true | |
# This version of go is not sync with setup-go, but this is probably the best we can do | |
pacboy: gcc:p re2:p go:p pkg-config:p diffutils:p | |
- name: setup tinygo | |
if: ${{ matrix.mode == 'tinygo' }} | |
uses: acifani/setup-tinygo@v1 | |
with: | |
tinygo-version: 0.30.0 | |
- name: setup wasmtime for tinygo | |
if: ${{ matrix.mode == 'tinygo' }} | |
run: go install github.com/wasilibs/tools/cmd/wasmtime@e3baa6a6b2955f731f4490728b09fb87b35e27e9 | |
- name: run checks | |
run: go run mage.go check | |
if: ${{ !startsWith(matrix.os, 'windows-') || matrix.mode != 'cgo' }} | |
env: | |
RE2_TEST_MODE: ${{ matrix.mode }} | |
# General coverage should be good enough to not need to slow down development | |
# on these slow tests. | |
RE2_TEST_EXHAUSTIVE: ${{ github.event_name != 'pull_request' && '1' || '0'}} | |
# Windows runner seems to not have enough CPU performance to keep up without a memory limit | |
GOMEMLIMIT: ${{ github.event_name != 'pull_request' && '1GiB' || '' }} | |
# Race detector currently fails with Windows | |
TEST_NORACE: ${{ startsWith(matrix.os, 'windows-') && matrix.mode == 'wazero' && 'true' || '' }} | |
- name: run checks (windows cgo) | |
run: go run mage.go check | |
if: ${{ startsWith(matrix.os, 'windows-') && matrix.mode == 'cgo' }} | |
# Shell does not support conditional expressions using matrix, so for now we duplicate the steps | |
shell: 'msys2 {0}' | |
env: | |
RE2_TEST_MODE: ${{ matrix.mode }} | |
# General coverage should be good enough to not need to slow down development | |
# on these slow tests. | |
RE2_TEST_EXHAUSTIVE: ${{ github.event_name != 'pull_request' && '1' || '0'}} | |
# Windows runner seems to not have enough CPU performance to keep up without a memory limit | |
GOMEMLIMIT: ${{ github.event_name != 'pull_request' && '1GiB' || '' }} | |
# Runs tests using wazero inside a minimal golang docker image. This makes sure the code builds | |
# even when there is no C toolchain available. It is possible for code to work fine with CGO_ENABLED=0 | |
# but not build without a C toolchain available, e.g. if C source files are checked into the repo | |
# without a build tag to exclude them from pure-Go builds. | |
docker-build: | |
runs-on: ubuntu-22.04 | |
container: | |
image: golang:alpine | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- run: if command -v gcc &> /dev/null; then echo "GCC found but not expected"; exit 321; fi | |
- run: go run mage.go test | |
env: | |
TEST_NORACE: "true" |