versions #28
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: | |
create: | |
tags: | |
push: | |
branches: | |
- main | |
- test-sccache | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Native Build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
dist: dist-ubuntu-latest | |
- os: macos-latest | |
dist: dist-macos-latest | |
- os: windows-latest | |
dist: dist-windows-latest-x64 | |
msystem: clang64 | |
msys_clang: clang-x86_64 | |
- os: windows-latest | |
dist: dist-windows-latest-x86 | |
msystem: clang32 | |
msys_clang: clang-i686 | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
steps: | |
- run: make --version | |
- run: cmake --version | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- name: Setup `wasmtime` for tests | |
uses: bytecodealliance/actions/wasmtime/setup@v1 | |
with: | |
version: "18.0.2" | |
- name: Setup `wasm-tools` for tests | |
uses: bytecodealliance/actions/wasm-tools/setup@v1 | |
with: | |
version: "1.201.0" | |
- name: Download command adapter for tests | |
run: curl -f -L --retry 5 -o ${{ runner.temp }}/wasi_snapshot_preview1.command.wasm https://github.com/bytecodealliance/wasmtime/releases/download/v18.0.2/wasi_snapshot_preview1.command.wasm | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# We can't use `--depth 1` here sadly because the GNU config | |
# submodule is not pinned to a particular tag/branch. Please | |
# bump depth (or even better, the submodule), in case of "error: | |
# Server does not allow request for unadvertised object" in the | |
# future. | |
- run: git submodule update --init --depth 32 --jobs 3 | |
- name: Install ninja (macOS) | |
run: brew install ninja | |
if: runner.os == 'macOS' | |
- name: Install ninja (Linux) | |
run: sudo apt install ninja-build | |
if: runner.os == 'Linux' | |
- name: Install build deps and setup msys2 (Windows) | |
run: choco install ninja | |
if: runner.os == 'Windows' | |
# - name: Install build deps and setup msys2 (Windows) | |
# uses: msys2/setup-msys2@v2 | |
# with: | |
# install: >- | |
# base-devel | |
# git | |
# mingw-w64-${{ matrix.msys_clang }}-cmake | |
# mingw-w64-${{ matrix.msys_clang }}-ninja | |
# mingw-w64-${{ matrix.msys_clang }}-toolchain | |
# msystem: ${{ matrix.msystem }} | |
# update: true | |
# release: false | |
# path-type: inherit | |
# if: runner.os == 'Windows' | |
- name: Build | |
run: NINJA_FLAGS=-v make package LLVM_CMAKE_FLAGS="-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache" | |
shell: bash | |
- name: Run the testsuite | |
run: NINJA_FLAGS=-v make check RUNTIME=wasmtime ADAPTER=${{ runner.temp }}/wasi_snapshot_preview1.command.wasm WASM_TOOLS=wasm-tools | |
shell: bash | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.dist }} | |
path: dist | |
dockerbuild: | |
name: Docker Build | |
runs-on: ubuntu-latest | |
env: | |
SCCACHE_GHA_ENABLED: "true" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Run sccache-cache | |
uses: mozilla-actions/[email protected] | |
- run: git submodule update --init --depth 32 --jobs 3 | |
- uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/setup-qemu-action@v2 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/metadata-action@v4 | |
id: meta | |
with: | |
images: ghcr.io/${{ github.repository }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=sha | |
- name: Run docker_build script | |
run: ./docker_build.sh | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
# Upload the dist folder. Give it a name according to the OS it was built for. | |
name: dist-ubuntu-bionic | |
path: dist | |
- name: Build and push wasi-sdk docker image | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: docker/Dockerfile | |
push: ${{ github.event_name != 'pull_request' && github.event_name != 'workflow_dispatch' }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# This is a "join node" which depends on all prior workflows. Merging, for | |
# example, gates on this to ensure that everything has executed successfully. | |
# | |
# Note that this currently always runs to always report a status, even on | |
# cancellation and even if dependency steps fail. This step tries to fail on | |
# cancellation to ensure that the dependency failures are propagated | |
# correctly. | |
ci-status: | |
name: Join all test results into one CI status check | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- dockerbuild | |
if: always() | |
steps: | |
- name: Successful test and build | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: Failing test and build | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 | |
- name: Report failure on cancellation | |
if: ${{ contains(needs.*.result, 'cancelled') || cancelled() }} | |
run: exit 1 |