github.com/tetratelabs/wazero@v1.7.1/.github/workflows/integration.yaml (about)

     1  name: Standard Library Integration Tests
     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  env:  # Update this prior to requiring a higher minor version in go.mod
    21    GO_VERSION: "1.22"
    22    TINYGO_VERSION: "0.31.0"
    23    ZIG_VERSION: "0.11.0"
    24    BINARYEN_VERSION: "116"
    25    STDLIB_TESTS: "internal/integration_test/stdlibs"
    26  
    27  concurrency:
    28    # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
    29    group: ${{ github.ref }}-${{ github.workflow }}-${{ github.actor }}
    30    cancel-in-progress: true
    31  
    32  jobs:
    33    build_zig_test_binary:
    34      name: Build Zig test binary
    35      runs-on: ubuntu-22.04
    36      env:
    37        ZIG_INSTALL: ~/zig-install
    38        ZIG_SOURCE: ~/zig-source
    39        BINARYEN_INSTALL: ~/binaryen-install
    40  
    41      steps:
    42        - name: Checkout wazero
    43          uses: actions/checkout@v3
    44  
    45        - uses: actions/cache@v3
    46          id: binary-cache
    47          with:
    48            # Use share the cache containing archives across OSes.
    49            enableCrossOsArchive: true
    50            key: zig-stdlib-test-binary-${{ env.ZIG_VERSION }}
    51            path:
    52              ${{ env.STDLIB_TESTS }}/testdata/zig
    53  
    54        - name: Install Zig build
    55          if: steps.binary-cache.outputs.cache-hit != 'true'
    56          run: |
    57            mkdir -p ${{ env.ZIG_INSTALL }}
    58            curl -sSL https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz | tar -xJ --strip-components=1 -C ${{ env.ZIG_INSTALL }}
    59  
    60        - name: Download Zig source code
    61          if: steps.binary-cache.outputs.cache-hit != 'true'
    62          run: |
    63            mkdir -p ${{ env.ZIG_SOURCE }}
    64            curl -sSL https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-${{ env.ZIG_VERSION }}.tar.xz | tar -xJ --strip-components=1 -C ${{ env.ZIG_SOURCE }}
    65  
    66        - name: Install Binaryen build
    67          if: steps.binary-cache.outputs.cache-hit != 'true'
    68          run: |
    69            mkdir -p ${{ env.BINARYEN_INSTALL }}
    70            curl -sSL https://github.com/WebAssembly/binaryen/releases/download/version_${{ env.BINARYEN_VERSION }}/binaryen-version_${{ env.BINARYEN_VERSION }}-x86_64-linux.tar.gz | tar -xz --strip-components=1 -C ${{ env.BINARYEN_INSTALL }}
    71  
    72        - name: Build Stdlib test binary
    73          if: steps.binary-cache.outputs.cache-hit != 'true'
    74          run: |
    75            PATH=${{ env.ZIG_INSTALL }}:${{ env.BINARYEN_INSTALL }}/bin:$PATH
    76            cd ${{ env.STDLIB_TESTS }}
    77            make build.zig zigroot=${{ env.ZIG_SOURCE }}
    78  
    79    zig:
    80      needs: build_zig_test_binary
    81      name: Zig (${{ matrix.os.name }}, ${{ matrix.arch }})
    82      runs-on: ${{ matrix.os.version }}
    83      strategy:
    84        fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
    85        matrix:
    86          # version is too verbose to be present in the name, so we use the name instead.
    87          # Note that it'd be better to use runner.os in the name, but the runner context is not available in the name field.
    88          os:
    89            - version: ubuntu-22.04
    90              name: Ubuntu
    91            - version: macos-12
    92              name: macOS
    93            - version: windows-2022
    94              name: Windows
    95          arch:     [amd64]
    96          include:
    97            - os:
    98                version: macos-14
    99                name: macOS
   100              arch: arm64
   101  
   102      steps:
   103        - name: Checkout wazero
   104          uses: actions/checkout@v3
   105  
   106        - uses: actions/cache@v3
   107          id: binary-cache
   108          with:
   109            # Use share the cache containing archives across OSes.
   110            enableCrossOsArchive: true
   111            # We need this cache to run tests.
   112            fail-on-cache-miss: true
   113            key: zig-stdlib-test-binary-${{ env.ZIG_VERSION }}
   114            path:
   115              ${{ env.STDLIB_TESTS }}/testdata/zig
   116  
   117        - uses: actions/setup-go@v4
   118          with:
   119            go-version: ${{ env.GO_VERSION }}
   120  
   121        - name: Run built test binaries
   122          run: |
   123            cd ${{ env.STDLIB_TESTS }}
   124            go test -bench='BenchmarkZig' -timeout=20m -benchtime=1x
   125  
   126    build_tinygo_test_binary:
   127      name: Build TinyGo test binary
   128      runs-on: ubuntu-22.04
   129      steps:
   130        - name: Checkout wazero
   131          uses: actions/checkout@v3
   132  
   133        - uses: actions/cache@v3
   134          id: binary-cache
   135          with:
   136            # Use share the cache containing archives across OSes.
   137            enableCrossOsArchive: true
   138            key: tinygo-test-binaries-${{ env.TINYGO_VERSION }}
   139            path:
   140              ${{ env.STDLIB_TESTS }}/testdata/tinygo
   141  
   142        - name: Install TinyGo
   143          if: steps.binary-cache.outputs.cache-hit != 'true'
   144          run: | # installing via curl so commands are similar on OS/x
   145            tinygo_version=${{ env.TINYGO_VERSION }}
   146            curl -sSL https://github.com/tinygo-org/tinygo/releases/download/v${tinygo_version}/tinygo${tinygo_version}.linux-amd64.tar.gz | sudo tar -C /usr/local -xzf -
   147            echo "TINYGOROOT=/usr/local/tinygo" >> $GITHUB_ENV
   148            echo "/usr/local/tinygo/bin" >> $GITHUB_PATH
   149  
   150        - uses: actions/setup-go@v4
   151          if: steps.binary-cache.outputs.cache-hit != 'true'
   152          with:
   153            go-version: ${{ env.GO_VERSION }}
   154  
   155        - name: Build Test Binaries
   156          if: steps.binary-cache.outputs.cache-hit != 'true'
   157          run: |
   158            cd ${{ env.STDLIB_TESTS }}
   159            make build.tinygo
   160  
   161    tinygo:
   162      needs: build_tinygo_test_binary
   163      name: TinyGo (${{ matrix.os.name }}, ${{ matrix.arch }})
   164      runs-on: ${{ matrix.os.version }}
   165      strategy:
   166        fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
   167        matrix:
   168          # version is too verbose to be present in the name, so we use the name instead.
   169          # Note that it'd be better to use runner.os in the name, but the runner context is not available in the name field.
   170          os:
   171            - version: ubuntu-22.04
   172              name: Ubuntu
   173            - version: macos-12
   174              name: macOS
   175            - version: windows-2022
   176              name: Windows
   177          arch:     [amd64]
   178          include:
   179            - os:
   180                version: macos-14
   181                name: macOS
   182              arch: arm64
   183  
   184      steps:
   185        - name: Checkout wazero
   186          uses: actions/checkout@v3
   187  
   188        - uses: actions/cache@v3
   189          id: binary-cache
   190          with:
   191            # Use share the cache containing archives across OSes.
   192            enableCrossOsArchive: true
   193            # We need this cache to run tests.
   194            fail-on-cache-miss: true
   195            key: tinygo-test-binaries-${{ env.TINYGO_VERSION }}
   196            path:
   197              ${{ env.STDLIB_TESTS }}/testdata/tinygo
   198  
   199        - uses: actions/setup-go@v4
   200          with:
   201            go-version: ${{ env.GO_VERSION }}
   202  
   203        - name: Run test binaries
   204          run: |
   205            cd ${{ env.STDLIB_TESTS }}
   206            go test -bench='BenchmarkTinyGo' -timeout=20m -benchtime=1x
   207  
   208    wasi-testsuite:
   209      name: wasi-testsuite
   210      runs-on: ${{ matrix.os }}
   211      strategy:
   212        fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
   213        matrix:
   214          os: [ubuntu-22.04, macos-12, windows-2022]
   215  
   216      steps:
   217        - uses: actions/cache@v3
   218          id: cache
   219          with:
   220            path:
   221              ~/go/pkg/mod
   222            key: integration-test-wasi-testsuite-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
   223  
   224        - uses: actions/setup-go@v4
   225          with:
   226            go-version: ${{ env.GO_VERSION }}
   227  
   228        - name: Checkout wazero
   229          uses: actions/checkout@v3
   230  
   231        - name: Install wazero
   232          run: go install ./cmd/wazero
   233  
   234        - name: Checkout wasi-testsuite
   235          uses: actions/checkout@v3
   236          with:
   237            repository: WebAssembly/wasi-testsuite
   238            # prod/testsuite-base branch, as of May 12, 2023.
   239            # TODO: once the wasi-testsuite is stable, we should use the latest tag instead of a branch.
   240            ref: c9c751586fd86b321d595bbef13f2c7403cfdbc5
   241            path: wasi-testsuite
   242  
   243        - name: Initialize Python environment
   244          uses: actions/setup-python@v4
   245          with:
   246            python-version: '3.11' # latest version of python 3
   247            cache: pip
   248  
   249        - name: Install dependencies
   250          working-directory: wasi-testsuite/test-runner
   251          run: |
   252            python3 -m pip install -r requirements.txt
   253  
   254        - name: Run all wasi-testsuite
   255          working-directory: wasi-testsuite
   256          run: |
   257            python3 test-runner/wasi_test_runner.py \
   258              -t ./tests/assemblyscript/testsuite/ \
   259              ./tests/c/testsuite/ \
   260              ./tests/rust/testsuite/ \
   261              -f ../.github/wasi_testsuite_skip.json \
   262              -r ../.github/wasi_testsuite_adapter.py
   263  
   264    go_tests:
   265      # Due to the embedding of the GOROOT of the building env(https://github.com/golang/go/blob/3c59639b902fada0a2e5a6a35bafd10fc9183b89/src/os/os_test.go#L112),
   266      # we have to build and cache on each OS unlike others in this file.
   267      name: Go-${{ matrix.go-version }} (${{ matrix.os.name }}, ${{ matrix.arch }})
   268      runs-on: ${{ matrix.os.version }}
   269      strategy:
   270        fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
   271        matrix:
   272          # version is too verbose to be present in the name, so we use the name instead.
   273          # Note that it'd be better to use runner.os in the name, but the runner context is not available in the name field.
   274          os:
   275          - version: ubuntu-22.04
   276            name: Ubuntu
   277          - version: macos-12
   278            name: macOS
   279          - version: windows-2022
   280            name: Windows
   281          arch:     [amd64]
   282          go-version:
   283            - "1.21"
   284            - "1.22"
   285          include:
   286            - os:
   287                version: macos-14
   288                name: macOS
   289              arch:       "arm64"
   290              go-version: "1.21"
   291            - os:
   292                version: macos-14
   293                name: macOS
   294              arch:       "arm64"
   295              go-version: "1.22"
   296  
   297      steps:
   298        - id: setup-go
   299          uses: actions/setup-go@v4
   300          with:
   301            go-version: ${{ matrix.go-version }}
   302  
   303        - name: Checkout wazero
   304          uses: actions/checkout@v3
   305  
   306        - name: Cache Go test binaries
   307          id: cache-go-test-binaries
   308          uses: actions/cache@v3
   309          with:
   310            path:
   311              ${{ env.STDLIB_TESTS }}/testdata/go
   312            # Use precise Go version from setup-go as patch version differences can effect tests.
   313            key: go-wasip1-binaries-${{ matrix.os.version }}-${{ steps.setup-go.outputs.go-version }}-${{ matrix.arch }}
   314  
   315        - if: ${{ steps.cache-go-test-binaries.outputs.cache-hit != 'true' }}
   316          name: Build Test Binaries
   317          run: |
   318            cd ${{ env.STDLIB_TESTS }}
   319            make build.gowasip1
   320  
   321        # The wasip1 stdlib tests are really path sensitive, so they expect a writeable /tmp directory to be available.
   322        # We create it at the root of `C:`. This is normally only necessary on GHA Windows runners.
   323        - if: ${{ matrix.os.name == 'Windows' }}
   324          run: |
   325            mkdir /c/tmp
   326  
   327        - name: Run built test binaries
   328          run: |
   329            cd ${{ env.STDLIB_TESTS }}
   330            go test -bench='BenchmarkWasip1' -timeout=20m -benchtime=1x
   331  
   332    libsodium:
   333      name: libsodium (${{ matrix.os.name }}, ${{ matrix.os.arch }})
   334      runs-on: ${{ matrix.os.version }}
   335      strategy:
   336        fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
   337        matrix:
   338          # version is too verbose to be present in the name, so we use the name instead.
   339          # Note that it'd be better to use runner.os in the name, but the runner context is not available in the name field.
   340          os:
   341            - version: ubuntu-22.04
   342              name: Ubuntu
   343              arch: amd64
   344            - version: macos-14
   345              name: macOS
   346              arch: arm64
   347  
   348      steps:
   349        - name: Checkout wazero
   350          uses: actions/checkout@v3
   351  
   352        - uses: actions/cache@v3
   353          id: binary-cache
   354          with:
   355            # Use share the cache containing archives across OSes.
   356            enableCrossOsArchive: true
   357            # We need this cache to run tests.
   358            fail-on-cache-miss: true
   359            key: tinygo-test-binaries-${{ env.TINYGO_VERSION }}
   360            path:
   361              ${{ env.STDLIB_TESTS }}/testdata/tinygo
   362  
   363        - uses: actions/setup-go@v4
   364          with:
   365            go-version: ${{ env.GO_VERSION }}
   366  
   367        - name: Download test binaries
   368          run: make libsodium
   369  
   370        - name: Run test binaries
   371          run: go test ./internal/integration_test/libsodium -bench=. -benchtime=1x