github.com/tetratelabs/wazero@v1.2.1/.github/workflows/examples.yaml (about) 1 name: Examples 2 on: 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 18 env: 19 EMSDK_VERSION: "3.1.40" 20 TINYGO_VERSION: "0.28.1" 21 ZIG_VERSION: "0.11.0-dev.3334+cd1417dbd" 22 23 concurrency: 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 28 jobs: 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" # Current Go version 38 - "1.18" # Floor Go version of latest TinyGo 39 40 steps: 41 - name: Checkout 42 uses: actions/checkout@v3 43 44 - uses: actions/setup-go@v3 45 with: 46 go-version: ${{ matrix.go-version }} 47 cache: true 48 49 - name: Install TinyGo 50 run: | # installing via curl so commands are similar on OS/x 51 tinygo_version=${{ env.TINYGO_VERSION }} 52 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 - 53 echo "TINYGOROOT=/usr/local/tinygo" >> $GITHUB_ENV 54 echo "/usr/local/tinygo/bin" >> $GITHUB_PATH 55 56 - name: Install Zig 57 run: | 58 sudo apt install xz-utils 59 sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-${{ env.ZIG_VERSION }}.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin' 60 61 - name: Cache Emscripten 62 id: cache-emsdk 63 uses: actions/cache@v3 64 with: 65 path: emsdk 66 key: ${{ runner.os }}-emcc-${{env.EMSDK_VERSION}} 67 68 - name: Checkout Emscripten 69 if: steps.cache-emsdk.outputs.cache-hit != 'true' 70 uses: actions/checkout@v3 71 with: 72 repository: emscripten-core/emsdk 73 path: emsdk 74 75 - name: Install Emscripten 76 if: steps.cache-emsdk.outputs.cache-hit != 'true' 77 run: | 78 ./emsdk/emsdk install ${{env.EMSDK_VERSION}} 79 80 - name: Install wasm32-wasi target 81 uses: actions-rs/toolchain@v1 82 with: 83 toolchain: stable 84 target: wasm32-wasi 85 86 - name: Build TinyGo examples 87 run: make build.examples.tinygo 88 89 - name: Build AssemblyScript examples 90 run: make build.examples.as 91 92 - name: Build zig-cc examples 93 run: make build.examples.zig-cc 94 95 - name: Build Rust examples 96 run: make build.examples.rust 97 98 - name: Build Zig examples 99 run: make build.examples.zig 100 101 - name: Build Emscripten examples 102 run: | 103 ./emsdk/emsdk activate ${{env.EMSDK_VERSION}} 104 source ./emsdk/emsdk_env.sh 105 make build.examples.emscripten 106 107 - name: Build bench cases 108 run: make build.bench 109 110 - name: Run example tests 111 run: make test.examples