Skip to content

Automate mac aarch64 builds #62

Automate mac aarch64 builds

Automate mac aarch64 builds #62

Workflow file for this run

name: CI
on:
push:
branches:
- "**"
pull_request:
workflow_call:
jobs:
build-libc:
runs-on: ubuntu-latest-8-cores
steps:
- name: show git config
run: |
env
cat ~/.config/git/config || true
cat ~/.gitconfig || true
ls -lha ./wasix-libc || true
- name: Check out wasix-libc
uses: actions/checkout@v3
with:
repository: wasix-org/wasix-libc
ref: main
path: wasix-libc
submodules: "recursive"
- name: OS Setup (Ubuntu)
run: |
sudo apt-get update
sudo apt-get install -y build-essential curl wget xz-utils git python3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Check out cargo-wasix
uses: actions/checkout@v3
with:
repository: wasix-org/cargo-wasix
ref: main
path: cargo-wasix
fetch-depth: 2
- name: Print cargo-wasix info
run: |
cd ./cargo-wasix
echo "cargo-wasix commit:"
git rev-parse HEAD
- name: Build
shell: bash
run: |
cd $GITHUB_WORKSPACE/cargo-wasix
WASIX_NO_UPDATE_REPOS=1 WASIX_BUILD_DIR=$GITHUB_WORKSPACE WASIX_COMPONENTS=libc cargo run -- wasix build-toolchain
# Workaround for preserving artifact directory structure
# See https://github.com/actions/upload-artifact/issues/174
touch $GITHUB_WORKSPACE/.stub
- name: Archive build output
uses: actions/upload-artifact@v3
with:
name: wasix-libc
path: |
.stub
wasix-libc/sysroot32
wasix-libc/sysroot64
build-rust:
needs: build-libc
strategy:
matrix:
include:
- name: Windows (x86)
os: windows-latest-8-cores
arch: x86
- name: Ubuntu (x86)
os: ubuntu-latest-8-cores
arch: x86
- name: Mac (x86)
os: macos-12-large
arch: x86
- name: Mac (aarch64)
os: macos-13-xlarge
arch: aarch64
runs-on: ${{ matrix.os }}
steps:
- name: Install Rust
uses: actions-rs/toolchain@v1
if: ${{ !contains(matrix.os, 'windows') }}
with:
toolchain: stable
- name: Download wasix-libc artifact
uses: actions/download-artifact@v3
with:
name: wasix-libc
- name: Check out repository code
uses: actions/checkout@v3
with:
path: wasix-rust
submodules: "recursive"
# Don't clean so downloaded LLVM etc can be reused.
clean: false
# We need the full history for the main repo so the build tooling can
# determine the cached LLVM download.
# - name: Fetch full branch history
# shell: bash
# run: |
# cd wasix-rust
# git fetch --unshallow origin $(git branch --show-current)
# echo "Branch history fetched!"
# - name: Install Rust
# uses: dtolnay/rust-toolchain@stable
- name: Check out cargo-wasix
uses: actions/checkout@v3
with:
repository: wasix-org/cargo-wasix
ref: main
path: cargo-wasix
# Linux!
- 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: Build (Linux)
if: matrix.arch == 'x86' && contains(matrix.os, 'ubuntu')
shell: bash
env:
WASIX_NO_UPDATE_REPOS: "1"
WASIX_COMPONENTS: rust
WASIX_RUST_HOST: x86_64-unknown-linux-gnu
run: |
cd cargo-wasix
# NOTE: must unset GITHUB_ACTIONS env var, because Rst bootstrap checks for it.
# (see bootstrap config.rs)
GITHUB_ACTIONS=false WASIX_BUILD_DIR=$GITHUB_WORKSPACE cargo run -- wasix build-toolchain
- name: Archive build output (Linux)
uses: actions/upload-artifact@v3
if: contains(matrix.os, 'ubuntu')
with:
name: rust-toolchain-x86_64-unknown-linux-gnu
path: |
wasix-rust/build/x86_64-unknown-linux-gnu/stage2
!wasix-rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/src
!wasix-rust/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/rustc-src
# Mac - x86
- 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
- name: Build (Mac Os, x86)
shell: bash
if: contains(matrix.os, 'macos-12') && matrix.arch == 'x86'
env:
WASIX_NO_UPDATE_REPOS: "1"
GITHUB_ACTIONS: "false"
WASIX_COMPONENTS: rust
WASIX_RUST_HOST: x86_64-apple-darwin
run: |
cd cargo-wasix
# NOTE: must unset GITHUB_ACTIONS env var, because Rust bootstrap checks for it.
# (see bootstrap config.rs)
GITHUB_ACTIONS=false WASIX_BUILD_DIR=$GITHUB_WORKSPACE cargo run -- wasix build-toolchain
- name: Archive build output (Mac OS - x86)
uses: actions/upload-artifact@v3
if: contains(matrix.os, 'macos') && matrix.arch == 'x86'
with:
name: rust-toolchain-x86_64-apple-darwin
path: |
wasix-rust/build/x86_64-apple-darwin/stage2
!wasix-rust/build/x86_64-apple-darwin/stage2/lib/rustlib/src
!wasix-rust/build/x86_64-apple-darwin/stage2/lib/rustlib/rustc-src
# Mac - aarch64
- name: Build (Mac Os, aarch64)
shell: bash
if: contains(matrix.os, 'macos') && matrix.arch == 'aarch64'
env:
WASIX_NO_UPDATE_REPOS: "1"
GITHUB_ACTIONS: "false"
WASIX_COMPONENTS: rust
WASIX_RUST_HOST: aarch64-apple-darwin
run: |
cd cargo-wasix
# NOTE: must unset GITHUB_ACTIONS env var, because Rst bootstrap checks for it.
# (see bootstrap config.rs)
GITHUB_ACTIONS=false WASIX_BUILD_DIR=$GITHUB_WORKSPACE cargo run -- wasix build-toolchain
- name: Archive build output (Mac OS - aarch64)
uses: actions/upload-artifact@v3
if: contains(matrix.os, 'macos') && matrix.arch == 'aarch64'
with:
name: rust-toolchain-aarch64-apple-darwin
path: |
wasix-rust/build/aarch64-apple-darwin/stage2
!wasix-rust/build/aarch64-apple-darwin/stage2/lib/rustlib/src
!wasix-rust/build/aarch64-apple-darwin/stage2/lib/rustlib/rustc-src
# Windows
# - name: Install chocolatey deps (Windows)
# if: contains(matrix.os, 'windows') && matrix.arch == 'x86'
# shell: bash
# continue-on-error: true
# run: choco install -y visualstudio2019community cmake
- name: Set up MinGW (Windows)
if: contains(matrix.os, 'windows') && matrix.arch == 'x86'
uses: egor-tensin/setup-mingw@v2
# - name: Install llvm (Windows)
# if: matrix.os == 'self-hosted-windows'
# uses: KyleMayes/install-llvm-action@v1
# with:
# version: "10.0"
- name: Install ninja (Windows)
if: contains(matrix.os, 'windows') && matrix.arch == 'x86'
uses: seanmiddleditch/gha-setup-ninja@master
- name: Build (Windows)
if: contains(matrix.os, 'windows') && matrix.arch == 'x86'
continue-on-error: true
shell: bash
env:
WASIX_NO_UPDATE_REPOS: "1"
WASIX_COMPONENTS: rust
WASIX_RUST_HOST: x86_64-pc-windows-msvc
# WASIX_RUST_HOST: x86_64-pc-windows-gnu
run: |
cd cargo-wasix
# NOTE: must unset GITHUB_ACTIONS env var, because Rst bootstrap checks for it.
# (see bootstrap config.rs)
GITHUB_ACTIONS=false WASIX_BUILD_DIR=$GITHUB_WORKSPACE cargo run -- wasix build-toolchain
- name: Archive build output (Windows)
if: contains(matrix.os, 'windows') && matrix.arch == 'x86'
uses: actions/upload-artifact@v3
with:
name: rust-toolchain-x86_64-pc-windows-msvc
# name: rust-toolchain-x86_64-pc-windows-gnu
path: |
wasix-rust/build/x86_64-pc-windows-msvc/stage2
!wasix-rust/build/x86_64-pc-windows-msvc/stage2/lib/rustlib/src
!wasix-rust/build/x86_64-pc-windows-msvc/stage2/lib/rustlib/rustc-src