Skip to content

Commit 341c1d4

Browse files
authored
Fix release CI (and add sccache) (#52)
* Fix release CI (and add `sccache`) * Rename `objdiff-gui` binary to `objdiff`
1 parent 9f4a1e8 commit 341c1d4

File tree

2 files changed

+28
-8
lines changed

2 files changed

+28
-8
lines changed

.github/workflows/build.yaml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,32 +117,39 @@ jobs:
117117
run: |
118118
sudo apt-get update
119119
sudo apt-get -y install ${{ matrix.packages }}
120+
- name: Run sccache-cache
121+
uses: mozilla-actions/sccache-action@v0.0.3
120122
- name: Checkout
121123
uses: actions/checkout@v4
122124
- name: Setup Rust toolchain
123125
uses: dtolnay/rust-toolchain@stable
124126
with:
125127
targets: ${{ matrix.target }}
126128
- name: Cargo build
129+
env:
130+
SCCACHE_GHA_ENABLED: "true"
131+
RUSTC_WRAPPER: "sccache"
127132
run: >
128133
cargo build --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }}
129-
--bin objdiff-cli --bin objdiff-gui --features ${{ matrix.features }}
134+
--bin objdiff-cli --bin objdiff --features ${{ matrix.features }}
130135
- name: Upload artifacts
131136
uses: actions/upload-artifact@v4
132137
with:
133138
name: ${{ matrix.name }}
134139
path: |
135140
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff-cli
136141
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff-cli.exe
137-
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff-gui
138-
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff-gui.exe
142+
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff
143+
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff.exe
139144
if-no-files-found: error
140145

141146
release:
142147
name: Release
143148
if: startsWith(github.ref, 'refs/tags/')
144149
runs-on: ubuntu-latest
145150
needs: [ build ]
151+
permissions:
152+
contents: write
146153
steps:
147154
- name: Download artifacts
148155
uses: actions/download-artifact@v4
@@ -151,12 +158,21 @@ jobs:
151158
- name: Rename artifacts
152159
working-directory: artifacts
153160
run: |
161+
set -euo pipefail
154162
mkdir ../out
155-
for i in */*/$BUILD_PROFILE/objdiff-cli*; do
156-
mv "$i" "../out/$(sed -E "s/([^/]+)\/[^/]+\/$BUILD_PROFILE\/objdiff-cli/objdiff-cli-\1/" <<< "$i")"
157-
done
158-
for i in */*/$BUILD_PROFILE/objdiff-gui*; do
159-
mv "$i" "../out/$(sed -E "s/([^/]+)\/[^/]+\/$BUILD_PROFILE\/objdiff-gui/objdiff-\1/" <<< "$i")"
163+
for dir in */; do
164+
for file in "$dir"*; do
165+
base=$(basename "$file")
166+
name="${base%.*}"
167+
ext="${base##*.}"
168+
if [ "$ext" = "$base" ]; then
169+
ext=""
170+
else
171+
ext=".$ext"
172+
fi
173+
dst="../out/${name}-${dir%/}${ext}"
174+
mv "$file" "$dst"
175+
done
160176
done
161177
ls -R ../out
162178
- name: Release

objdiff-gui/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ A local diffing tool for decompilation projects.
1313
publish = false
1414
build = "build.rs"
1515

16+
[[bin]]
17+
name = "objdiff"
18+
path = "src/main.rs"
19+
1620
[features]
1721
default = ["wgpu", "wsl"]
1822
wgpu = ["eframe/wgpu"]

0 commit comments

Comments
 (0)