Skip to content

Commit 103e00f

Browse files
committed
CI updates
1 parent 68606df commit 103e00f

File tree

1 file changed

+84
-6
lines changed

1 file changed

+84
-6
lines changed

.github/workflows/build.yaml

Lines changed: 84 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,19 @@ jobs:
2525
sudo apt-get -y install libgtk-3-dev
2626
- name: Checkout
2727
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
2841
- name: Setup Rust toolchain
2942
uses: dtolnay/rust-toolchain@stable
3043
with:
@@ -100,8 +113,75 @@ jobs:
100113
SCCACHE_GHA_ENABLED: "true"
101114
run: cargo test --release
102115

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
105185
strategy:
106186
matrix:
107187
include:
@@ -144,14 +224,12 @@ jobs:
144224
SCCACHE_GHA_ENABLED: "true"
145225
run: >
146226
cargo build --profile ${{ env.BUILD_PROFILE }} --target ${{ matrix.target }}
147-
--bin objdiff-cli --bin objdiff --features ${{ matrix.features }}
227+
--bin objdiff --features ${{ matrix.features }}
148228
- name: Upload artifacts
149229
uses: actions/upload-artifact@v4
150230
with:
151231
name: ${{ matrix.name }}
152232
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
155233
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff
156234
${{ env.CARGO_TARGET_DIR }}/${{ matrix.target }}/${{ env.BUILD_PROFILE }}/objdiff.exe
157235
if-no-files-found: error
@@ -160,7 +238,7 @@ jobs:
160238
name: Release
161239
if: startsWith(github.ref, 'refs/tags/')
162240
runs-on: ubuntu-latest
163-
needs: [ build ]
241+
needs: [ check, build ]
164242
permissions:
165243
contents: write
166244
steps:

0 commit comments

Comments
 (0)