...

Text file src/github.com/tetratelabs/wazero/.github/workflows/examples.yaml

Documentation: github.com/tetratelabs/wazero/.github/workflows

     1name: Examples
     2on:
     3  pull_request:
     4    branches: [main]
     5    paths:
     6      - '.github/workflows/examples.yaml'
     7      - 'examples/**'
     8      - 'imports/**/example/**'
     9      - 'Makefile'
    10  push:
    11    branches: [main]
    12    paths:
    13      - '.github/workflows/examples.yaml'
    14      - 'examples/**'
    15      - 'imports/**/example/**'
    16      - 'Makefile'
    17
    18env:
    19  EMSDK_VERSION: "3.1.40"
    20  TINYGO_VERSION: "0.30.0"
    21  ZIG_VERSION: "0.11.0"
    22
    23concurrency:
    24  # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-concurrency-to-cancel-any-in-progress-job-or-run
    25  group: ${{ github.ref }}-${{ github.workflow }}-${{ github.actor }}
    26  cancel-in-progress: true
    27
    28jobs:
    29  # Not all toolchains are idempotent when generating wasm, so we don't check
    30  # in %.wasm as a part of this job.
    31  examples:
    32    name: Build examples
    33    runs-on: ubuntu-22.04
    34    strategy:
    35      matrix:  # Use versions consistent with TinyGo.
    36        go-version:
    37          - "1.20"  # Latest Go version supported by TinyGo until its next version.
    38          - "1.19"  # Floor Go version of latest TinyGo
    39
    40    steps:
    41      - name: Checkout
    42        uses: actions/checkout@v3
    43
    44      - uses: actions/setup-go@v4
    45        with:
    46          go-version: ${{ matrix.go-version }}
    47
    48      - name: Install TinyGo
    49        run: |  # installing via curl so commands are similar on OS/x
    50          tinygo_version=${{ env.TINYGO_VERSION }}
    51          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 -
    52          echo "TINYGOROOT=/usr/local/tinygo" >> $GITHUB_ENV
    53          echo "/usr/local/tinygo/bin" >> $GITHUB_PATH
    54
    55      - name: Install Zig
    56        run: |
    57          sudo apt install xz-utils
    58          sudo sh -c 'wget -c https://ziglang.org/download/${{ env.ZIG_VERSION }}/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
    59
    60      - name: Cache Emscripten
    61        id: cache-emsdk
    62        uses: actions/cache@v3
    63        with:
    64          path: emsdk
    65          key: ${{ runner.os }}-emcc-${{env.EMSDK_VERSION}}
    66
    67      - name: Checkout Emscripten
    68        if: steps.cache-emsdk.outputs.cache-hit != 'true'
    69        uses: actions/checkout@v3
    70        with:
    71          repository: emscripten-core/emsdk
    72          path: emsdk
    73
    74      - name: Install Emscripten
    75        if: steps.cache-emsdk.outputs.cache-hit != 'true'
    76        run: |
    77          ./emsdk/emsdk install ${{env.EMSDK_VERSION}}
    78
    79      - name: Install wasm32-wasi target
    80        uses: actions-rs/toolchain@v1
    81        with:
    82          toolchain: stable
    83          target: wasm32-wasi
    84
    85      - name: Build TinyGo examples
    86        run: make build.examples.tinygo
    87
    88      - name: Build AssemblyScript examples
    89        run: make build.examples.as
    90
    91      - name: Build zig-cc examples
    92        run: make build.examples.zig-cc
    93
    94      - name: Build Rust examples
    95        run: make build.examples.rust
    96
    97      - name: Build Zig examples
    98        run: make build.examples.zig
    99
   100      - name: Build Emscripten examples
   101        run: |
   102          ./emsdk/emsdk activate ${{env.EMSDK_VERSION}}
   103          source ./emsdk/emsdk_env.sh
   104          make build.examples.emscripten
   105
   106      - name: Build bench cases
   107        run: make build.bench
   108
   109      - name: Run example tests
   110        run: make test.examples

View as plain text