Skip to content

shorter name

shorter name #74

Workflow file for this run

name: CI
on:
create:
tags:
push:
branches:
- main
- cmake
pull_request:
workflow_dispatch:
jobs:
build:
name: Build ${{ matrix.artifact }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
docker: 1
artifact: x86_64-linux
- os: ubuntu-latest
docker: 1
artifact: arm64-linux
- os: macos-latest
artifact: arm64-macos
llvm_cmake_flags: -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DCMAKE_OSX_ARCHITECTURES=arm64
- os: macos-latest
artifact: x86_64-macos
llvm_cmake_flags: -DCMAKE_OSX_DEPLOYMENT_TARGET=10.12 -DCMAKE_OSX_ARCHITECTURES=x86_64
skip_sysroot: 1
- os: windows-latest
artifact: x86_64-windows
steps:
- uses: actions/cache@v4
id: cache-restore
with:
path: ${{ runner.tool_cache }}/ccache
# Bump the prefix number to evict all previous caches and
# enforce a clean build, in the unlikely case that some
# weird build error occur and ccache becomes a potential
# suspect.
key: 0-cache-${{ matrix.artifact }}-${{ github.run_id }}
restore-keys: |
0-cache-${{ matrix.artifact }}-
- name: Setup `wasmtime` for tests
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
version: "18.0.2"
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: git fetch --tags --force
name: Force-fetch tags to work around actions/checkout#290
- run: |
mkdir -p '${{ runner.tool_cache }}/ccache'
echo 'CCACHE_DIR=${{ runner.tool_cache }}/ccache' >> $GITHUB_ENV
shell: bash
- run: echo WASI_SDK_CI_TOOLCHAIN_LLVM_CMAKE_ARGS=${{ matrix.llvm_cmake_flags }} >> $GITHUB_ENV
if: matrix.llvm_cmake_flags != ''
- run: echo WASI_SDK_CI_TOOLCHAIN_CMAKE_ARGS=-DWASI_SDK_ARTIFACT=${{ matrix.artifact }} >> $GITHUB_ENV
shell: bash
- run: echo WASI_SDK_CI_SKIP_SYSROOT=1 >> $GITHUB_ENV
if: matrix.skip_sysroot != ''
- name: Install ccache, ninja (macOS)
run: brew install ccache ninja
if: runner.os == 'macOS'
- name: Install ccache, ninja (Windows)
run: choco install ccache ninja
if: runner.os == 'Windows'
- name: Install ccache, ninja (Linux)
run: sudo apt install ccache
if: runner.os == 'Linux'
# 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: Build and test wasi-sdk toolchain/sysroot
run: |
if [ "${{ matrix.docker }}" = "" ]; then
./ci/build.sh
else
./ci/docker-build.sh ${{ matrix.artifact }}
fi
shell: bash
- 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: ${{ format( 'dist-{0}', matrix.artifact) }}
path: build/dist
- if: always()
name: Show ccache statistics
run: ccache --show-stats
- if: always() && steps.cache-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ runner.tool_cache }}/ccache
key: 0-cache-${{ matrix.artifact }}-${{ github.run_id }}
# dockerbuild:
# name: Docker Build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/cache@v4
# with:
# path: ~/.ccache
# key: 0-cache-ubuntu-bionic-${{ github.run_id }}
# restore-keys: |
# 0-cache-ubuntu-bionic
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - run: git fetch --tags --force
# name: Force-fetch tags to work around actions/checkout#290
# - 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