From 75de99e4169082028b9613c5c6b142fbf974d5fb Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Fri, 3 Oct 2025 11:41:55 +0200 Subject: [PATCH 1/2] ci: continuously check that musl builds of cargo-codspeed works --- .github/workflows/ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5abde412..65a4d9fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,6 +122,29 @@ jobs: mode: walltime token: ${{ secrets.CODSPEED_TOKEN }} + musl-build-check: + strategy: + matrix: + include: + - target: x86_64-unknown-linux-musl + runner: ubuntu-24.04 + - target: aarch64-unknown-linux-musl + runner: codspeedhq-arm64-ubuntu-24.04 + + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v4 + with: + submodules: true + - uses: moonrepo/setup-rust@v1 + with: + targets: ${{ matrix.target }} + + - name: Install musl tools + run: sudo apt-get update && sudo apt-get install -y musl-tools + + - run: cargo build --locked --release --bin cargo-codspeed --target ${{ matrix.target }} + check: runs-on: ubuntu-latest if: always() @@ -132,6 +155,7 @@ jobs: - tests - compat-integration-test-instrumentation - compat-integration-test-walltime + - musl-build-check steps: - uses: re-actors/alls-green@release/v1 with: From 22e8366a8caffb68d7755e99f19664dbabdc89ac Mon Sep 17 00:00:00 2001 From: Guillaume Lagrange Date: Fri, 3 Oct 2025 11:58:58 +0200 Subject: [PATCH 2/2] ci: prevent release workflow from publishing if musl build fails --- .github/workflows/release.yml | 60 ++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cbc547f8..2bd00512 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,39 @@ permissions: contents: write jobs: + build-musl-binaries: + strategy: + matrix: + include: + - target: x86_64-unknown-linux-musl + runner: ubuntu-24.04 + - target: aarch64-unknown-linux-musl + runner: codspeedhq-arm64-ubuntu-24.04 + + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + - uses: moonrepo/setup-rust@v1 + with: + targets: ${{ matrix.target }} + + - name: Install musl tools + run: sudo apt-get update && sudo apt-get install -y musl-tools + + - run: cargo build --locked --release --bin cargo-codspeed --target ${{ matrix.target }} + + - name: Upload binary as artifact + uses: actions/upload-artifact@v4 + with: + name: cargo-codspeed-${{ matrix.target }} + path: ./target/${{ matrix.target }}/release/cargo-codspeed + if-no-files-found: error + publish: + needs: build-musl-binaries runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -41,35 +73,25 @@ jobs: outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} - build-upload-binaries: + upload-binaries: needs: publish strategy: fail-fast: false matrix: - include: - - target: x86_64-unknown-linux-musl - runner: ubuntu-24.04 - - target: aarch64-unknown-linux-musl - runner: codspeedhq-arm64-ubuntu-24.04 + target: + - x86_64-unknown-linux-musl + - aarch64-unknown-linux-musl - runs-on: ${{ matrix.runner }} + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - name: Download binary artifact + uses: actions/download-artifact@v4 with: - submodules: true - fetch-depth: 0 - - uses: moonrepo/setup-rust@v1 - with: - targets: ${{ matrix.target }} - - - name: Install musl tools - run: sudo apt-get update && sudo apt-get install -y musl-tools - - - run: cargo build --locked --release --bin cargo-codspeed --target ${{ matrix.target }} + name: cargo-codspeed-${{ matrix.target }} + path: ./target/${{ matrix.target }}/release - name: Upload Release Asset if: github.event_name != 'workflow_dispatch' - id: upload-release-asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}