Skip to content

Commit ff407e7

Browse files
committed
ci: smoke test built binaries to make sure they run
1 parent 91ed677 commit ff407e7

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

.github/workflows/pull_request.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ on:
1515
- "rust-toolchain.toml"
1616
- "rustfmt.toml"
1717
- "deny.toml"
18+
- ".github/workflows/pull_request.yml"
19+
- ".github/workflows/release.yml"
1820

1921
# Cancel jobs when the PR is updated
2022
concurrency:
@@ -119,6 +121,94 @@ jobs:
119121
cd e2e-tests
120122
sh test-all.sh
121123
124+
smoke-test-binaries:
125+
name: Smoke test ${{ matrix.code-target }}
126+
runs-on: ${{ matrix.os }}
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
include:
131+
- os: depot-windows-2022-16
132+
target: x86_64-pc-windows-msvc
133+
code-target: win32-x64
134+
- os: depot-windows-2022-16
135+
target: aarch64-pc-windows-msvc
136+
code-target: win32-arm64
137+
- os: depot-ubuntu-24.04-16
138+
target: x86_64-unknown-linux-musl
139+
code-target: linux-x64-musl
140+
- os: depot-ubuntu-24.04-arm-16
141+
target: aarch64-unknown-linux-musl
142+
code-target: linux-arm64-musl
143+
- os: depot-macos-14
144+
target: x86_64-apple-darwin
145+
code-target: darwin-x64
146+
- os: depot-macos-14
147+
target: aarch64-apple-darwin
148+
code-target: darwin-arm64
149+
- os: depot-ubuntu-24.04-16
150+
target: x86_64-unknown-linux-gnu
151+
code-target: linux-x64
152+
- os: depot-ubuntu-24.04-arm-4
153+
target: aarch64-unknown-linux-gnu
154+
code-target: linux-arm64
155+
steps:
156+
- name: Checkout PR branch
157+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
158+
- name: Install Rust target
159+
run: rustup target add ${{ matrix.target }}
160+
- name: Install musl toolchain
161+
if: matrix.code-target == 'linux-x64-musl' || matrix.code-target == 'linux-arm64-musl'
162+
run: |
163+
sudo apt-get update
164+
sudo apt-get install -y musl-tools
165+
- name: Build binary
166+
run: cargo build -p biome_cli --target ${{ matrix.target }}
167+
env:
168+
# Windows binaries can fail to build with a stack overflow error. This increases the stack size to 8MB to mitigate that.
169+
# We do this because the alternative is to build a release binary, which takes significantly longer to build and is not necessary for a smoke test.
170+
RUSTFLAGS: ${{ runner.os == 'Windows' && '-C link-arg=/STACK:8388608' || '' }}
171+
- name: Copy CLI binary
172+
if: runner.os == 'Windows'
173+
run: |
174+
mkdir dist
175+
cp target/${{ matrix.target }}/debug/biome.exe ./dist/biome-${{ matrix.code-target }}.exe
176+
- name: Copy CLI binary
177+
if: runner.os != 'Windows'
178+
run: |
179+
mkdir dist
180+
cp target/${{ matrix.target }}/debug/biome ./dist/biome-${{ matrix.code-target }}
181+
- name: Smoke test binary (Windows)
182+
if: matrix.target == 'x86_64-pc-windows-msvc'
183+
shell: pwsh
184+
run: .\dist\biome-${{ matrix.code-target }}.exe --version
185+
- name: Smoke test binary (Unix)
186+
if: runner.os != 'Windows'
187+
run: |
188+
chmod +x ./dist/biome-${{ matrix.code-target }}
189+
./dist/biome-${{ matrix.code-target }} --version
190+
- name: Upload win32-arm64 binary
191+
if: matrix.target == 'aarch64-pc-windows-msvc'
192+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
193+
with:
194+
name: smoke-test-win32-arm64
195+
path: ./dist/biome-win32-arm64.exe
196+
if-no-files-found: error
197+
198+
smoke-test-win32-arm64:
199+
name: Smoke test win32-arm64
200+
# Depot doesn't have Windows ARM runners.
201+
runs-on: windows-11-arm
202+
needs: smoke-test-binaries
203+
steps:
204+
- name: Download CLI artifact
205+
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
206+
with:
207+
name: smoke-test-win32-arm64
208+
- name: Run --version
209+
shell: pwsh
210+
run: .\biome-win32-arm64.exe --version
211+
122212
documentation:
123213
name: Documentation
124214
runs-on: depot-ubuntu-24.04-arm

0 commit comments

Comments
 (0)