Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
Signed-off-by: Edoardo Vacchi <[email protected]>
  • Loading branch information
evacchi committed Feb 21, 2024
1 parent 06dc518 commit 9f77f56
Showing 1 changed file with 120 additions and 119 deletions.
239 changes: 120 additions & 119 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,69 +57,70 @@ jobs:

- run: make check

test:
name: ${{ matrix.platform.arch }}, ${{ matrix.platform.os }}, Go-${{ matrix.go-version }}
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: # Use versions consistent with wazero's Go support policy.
platform:
- os: ubuntu-22.04
arch: amd64
- os: macos-12
arch: amd64
- os: windows-2022
arch: amd64
- os: macos-14
arch: arm64
go-version:
- "1.22" # Current Go version
- "1.20" # Floor Go version of wazero (current - 2)

steps:

- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

# Ensure the pagefile is large enough to execute tests like TestStore_hammer_close on Windows.
- name: configure Pagefile
uses: al-cheb/[email protected]
if: runner.os == 'Windows'
with:
minimum-size: 8GB
maximum-size: 16GB
disk-root: "D:"

# Run -race could be really slow without -short, so run them together on this workflow.
# Since -short is not added in the scratch tests, all the tests are run in CI in practice.
- run: make test go_test_options='-timeout 10m -race -short'

- name: "Generate coverage report" # only once (not per OS)
if: runner.os == 'Linux'
run: make coverage

- name: "Upload coverage report" # only on main push and only once (not per OS)
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && runner.os == 'Linux'
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash)
# test:
# name: ${{ matrix.platform.arch }}, ${{ matrix.platform.os }}, Go-${{ matrix.go-version }}
# runs-on: ${{ matrix.platform.os }}
# strategy:
# fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
# matrix: # Use versions consistent with wazero's Go support policy.
# platform:
# - os: ubuntu-22.04
# arch: amd64
## - os: macos-12
## arch: amd64
## - os: windows-2022
## arch: amd64
## - os: macos-14
## arch: arm64
# go-version:
## - "1.22" # Current Go version
# - "1.20" # Floor Go version of wazero (current - 2)
#
# steps:
#
# - uses: actions/checkout@v3
#
# - uses: actions/setup-go@v4
# with:
# go-version: ${{ matrix.go-version }}
#
# # Ensure the pagefile is large enough to execute tests like TestStore_hammer_close on Windows.
# - name: configure Pagefile
# uses: al-cheb/[email protected]
# if: runner.os == 'Windows'
# with:
# minimum-size: 8GB
# maximum-size: 16GB
# disk-root: "D:"
#
# # Run -race could be really slow without -short, so run them together on this workflow.
# # Since -short is not added in the scratch tests, all the tests are run in CI in practice.
# - run: make test go_test_options='-timeout 10m -race -short'
#
# - name: "Generate coverage report" # only once (not per OS)
# if: runner.os == 'Linux'
# run: make coverage
#
# - name: "Upload coverage report" # only on main push and only once (not per OS)
# if: github.event_name == 'push' && github.ref == 'refs/heads/main' && runner.os == 'Linux'
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# run: bash <(curl -s https://codecov.io/bash)

test_scratch:
name: ${{ matrix.arch }}, Linux (scratch), Go-${{ matrix.go-version }}
runs-on: ubuntu-22.04
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: # Use versions consistent with wazero's Go support policy.
exec: [1, 2, 3, 4, 5, 6, 7, 8, 9 ,10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
go-version:
- "1.22" # Current Go version
# - "1.22" # Current Go version
- "1.20" # Floor Go version of wazero (current - 2)
arch:
- "amd64"
- "arm64"
- "riscv64"
# - "arm64"
# - "riscv64"

steps:

Expand Down Expand Up @@ -154,70 +155,70 @@ jobs:
- name: Run built test binaries
# This runs all tests compiled above in sequence. Note: This mounts /tmp to allow t.TempDir() in tests.
run: find . -name "*.test" | xargs -Itestbin docker run --platform linux/${{ matrix.arch }} -v $(pwd)/testbin:/test -v $(pwd)/wazerocli:/wazero -e WAZEROCLI=/wazero --tmpfs /tmp --rm -t wazero:test

bench:
name: Benchmark
runs-on: ubuntu-22.04

steps:
# Unlike the other CGO libraries, WasmEdge requires offline installation.
- name: Install WasmEdge
run: |
wget -qO- https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -p /usr/local -v ${WASMEDGE_VERSION}
# The version here is coupled to internal/integration_test/go.mod, but it
# isn't always the same as sometimes the Go layer has a broken release.
env:
WASMEDGE_VERSION: 0.12.1

- uses: actions/checkout@v3

- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- run: make bench

# This ensures that internal/integration_test/fuzz is runnable, and is not intended to
# run full-length fuzzing while trying to find low-hanging frontend bugs.
fuzz:
name: Minimal Fuzzing (${{ matrix.platform.os }}, ${{ matrix.platform.arch }} )
runs-on: ${{ matrix.platform.os }}
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix: # Use versions consistent with wazero's Go support policy.
platform:
- os: ubuntu-22.04
arch: amd64
- os: macos-14
arch: arm64

steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}

- uses: actions/cache@v3
id: cache
with:
# Cache corpus and artifacts so that we don't start from scratch but rather with a meaningful corpus
# in the subsequent CI jobs.
path: |
~/.cargo
~/.cache/go-build
~/go/pkg/mod
~/.rustup/toolchains/
internal/integration_test/fuzz/target
internal/integration_test/fuzz/fuzz/artifacts
internal/integration_test/fuzz/fuzz/corpus
key: build-fuzz-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'Makefile', '**/Cargo.lock', '**/Cargo.toml', '**/*.rs') }}

- run: cargo install cargo-fuzz
if: steps.cache.outputs.cache-hit != 'true'
# Run fuzzing only for a minute, not a full-length intensive one, but 60 seconds seems enough to find minor "front-end"
# bugs which might exist in binary parser, validation, or instantiation phase while not pressuring CI jobs.
- run: make fuzz fuzz_timeout_seconds=60
if: ${{ github.event_name == 'pull_request' }}
# Run a bit longer on main branch push!
- run: make fuzz fuzz_timeout_seconds=180
if: ${{ github.event_name == 'push' }}
#
# bench:
# name: Benchmark
# runs-on: ubuntu-22.04
#
# steps:
# # Unlike the other CGO libraries, WasmEdge requires offline installation.
# - name: Install WasmEdge
# run: |
# wget -qO- https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- -p /usr/local -v ${WASMEDGE_VERSION}
# # The version here is coupled to internal/integration_test/go.mod, but it
# # isn't always the same as sometimes the Go layer has a broken release.
# env:
# WASMEDGE_VERSION: 0.12.1
#
# - uses: actions/checkout@v3
#
# - uses: actions/setup-go@v4
# with:
# go-version: ${{ env.GO_VERSION }}
#
# - run: make bench
#
# # This ensures that internal/integration_test/fuzz is runnable, and is not intended to
# # run full-length fuzzing while trying to find low-hanging frontend bugs.
# fuzz:
# name: Minimal Fuzzing (${{ matrix.platform.os }}, ${{ matrix.platform.arch }} )
# runs-on: ${{ matrix.platform.os }}
# strategy:
# fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
# matrix: # Use versions consistent with wazero's Go support policy.
# platform:
# - os: ubuntu-22.04
# arch: amd64
# - os: macos-14
# arch: arm64
#
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-go@v4
# with:
# go-version: ${{ env.GO_VERSION }}
#
# - uses: actions/cache@v3
# id: cache
# with:
# # Cache corpus and artifacts so that we don't start from scratch but rather with a meaningful corpus
# # in the subsequent CI jobs.
# path: |
# ~/.cargo
# ~/.cache/go-build
# ~/go/pkg/mod
# ~/.rustup/toolchains/
# internal/integration_test/fuzz/target
# internal/integration_test/fuzz/fuzz/artifacts
# internal/integration_test/fuzz/fuzz/corpus
# key: build-fuzz-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum', 'Makefile', '**/Cargo.lock', '**/Cargo.toml', '**/*.rs') }}
#
# - run: cargo install cargo-fuzz
# if: steps.cache.outputs.cache-hit != 'true'
# # Run fuzzing only for a minute, not a full-length intensive one, but 60 seconds seems enough to find minor "front-end"
# # bugs which might exist in binary parser, validation, or instantiation phase while not pressuring CI jobs.
# - run: make fuzz fuzz_timeout_seconds=60
# if: ${{ github.event_name == 'pull_request' }}
# # Run a bit longer on main branch push!
# - run: make fuzz fuzz_timeout_seconds=180
# if: ${{ github.event_name == 'push' }}

0 comments on commit 9f77f56

Please sign in to comment.