name: Build on: push: branches: - main tags: - 'v*' pull_request: branches: - 'release-*' defaults: run: shell: bash # Cancel any in-flight jobs for the same PR/branch so there's only one active # at a time concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: # Perform release builds of `wasmtime` and `libwasmtime.so`. Builds on # Windows/Mac/Linux, and artifacts are uploaded after the build is finished. # Note that we also run tests here to test exactly what we're deploying. build: name: Build wasmtime runs-on: ${{ matrix.os }} strategy: matrix: include: - build: x86_64-linux os: ubuntu-latest - build: x86_64-macos os: macos-latest - build: aarch64-macos os: macos-latest target: aarch64-apple-darwin - build: x86_64-windows os: windows-latest - build: x86_64-mingw os: windows-latest target: x86_64-pc-windows-gnu - build: aarch64-linux os: ubuntu-latest target: aarch64-unknown-linux-gnu - build: s390x-linux os: ubuntu-latest target: s390x-unknown-linux-gnu - build: riscv64gc-linux os: ubuntu-latest target: riscv64gc-unknown-linux-gnu steps: - uses: actions/checkout@v3 with: submodules: true - uses: ./.github/actions/install-rust # Note that the usage of this nightly toolchain is temporary until it # rides to stable. After this nightly version becomes stable (Rust 1.69.0) # then this should switch back to using stable by deleting the `with` and # `toolchain` options. with: toolchain: nightly-2023-01-31 # On one builder produce the source tarball since there's no need to produce # it everywhere - run: ./ci/build-src-tarball.sh if: matrix.build == 'x86_64-linux' - uses: ./.github/actions/binary-compatible-builds with: name: ${{ matrix.build }} - run: | echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV rustup target add ${{ matrix.target }} if: matrix.target != '' # Build `wasmtime` and executables. Note that we include `all-arch` so our # release artifacts can be used to compile `.cwasm`s for other targets. - run: $CENTOS cargo build --release --bin wasmtime --features all-arch # Build `libwasmtime.so` - run: $CENTOS cargo build --release --manifest-path crates/c-api/Cargo.toml # Assemble release artifats appropriate for this platform, then upload them # unconditionally to this workflow's files so we have a copy of them. - run: ./ci/build-tarballs.sh "${{ matrix.build }}" "${{ matrix.target }}" - uses: actions/upload-artifact@v3 with: name: bins-${{ matrix.build }} path: dist # ... and if this was an actual push (tag or `main`) then we publish a # new release. This'll automatically publish a tag release or update `dev` # with this `sha`. Note that `continue-on-error` is set here so if this hits # a bug we can go back and fetch and upload the release ourselves. - run: cd .github/actions/github-release && npm install --production - name: Publish Release uses: ./.github/actions/github-release # We only publish for main or a version tag, not `release-*` branches if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'bytecodealliance/wasmtime' with: files: "dist/*" token: ${{ secrets.GITHUB_TOKEN }} continue-on-error: true