github.com/tetratelabs/wazero@v1.2.1/.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.20"  # Current Go version
    34            - "1.18"  # 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@v3
    43          with:
    44            go-version: ${{ matrix.go-version }}
    45            cache: true
    46  
    47        - run: make spectest.${{ matrix.spec-version }}
    48  
    49    test_scratch:
    50      name: ${{ matrix.spec-version }} / ${{ matrix.arch }}, Go-${{ matrix.go-version }}
    51      runs-on: ubuntu-22.04
    52      strategy:
    53        fail-fast: false  # don't fail fast as sometimes failures are arch/OS specific
    54        matrix:  # Use versions consistent with wazero's Go support policy.
    55          go-version:
    56            - "1.20"  # Current Go version
    57            - "1.18"  # Floor Go version of wazero (current - 2)
    58          arch:
    59            - "arm64"
    60            - "riscv64"
    61          spec-version:
    62            - "v1"
    63            - "v2"
    64  
    65      steps:
    66        - uses: actions/checkout@v3
    67  
    68        - uses: actions/setup-go@v3
    69          with:
    70            go-version: ${{ matrix.go-version }}
    71            cache: true
    72  
    73        - name: Build test binaries
    74          run: go list -f '{{.Dir}}' ./... | grep 'spectest/${{ matrix.spec-version }}' | xargs -Ipkg go test pkg -c -o spectest.test
    75          env:
    76            GOARCH: ${{ matrix.arch }}
    77            CGO_ENABLED: 0
    78  
    79        - name: Set up QEMU
    80          if: ${{ matrix.arch != 'amd64' }}
    81          uses: docker/setup-qemu-action@v2
    82          with:  # Avoid docker.io rate-limits; built with internal-images.yml
    83            image: ghcr.io/tetratelabs/wazero/internal-binfmt
    84            platforms: ${{ matrix.arch }}
    85  
    86        - name: Build scratch container
    87          run: |
    88            echo 'FROM scratch' >> Dockerfile
    89            echo 'CMD ["/test"]' >> Dockerfile
    90            docker buildx build -t wazero:test --platform linux/${{ matrix.arch }} .
    91  
    92        - name: Run built test binaries
    93          # Note: This mounts /tmp to allow t.TempDir() in tests.
    94          run: docker run --platform linux/${{ matrix.arch }} -v $(pwd)/spectest.test:/test --tmpfs /tmp --rm -t wazero:test