Fix generating binaries (both DL and non-DL targets) #116
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - "wasix*" | |
| pull_request: | |
| workflow_call: | |
| jobs: | |
| build-libc: | |
| runs-on: ubuntu-22.04 | |
| 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@v4 | |
| with: | |
| repository: wasix-org/wasix-libc | |
| ref: wasm64-rust-toolchain | |
| 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@v4 | |
| with: | |
| repository: wasix-org/cargo-wasix | |
| ref: target-fix | |
| 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@v4 | |
| 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 | |
| arch: x86 | |
| - name: Ubuntu (x86) | |
| os: ubuntu-22.04 | |
| arch: x86 | |
| - name: Mac (x86) | |
| os: macos-13 | |
| arch: x86 | |
| - name: Mac (aarch64) | |
| os: macos-15 | |
| arch: aarch64 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Download wasix-libc artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: wasix-libc | |
| - 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 | |
| # 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@v4 | |
| with: | |
| repository: wasix-org/cargo-wasix | |
| ref: target-fix | |
| path: cargo-wasix | |
| # 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 | |
| # 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-13') && 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@v4 | |
| 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@v4 | |
| 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 | |
| # 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@v4 | |
| 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) | |
| # 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: e-t-l/setup-mingw@patch-1 | |
| # - 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@v4 | |
| 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 | |