Skip to content

Commit 171c445

Browse files
ci(release): cross-compile Windows binary on Linux runner (#445)
Replace the Windows runner with cross-compilation on a separate Linux runner using x86_64-pc-windows-gnu. All three builds (Linux, Windows cross-compile, macOS) run in parallel on their own runners. Linux runners are faster and cheaper than Windows runners, speeding up the release pipeline. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 9fa98f3 commit 171c445

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ jobs:
5353
- name: Prepare release assets
5454
run: |
5555
set -euo pipefail
56-
cd target/release
57-
cp ado-aw ado-aw-linux-x64
56+
cp target/release/ado-aw target/release/ado-aw-linux-x64
5857
5958
- name: Package scripts bundle
6059
run: |
@@ -73,36 +72,37 @@ jobs:
7372
--clobber
7473
7574
build-windows:
76-
name: Build (Windows)
75+
name: Build (Windows cross-compile)
7776
needs: release-please
7877
if: >-
7978
always() &&
8079
(needs.release-please.outputs.release_created == 'true' || github.event_name == 'workflow_dispatch')
81-
runs-on: windows-2022
80+
runs-on: ubuntu-22.04
8281
steps:
8382
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8483

8584
- uses: dtolnay/rust-toolchain@631a55b12751854ce901bb631d5902ceb48146f7 # stable
85+
with:
86+
targets: x86_64-pc-windows-gnu
8687

8788
- uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
89+
with:
90+
key: windows-cross
8891

89-
- name: Build
90-
run: cargo build --release --verbose
91-
92-
- name: Run tests
93-
run: cargo test --verbose
92+
- name: Install cross-compilation toolchain
93+
run: sudo apt-get update && sudo apt-get install -y gcc-mingw-w64-x86-64
9494

95-
- name: Prepare release assets
96-
run: |
97-
Copy-Item target/release/ado-aw.exe target/release/ado-aw-windows-x64.exe
95+
- name: Build
96+
run: cargo build --release --target x86_64-pc-windows-gnu --verbose
9897

9998
- name: Upload release assets
10099
env:
101100
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102101
run: |
103-
$TAG = "${{ needs.release-please.outputs.tag_name || github.event.inputs.tag_name }}"
104-
gh release upload "$TAG" `
105-
target/release/ado-aw-windows-x64.exe `
102+
TAG="${{ needs.release-please.outputs.tag_name || github.event.inputs.tag_name }}"
103+
cp target/x86_64-pc-windows-gnu/release/ado-aw.exe ado-aw-windows-x64.exe
104+
gh release upload "$TAG" \
105+
ado-aw-windows-x64.exe \
106106
--clobber
107107
108108
build-macos-arm64:

0 commit comments

Comments
 (0)