Skip to content

Commit ce0e396

Browse files
feat(windows): Windows boilerplate and CI (firezone#2715) (firezone#2730)
Testing if CI will build the Windows exe, or at least check the code. --------- Co-authored-by: Jamil Bou Kheir <[email protected]>
1 parent a309f11 commit ce0e396

File tree

9 files changed

+442
-54
lines changed

9 files changed

+442
-54
lines changed

.github/workflows/_rust.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- runs-on: macos-13
2828
packages: -p connlib-client-apple
2929
- runs-on: windows-2022
30-
packages: -p connlib-client-shared
30+
packages: -p connlib-client-shared -p firezone-windows-client
3131
runs-on: ${{ matrix.runs-on }}
3232
steps:
3333
- uses: actions/checkout@v4
@@ -55,9 +55,9 @@ jobs:
5555
- runs-on: macos-13
5656
packages: -p connlib-client-apple
5757
- runs-on: windows-2019
58-
packages: -p connlib-client-shared
58+
packages: -p firezone-windows-client -p connlib-client-shared
5959
- runs-on: windows-2022
60-
packages: -p connlib-client-shared
60+
packages: -p firezone-windows-client -p connlib-client-shared
6161
runs-on: ${{ matrix.runs-on }}
6262
steps:
6363
- uses: actions/checkout@v4

.github/workflows/cd.yml

+58-2
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
tag_name: ${{ steps.update-release-draft.outputs.tag_name }}
114114
upload_url: ${{ steps.update-release-draft.outputs.upload_url }}
115115

116-
build-push-release-artifacts:
116+
build-push-linux-release-artifacts:
117117
permissions:
118118
id-token: write
119119
contents: write
@@ -243,10 +243,66 @@ jobs:
243243
if-no-files-found: error
244244
retention-days: 1
245245

246+
# Build for Windows with Cross
247+
build-push-windows-release-artifacts:
248+
permissions:
249+
id-token: write
250+
contents: write
251+
needs: update-release-draft
252+
runs-on: ubuntu-22.04
253+
defaults:
254+
run:
255+
working-directory: ./rust
256+
strategy:
257+
fail-fast: false
258+
matrix:
259+
arch:
260+
- target: x86_64-pc-windows-msvc
261+
shortname: x64
262+
name:
263+
- package: firezone-windows-client
264+
artifact: windows-client
265+
env:
266+
BINARY_DEST_PATH: ${{ matrix.name.artifact }}-${{ matrix.arch.shortname }}
267+
steps:
268+
- uses: actions/checkout@v4
269+
- uses: ./.github/actions/setup-rust
270+
with:
271+
targets: x86_64-pc-windows-msvc
272+
- uses: taiki-e/install-action@v2
273+
with:
274+
tool: cross
275+
- name: Build release binaries
276+
run: |
277+
set -xe
278+
279+
cross build --release -p ${{ matrix.name.package }} --target ${{ matrix.arch.target }}
280+
281+
# Used for release artifact
282+
cp target/${{ matrix.arch.target }}/release/${{ matrix.name.package }} $BINARY_DEST_PATH
283+
284+
# Used for Docker images
285+
cp target/${{ matrix.arch.target }}/release/${{ matrix.name.package }} ${{ matrix.name.package }}
286+
sha256sum $BINARY_DEST_PATH > $BINARY_DEST_PATH.sha256sum.txt
287+
288+
ls -la $BINARY_DEST_PATH
289+
ls -la $BINARY_DEST_PATH.sha256sum.txt
290+
- name: Upload Release Assets
291+
env:
292+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
293+
run: |
294+
set -xe
295+
296+
gh release upload ${{ needs.update-release-draft.outputs.tag_name }} \
297+
${{ env.BINARY_DEST_PATH }} \
298+
${{ env.BINARY_DEST_PATH }}.sha256sum.txt \
299+
--clobber \
300+
--repo ${{ github.repository }}
301+
246302
merge-release-artifacts:
247303
permissions:
248304
id-token: write
249-
needs: build-push-release-artifacts
305+
needs: build-push-linux-release-artifacts
250306
runs-on: ubuntu-22.04
251307
strategy:
252308
fail-fast: false

.yamllint

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
extends: default
2+
3+
rules:
4+
line-length: disable

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ product documentation, organized as follows:
9797
- [rust/relay](./rust/relay): Relay - STUN/TURN server to facilitate
9898
holepunching.
9999
- [rust/linux-client](./rust/linux-client): Linux client.
100+
- [rust/windows-client](./rust/windows-client): Windows client.
100101
- [swift/](./swift/apple): macOS / iOS clients.
101102
- [kotlin/](./kotlin/android): Android / ChromeOS clients.
102103
- [website/](./website): Marketing website and product documentation.

0 commit comments

Comments
 (0)