From f5febe191ca12a98b5bbf783db4152d25e3afc59 Mon Sep 17 00:00:00 2001 From: Robin Avery Date: Sat, 2 Mar 2024 19:50:16 -0500 Subject: [PATCH] Fix release CI (and add `sccache`) --- .github/workflows/build.yaml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5da61bf..7b032a1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -117,6 +117,8 @@ jobs: run: | sudo apt-get update sudo apt-get -y install ${{ matrix.packages }} + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 - name: Checkout uses: actions/checkout@v4 - name: Setup Rust toolchain @@ -124,6 +126,9 @@ jobs: with: targets: ${{ matrix.target }} - name: Cargo build + env: + SCCACHE_GHA_ENABLED: "true" + RUSTC_WRAPPER: "sccache" run: > cargo build --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }} --bin objdiff-cli --bin objdiff-gui --features ${{ matrix.features }} @@ -143,6 +148,8 @@ jobs: if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest needs: [ build ] + permissions: + contents: write steps: - name: Download artifacts uses: actions/download-artifact@v4 @@ -151,12 +158,21 @@ jobs: - name: Rename artifacts working-directory: artifacts run: | + set -euo pipefail mkdir ../out - for i in */*/$BUILD_PROFILE/objdiff-cli*; do - mv "$i" "../out/$(sed -E "s/([^/]+)\/[^/]+\/$BUILD_PROFILE\/objdiff-cli/objdiff-cli-\1/" <<< "$i")" - done - for i in */*/$BUILD_PROFILE/objdiff-gui*; do - mv "$i" "../out/$(sed -E "s/([^/]+)\/[^/]+\/$BUILD_PROFILE\/objdiff-gui/objdiff-\1/" <<< "$i")" + for dir in */; do + for file in "$dir"*; do + base=$(basename "$file") + name="${base%.*}" + ext="${base##*.}" + if [ "$ext" = "$base" ]; then + ext="" + else + ext=".$ext" + fi + dst="../out/${name}-${dir%/}${ext}" + mv "$file" "$dst" + done done ls -R ../out - name: Release