Skip to content

Update CI to be self-contained and support the -dl target #129

Update CI to be self-contained and support the -dl target

Update CI to be self-contained and support the -dl target #129

Workflow file for this run

name: CI
on:
push:
branches:
- "wasix*"
pull_request:
workflow_call:
jobs:
build-rust:
strategy:
matrix:
include:
- name: Windows (x86)
os: depot-windows-2022-16
arch: x86
host_triple: x86_64-pc-windows-msvc
- name: Ubuntu (x86)
os: depot-ubuntu-22.04-16
arch: x86
host_triple: x86_64-unknown-linux-gnu
- name: Mac (x86)
os: macos-13
arch: x86
host_triple: x86_64-apple-darwin
- name: Mac (aarch64)
os: depot-macos-15
arch: aarch64
host_triple: aarch64-apple-darwin
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
path: wasix-rust
submodules: "recursive"
# Don't clean so downloaded LLVM etc can be reused.
clean: false
fetch-depth: 50
- name: Setup (Mac OS)
shell: bash
if: contains(matrix.os, 'macos')
run: |
brew update
# Need ninja for building llvm (for aarch64 cross compile)
brew install ninja
# Interlude: install rust now. For some reason, brew install removes cargo, so
# we're doing this after as it keeps mac builds happy. This is ultimately a
# hack, so if anybody knows why brew install removes cargo, please fix it and
# move this step back up to where it originally was.
- name: Install Rust
uses: actions-rs/toolchain@v1
if: ${{ !contains(matrix.os, 'windows') }}
with:
toolchain: stable
- name: Set up MinGW (Windows)
if: contains(matrix.os, 'windows') && matrix.arch == 'x86'
uses: e-t-l/setup-mingw@patch-1
- name: Install ninja (Windows)
if: contains(matrix.os, 'windows') && matrix.arch == 'x86'
uses: seanmiddleditch/gha-setup-ninja@master
- name: Setup (Ubuntu)
if: matrix.arch == 'x86' && contains(matrix.os, 'ubuntu')
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl wget xz-utils git python3 ninja-build cmake
- name: Download wasix-libc
run: |
mkdir wasix-libc
cd wasix-libc
gh release download -R wasix-org/wasix-libc -p 'sysroot-eh.tar.gz'
tar xvf sysroot-eh.tar.gz
gh release download -R wasix-org/wasix-libc -p 'sysroot-ehpic.tar.gz'
tar xvf sysroot-ehpic.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build (${{ matrix.name }})
shell: bash
run: |
# NOTE: must unset GITHUB_ACTIONS env var, because Rust bootstrap checks for it.
# (see bootstrap config.rs)
cd wasix-rust
export \
HOST=${{ matrix.host_triple }} \
GITHUB_ACTIONS="false"
if command -v cygpath &> /dev/null; then
export \
SYSROOT_EH=$(cygpath $(realpath ../wasix-libc/wasix-sysroot-eh/sysroot)) \
SYSROOT_EHPIC=$(cygpath $(realpath ../wasix-libc/wasix-sysroot-ehpic/sysroot))
else
export \
SYSROOT_EH=$(realpath ../wasix-libc/wasix-sysroot-eh/sysroot) \
SYSROOT_EHPIC=$(realpath ../wasix-libc/wasix-sysroot-ehpic/sysroot)
fi
echo $SYSROOT_EH
echo $SYSROOT_EHPIC
bash build-wasix.sh
- name: Archive build output (${{ matrix.name }})
uses: actions/upload-artifact@v4
with:
name: rust-toolchain-${{ matrix.host_triple }}
path: |
wasix-rust/build/${{ matrix.host_triple }}/stage2
!wasix-rust/build/${{ matrix.host_triple }}/stage2/lib/rustlib/src
!wasix-rust/build/${{ matrix.host_triple }}/stage2/lib/rustlib/rustc-src