diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..0a332e7c2e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,98 @@ + +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 + # 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 + - run: $CENTOS cargo build --release --bin wasmtime + + # 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 + diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ede3e5e588..b18d5d520a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -384,80 +384,6 @@ jobs: - run: cd cranelift/codegen && cargo build --features all-arch - run: ci/ensure_deterministic_build.sh - # 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 - # 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 - - run: $CENTOS cargo build --release --bin wasmtime - - # 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 - 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 - verify-publish: if: github.repository == 'bytecodealliance/wasmtime' runs-on: ubuntu-latest