diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 13eaf1da..97bd7fdb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -116,12 +116,6 @@ jobs: with: version: 0.11.0 - - name: Install Cross toolchain (cargo-zigbuild) - if: matrix.build == 'macos-m1' - shell: bash - run: | - cargo install cargo-zigbuild - - name: Get release download URL if: env.MANUAL != '1' uses: actions/download-artifact@v1 @@ -143,17 +137,44 @@ jobs: - name: Build PGO Binary (Linux) if: matrix.build == 'linux' run: | + export TOOLCHAIN=stable-x86_64-unknown-linux-gnu + export TARGET=x86_64-unknown-linux-gnu ./build_pgo.sh env: HOME: ${{ github.workspace }} - - name: Build release binary - if: matrix.build == 'macos' || matrix.build == 'windows' || matrix.build == 'linux-static' - run: cargo build --target ${{ matrix.target }} --release --features fast-alloc + - name: Build PGO Binary (Linux Static) + if: matrix.build == 'linux-static' + run: | + export TOOLCHAIN=stable-x86_64-unknown-linux-musl + export TARGET=x86_64-unknown-linux-musl + ./build_pgo.sh + env: + HOME: ${{ github.workspace }} + + - name: Build PGO Binary (macOS) + if: matrix.build == 'macos' + run: | + export TOOLCHAIN=stable-x86_64-apple-darwin + export TARGET=x86_64-apple-darwin + ./build_pgo.sh + env: + HOME: ${{ github.workspace }} - - name: Build release binary (macos-m1) + - name: Build PGO Binary (macOS M1) if: matrix.build == 'macos-m1' - run: cargo zigbuild --target ${{ matrix.target }} --release --features fast-alloc + run: | + export TOOLCHAIN=stable-aarch64-apple-darwin + export TARGET=aarch64-apple-darwin + export ZIG=1 + cargo install cargo-zigbuild + ./build_pgo.sh + env: + HOME: ${{ github.workspace }} + + - name: Build release binary (Windows) + if: matrix.build == 'windows' + run: cargo build --target ${{ matrix.target }} --release --features fast-alloc - name: Build archive shell: bash diff --git a/build_pgo.sh b/build_pgo.sh index 4eb54821..ac49b092 100755 --- a/build_pgo.sh +++ b/build_pgo.sh @@ -22,8 +22,13 @@ cargo clean rm -rf /tmp/pgo-data PATH=$HOME/.rustup/toolchains/$TOOLCHAIN/lib/rustlib/$TARGET/bin:$PATH -RUSTFLAGS="-Cprofile-generate=/tmp/pgo-data" \ - cargo build --release --target $TARGET --features fast-alloc +if [ -n "$ZIG" ]; then + RUSTFLAGS="-Cprofile-generate=/tmp/pgo-data" \ + cargo zigbuild --release --target $TARGET --features fast-alloc +else + RUSTFLAGS="-Cprofile-generate=/tmp/pgo-data" \ + cargo build --release --target $TARGET --features fast-alloc +fi echo "Running instrumented binary" for i in $(find samples -name "*.evtx"); do @@ -41,5 +46,10 @@ else fi echo "Building binary with profile data" -RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata" \ - cargo build --release --target $TARGET --features fast-alloc +if [ -n "$ZIG" ]; then + RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata" \ + cargo zigbuild --release --target $TARGET --features fast-alloc +else + RUSTFLAGS="-Cprofile-use=/tmp/pgo-data/merged.profdata" \ + cargo build --release --target $TARGET --features fast-alloc +fi