Skip to content

Commit 44fcef8

Browse files
committed
ci: build Windows .exe artifacts in release + on PR branches
- Add build-windows job to release.yml (matches Linux/macOS jobs) - Add windows-build.yml that builds hf-mount-nfs.exe and hf-mount.exe on push to feat/windows-** and on PRs touching src/Cargo, uploads the binaries as a workflow artifact for direct download.
1 parent 8bce82f commit 44fcef8

2 files changed

Lines changed: 93 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,49 @@ jobs:
224224
name: macos-${{ matrix.arch }}
225225
path: dist/
226226

227+
build-windows:
228+
name: Build Windows (${{ matrix.arch }})
229+
needs: [bump]
230+
if: |
231+
always() &&
232+
(startsWith(github.ref, 'refs/tags/') || needs.bump.result == 'success')
233+
runs-on: windows-2022
234+
strategy:
235+
matrix:
236+
include:
237+
- arch: x86_64
238+
target: x86_64-pc-windows-msvc
239+
steps:
240+
- uses: actions/checkout@v4
241+
with:
242+
ref: ${{ needs.bump.outputs.new_tag || github.ref }}
243+
244+
- uses: dtolnay/rust-toolchain@1.95.0
245+
with:
246+
targets: ${{ matrix.target }}
247+
248+
- uses: Swatinem/rust-cache@v2
249+
with:
250+
key: release-${{ matrix.target }}
251+
252+
- name: Build
253+
run: |
254+
cargo build --release --target ${{ matrix.target }} --no-default-features --features nfs,vendored-openssl --bin hf-mount-nfs
255+
cargo build --release --target ${{ matrix.target }} --no-default-features --features vendored-openssl --bin hf-mount
256+
257+
- name: Package
258+
shell: bash
259+
run: |
260+
mkdir -p dist
261+
for bin in hf-mount-nfs hf-mount; do
262+
cp target/${{ matrix.target }}/release/${bin}.exe dist/${bin}-${{ matrix.arch }}-windows.exe
263+
done
264+
265+
- uses: actions/upload-artifact@v4
266+
with:
267+
name: windows-${{ matrix.arch }}
268+
path: dist/
269+
227270
# Compute the docker tag base + whether to push :latest. A bumped
228271
# release wins, then a manually-pushed tag, else fall back to sha-<sha>.
229272
# `latest` only on stable releases (tag matches `v\d` and has no `-`).
@@ -263,18 +306,19 @@ jobs:
263306

264307
release:
265308
name: Create Release
266-
needs: [bump, build-linux, build-macos]
309+
needs: [bump, build-linux, build-macos, build-windows]
267310
if: |
268311
always() &&
269312
needs.build-linux.result == 'success' &&
270313
needs.build-macos.result == 'success' &&
314+
needs.build-windows.result == 'success' &&
271315
(startsWith(github.ref, 'refs/tags/') || needs.bump.result == 'success')
272316
runs-on: ubuntu-22.04
273317
steps:
274318
- uses: actions/download-artifact@v4
275319
with:
276320
path: artifacts
277-
pattern: '{linux-*,macos-*}'
321+
pattern: '{linux-*,macos-*,windows-*}'
278322
merge-multiple: true
279323

280324
- name: List artifacts
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Windows Build
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "src/**"
7+
- "Cargo.toml"
8+
- "Cargo.lock"
9+
- ".github/workflows/windows-build.yml"
10+
workflow_dispatch:
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
15+
jobs:
16+
build:
17+
name: Build hf-mount-nfs.exe
18+
runs-on: windows-2022
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: dtolnay/rust-toolchain@1.95.0
23+
with:
24+
targets: x86_64-pc-windows-msvc
25+
26+
- uses: Swatinem/rust-cache@v2
27+
with:
28+
key: windows-build
29+
30+
- name: Build hf-mount-nfs
31+
run: cargo build --release --target x86_64-pc-windows-msvc --no-default-features --features nfs,vendored-openssl --bin hf-mount-nfs
32+
33+
- name: Build hf-mount
34+
run: cargo build --release --target x86_64-pc-windows-msvc --no-default-features --features vendored-openssl --bin hf-mount
35+
36+
- name: Stage artifacts
37+
shell: bash
38+
run: |
39+
mkdir -p dist
40+
cp target/x86_64-pc-windows-msvc/release/hf-mount-nfs.exe dist/
41+
cp target/x86_64-pc-windows-msvc/release/hf-mount.exe dist/
42+
43+
- uses: actions/upload-artifact@v4
44+
with:
45+
name: hf-mount-windows-x86_64
46+
path: dist/
47+
if-no-files-found: error

0 commit comments

Comments
 (0)