25
25
sudo apt-get -y install libgtk-3-dev
26
26
- name : Checkout
27
27
uses : actions/checkout@v4
28
+ - name : Check git tag against Cargo version
29
+ if : startsWith(github.ref, 'refs/tags/')
30
+ shell : bash
31
+ run : |
32
+ set -eou
33
+ version=$(grep '^version' Cargo.toml | awk -F' = ' '{print $2}' | tr -d '"')
34
+ version="v$version"
35
+ tag='${{github.ref}}'
36
+ tag="${tag#refs/tags/}"
37
+ if [ "$tag" != "$version" ]; then
38
+ echo "::error::Git tag doesn't match the Cargo version! ($tag != $version)"
39
+ exit 1
40
+ fi
28
41
- name : Setup Rust toolchain
29
42
uses : dtolnay/rust-toolchain@stable
30
43
with :
@@ -100,8 +113,75 @@ jobs:
100
113
SCCACHE_GHA_ENABLED : " true"
101
114
run : cargo test --release
102
115
103
- build :
104
- name : Build
116
+ build-cli :
117
+ name : Build objdiff-cli
118
+ strategy :
119
+ matrix :
120
+ include :
121
+ - platform : ubuntu-latest
122
+ target : x86_64-unknown-linux-musl
123
+ name : linux-x86_64
124
+ build : zigbuild
125
+ features : default
126
+ - platform : ubuntu-latest
127
+ target : i686-unknown-linux-musl
128
+ name : linux-i686
129
+ build : zigbuild
130
+ features : default
131
+ - platform : ubuntu-latest
132
+ target : aarch64-unknown-linux-musl
133
+ name : linux-aarch64
134
+ build : zigbuild
135
+ features : default
136
+ - platform : ubuntu-latest
137
+ target : armv7-unknown-linux-musleabi
138
+ name : linux-armv7l
139
+ build : zigbuild
140
+ features : default
141
+ - platform : windows-latest
142
+ target : x86_64-pc-windows-msvc
143
+ name : windows-x86_64
144
+ features : default
145
+ - platform : macos-latest
146
+ target : x86_64-apple-darwin
147
+ name : macos-x86_64
148
+ features : default
149
+ - platform : macos-latest
150
+ target : aarch64-apple-darwin
151
+ name : macos-arm64
152
+ features : default
153
+ fail-fast : false
154
+ runs-on : ${{ matrix.platform }}
155
+ steps :
156
+ - name : Checkout
157
+ uses : actions/checkout@v4
158
+ - name : Install cargo-zigbuild
159
+ if : matrix.build == 'zigbuild'
160
+ run : pip install ziglang==0.12.0 cargo-zigbuild==0.18.4
161
+ - name : Setup Rust toolchain
162
+ uses : dtolnay/rust-toolchain@stable
163
+ with :
164
+ targets : ${{ matrix.target }}
165
+ - name : Setup sccache
166
+ uses :
mozilla-actions/[email protected]
167
+ - name : Cargo build
168
+ env :
169
+ RUSTC_WRAPPER : sccache
170
+ SCCACHE_GHA_ENABLED : " true"
171
+ run : >
172
+ cargo build --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }}
173
+ --bin objdiff-cli --features ${{ matrix.features }}
174
+ - name : Upload artifacts
175
+ uses : actions/upload-artifact@v4
176
+ with :
177
+ name : ${{ matrix.name }}
178
+ path : |
179
+ ${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff-cli
180
+ ${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff-cli.exe
181
+ if-no-files-found : error
182
+
183
+ build-gui :
184
+ name : Build objdiff-gui
105
185
strategy :
106
186
matrix :
107
187
include :
@@ -144,14 +224,12 @@ jobs:
144
224
SCCACHE_GHA_ENABLED : " true"
145
225
run : >
146
226
cargo build --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }}
147
- --bin objdiff-cli --bin objdiff --features ${{ matrix.features }}
227
+ --bin objdiff --features ${{ matrix.features }}
148
228
- name : Upload artifacts
149
229
uses : actions/upload-artifact@v4
150
230
with :
151
231
name : ${{ matrix.name }}
152
232
path : |
153
- ${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff-cli
154
- ${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff-cli.exe
155
233
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff
156
234
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff.exe
157
235
if-no-files-found : error
@@ -160,7 +238,7 @@ jobs:
160
238
name : Release
161
239
if : startsWith(github.ref, 'refs/tags/')
162
240
runs-on : ubuntu-latest
163
- needs : [ build ]
241
+ needs : [ check, build ]
164
242
permissions :
165
243
contents : write
166
244
steps :
0 commit comments