From 1b8fecbd5d9ef371fbdd73bfb3431cfd83681b54 Mon Sep 17 00:00:00 2001 From: Arshia Ghafoori Date: Wed, 7 Aug 2024 12:52:27 +0400 Subject: [PATCH] Fix CI for mac builds --- .github/workflows/ci.yml | 84 ++++++++++++++++++++++------------------ 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6af06e39d1f8b..2db05aa38a7e5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -88,12 +88,6 @@ jobs: 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: @@ -127,38 +121,6 @@ jobs: 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) @@ -169,6 +131,19 @@ jobs: # 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 + + # Mac - continued + - name: Build (Mac Os, x86) shell: bash if: contains(matrix.os, 'macos-12') && matrix.arch == 'x86' @@ -219,6 +194,39 @@ jobs: !wasix-rust/build/aarch64-apple-darwin/stage2/lib/rustlib/src !wasix-rust/build/aarch64-apple-darwin/stage2/lib/rustlib/rustc-src + # 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 + + # Windows # - name: Install chocolatey deps (Windows)