github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/.github/workflows/spectest.yaml (about)

     1  name: WebAssembly Core Specification Test
     2  on:
     3    pull_request:
     4      branches: [main]
     5      paths-ignore:  # ignore docs as they are built with Netlify.
     6        - '**/*.md'
     7        - 'site/**'
     8        - 'netlify.toml'
     9    push:
    10      branches: [main]
    11      paths-ignore:  # ignore docs as they are built with Netlify.
    12        - '**/*.md'
    13        - 'site/**'
    14        - 'netlify.toml'
    15  
    16  defaults:
    17    run:  # use bash for all operating systems unless overridden
    18      shell: bash
    19  
    20  concurrency:
    21    # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
    22    group: ${{ github.ref }}-${{ github.workflow }}-${{ github.actor }}
    23    cancel-in-progress: true
    24  
    25  jobs:
    26    test_amd64:
    27      name: ${{ matrix.spec-version }} - linux/amd64, Go-${{ matrix.go-version }}
    28      runs-on: ubuntu-22.04
    29      strategy:
    30        fail-fast: false  # don't fail fast as sometimes failures are arch/OS specific
    31        matrix:  # Use versions consistent with wazero's Go support policy.
    32          go-version:
    33            - "1.21"  # Current Go version
    34            - "1.19"  # Floor Go version of wazero (current - 2)
    35          spec-version:
    36            - "v1"
    37            - "v2"
    38  
    39      steps:
    40        - uses: actions/checkout@v3
    41  
    42        - uses: actions/setup-go@v4
    43          with:
    44            go-version: ${{ matrix.go-version }}
    45  
    46        - run: make spectest.${{ matrix.spec-version }}
    47  
    48    test_scratch:
    49      name: ${{ matrix.spec-version }} / ${{ matrix.arch }}, Go-${{ matrix.go-version }}
    50      runs-on: ubuntu-22.04
    51      strategy:
    52        fail-fast: false  # don't fail fast as sometimes failures are arch/OS specific
    53        matrix:  # Use versions consistent with wazero's Go support policy.
    54          go-version:
    55            - "1.21"  # Current Go version
    56            - "1.19"  # Floor Go version of wazero (current - 2)
    57          arch:
    58            - "arm64"
    59            - "riscv64"
    60          spec-version:
    61            - "v1"
    62            - "v2"
    63  
    64      steps:
    65        - uses: actions/checkout@v3
    66  
    67        - uses: actions/setup-go@v4
    68          with:
    69            go-version: ${{ matrix.go-version }}
    70  
    71        - name: Build test binaries
    72          run: go list -f '{{.Dir}}' ./... | grep 'spectest/${{ matrix.spec-version }}' | xargs -Ipkg go test pkg -c -o spectest.test
    73          env:
    74            GOARCH: ${{ matrix.arch }}
    75            CGO_ENABLED: 0
    76  
    77        - name: Set up QEMU
    78          if: ${{ matrix.arch != 'amd64' }}
    79          uses: docker/setup-qemu-action@v2
    80          with:  # Avoid docker.io rate-limits; built with internal-images.yml
    81            image: ghcr.io/tetratelabs/wazero/internal-binfmt
    82            platforms: ${{ matrix.arch }}
    83  
    84        - name: Build scratch container
    85          run: |
    86            echo 'FROM scratch' >> Dockerfile
    87            echo 'CMD ["/test"]' >> Dockerfile
    88            docker buildx build -t wazero:test --platform linux/${{ matrix.arch }} .
    89  
    90        - name: Run built test binaries
    91          # Note: This mounts /tmp to allow t.TempDir() in tests.
    92          run: docker run --platform linux/${{ matrix.arch }} -v $(pwd)/spectest.test:/test --tmpfs /tmp --rm -t wazero:test