No fail fast #317
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
# Run CI for PRs to `main` and to release branches. | |
# | |
# Note that PRs to `main` will run a subset of tests and PRs to the | |
# `release-*` branches will run full CI. | |
pull_request: | |
branches: | |
- main | |
- 'release-*' | |
# Run full CI on the `main` branch once a day to prime the GitHub Actions | |
# caches used by PRs and the merge queue. | |
schedule: | |
- cron: '13 4 * * *' | |
# This is the CI that runs for PRs-to-merge. | |
merge_group: | |
push: | |
branches: | |
# Right now merge queues can't be used with wildcards in branch protections | |
# so full CI runs both on PRs to release branches as well as merges to | |
# release branches. Note that the merge to a release branch may produce a | |
# tag at the end of CI if successful and the tag will trigger the artifact | |
# uploads as well as publication to crates.io. | |
- 'release-*' | |
- 'min-builds' | |
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: | |
# Check Code style quickly by running `rustfmt` over all code | |
rustfmt: | |
name: Rustfmt | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- uses: ./.github/actions/install-rust | |
- run: rustup component add rustfmt | |
- run: cargo fmt --all -- --check | |
# common logic to cancel the entire run if this job fails | |
- run: gh run cancel ${{ github.run_id }} | |
if: failure() && github.event_name != 'pull_request' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
# This job is a dependency of many of the jobs below. This calculates what's | |
# actually being run for this workflow. For example: | |
# | |
# * Pushes to branches, which is currently both pushes to merge queue branches | |
# as well as release branches, perform full CI. | |
# * PRs to release branches (not `main`) run full CI. | |
# * PRs to `main` will only run a few smoke tests above plus some elements of | |
# the test matrix. The test matrix here is determined dynamically by the | |
# `./ci/build-test-matrix.js` script given the commits that happened and | |
# the files modified. | |
determine: | |
name: Determine CI jobs to run | |
runs-on: ubuntu-latest | |
outputs: | |
run-full: ${{ steps.calculate.outputs.run-full }} | |
test-matrix: ${{ steps.calculate.outputs.test-matrix }} | |
build-matrix: ${{ steps.calculate.outputs.build-matrix }} | |
test-capi: ${{ steps.calculate.outputs.test-capi }} | |
build-fuzz: ${{ steps.calculate.outputs.build-fuzz }} | |
audit: ${{ steps.calculate.outputs.audit }} | |
preview1-adapter: ${{ steps.calculate.outputs.preview1-adapter }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: calculate | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
touch commits.log names.log | |
# Note that CI doesn't run on pushes to `main`, only pushes to merge | |
# queue branches and release branches, so this only runs full CI in | |
# those locations. | |
if [ "${{ github.event_name }}" != "pull_request" ]; then | |
run_full=true | |
else | |
pr=${{ github.event.number }} | |
gh pr view $pr --json commits | tee commits.log | |
gh pr diff $pr --name-only | tee names.log | |
if [ "${{ github.base_ref }}" != "main" ]; then | |
run_full=true | |
elif grep -q 'prtest:full' commits.log; then | |
run_full=true | |
fi | |
if grep -q crates.c-api names.log; then | |
echo test-capi=true >> $GITHUB_OUTPUT | |
fi | |
if grep -q fuzz names.log; then | |
echo build-fuzz=true >> $GITHUB_OUTPUT | |
fi | |
if grep -q Cargo.lock names.log; then | |
echo audit=true >> $GITHUB_OUTPUT | |
fi | |
if grep -q supply-chain names.log; then | |
echo audit=true >> $GITHUB_OUTPUT | |
fi | |
if grep -q component-adapter names.log; then | |
echo preview1-adapter=true >> $GITHUB_OUTPUT | |
fi | |
fi | |
matrix="$(node ./ci/build-test-matrix.js ./commits.log ./names.log $run_full)" | |
echo "test-matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT | |
echo "$matrix" | |
matrix="$(node ./ci/build-build-matrix.js)" | |
echo "build-matrix={\"include\":$(echo $matrix)}" >> $GITHUB_OUTPUT | |
if [ "$run_full" = "true" ]; then | |
echo run-full=true >> $GITHUB_OUTPUT | |
echo test-capi=true >> $GITHUB_OUTPUT | |
echo build-fuzz=true >> $GITHUB_OUTPUT | |
echo audit=true >> $GITHUB_OUTPUT | |
echo preview1-adapter=true >> $GITHUB_OUTPUT | |
fi | |
# Perform release builds of `wasmtime` and `libwasmtime.so`. Builds a variety | |
# of platforms and architectures and then uploads the release artifacts to | |
# this workflow run's list of artifacts. | |
# | |
# Note that the full matrix is computed by `ci/build-build-matrix.js`. | |
build: | |
needs: determine | |
if: needs.determine.outputs.run-full | |
name: Release build for ${{ matrix.build }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.determine.outputs.build-matrix) }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
# For normal builds use stable Rust, othrewise for minimal builds use the | |
# same nightly toolchain that other nightly builds in this file use. | |
- uses: ./.github/actions/install-rust | |
if: '!matrix.min' | |
- uses: ./.github/actions/install-rust | |
with: | |
toolchain: nightly-2023-10-10 | |
if: matrix.min | |
# 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 }} | |
- name: Configure minimal build | |
if: matrix.min | |
run: | | |
echo CARGO_PROFILE_RELEASE_STRIP=debuginfo >> $GITHUB_ENV | |
echo CARGO_PROFILE_RELEASE_OPT_LEVEL=s >> $GITHUB_ENV | |
echo RUSTFLAGS=-Zlocation-detail=none >> $GITHUB_ENV | |
echo CARGO_PROFILE_RELEASE_CODEGEN_UNITS=1 >> $GITHUB_ENV | |
echo CARGO_PROFILE_RELEASE_LTO=true >> $GITHUB_ENV | |
echo CARGO_PROFILE_RELEASE_PANIC=abort >> $GITHUB_ENV | |
echo BUILD_FLAGS="-Zbuild-std=std,panic_abort --no-default-features -Zbuild-std-features=" >> $GITHUB_ENV | |
# Build the `wasmtime` executable. Note that we include some non-default | |
# features so the release artifacts can be maximally feature-ful. | |
- run: $CENTOS cargo build --release $BUILD_FLAGS | |
if: matrix.min | |
- run: $CENTOS cargo build --release --features all-arch,component-model | |
if: '!matrix.min' | |
# Build `libwasmtime.so` | |
- run: $CENTOS cargo build --release -p wasmtime-c-api $BUILD_FLAGS | |
# Assemble release artifacts 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 | |
# common logic to cancel the entire run if this job fails | |
- run: gh run cancel ${{ github.run_id }} | |
if: failure() && github.event_name != 'pull_request' | |
env: | |
GH_TOKEN: ${{ github.token }} | |