Skip to content

Commit 77bc49f

Browse files
author
Mike Kuykendall
committed
feat: Switch to native runner matrix for proper cross-platform builds
- Use ubuntu-latest for Linux builds - Use windows-latest for Windows builds - Use macos-latest for both Intel and Apple Silicon macOS builds - Eliminates cross-compilation issues by using native toolchains - Standard approach used by major Rust projects
1 parent f2b6da5 commit 77bc49f

1 file changed

Lines changed: 61 additions & 58 deletions

File tree

.github/workflows/release.yml

Lines changed: 61 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -9,82 +9,85 @@ on:
99
workflow_dispatch: # Allow manual testing
1010

1111
jobs:
12+
build:
13+
strategy:
14+
matrix:
15+
include:
16+
- os: ubuntu-latest
17+
target: x86_64-unknown-linux-gnu
18+
binary-name: shimmy
19+
artifact-name: shimmy-linux-x86_64
20+
21+
- os: windows-latest
22+
target: x86_64-pc-windows-msvc
23+
binary-name: shimmy.exe
24+
artifact-name: shimmy-windows-x86_64.exe
25+
26+
- os: macos-latest
27+
target: x86_64-apple-darwin
28+
binary-name: shimmy
29+
artifact-name: shimmy-macos-intel
30+
31+
- os: macos-latest
32+
target: aarch64-apple-darwin
33+
binary-name: shimmy
34+
artifact-name: shimmy-macos-arm64
35+
36+
runs-on: ${{ matrix.os }}
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Install Rust
41+
uses: dtolnay/rust-toolchain@stable
42+
with:
43+
targets: ${{ matrix.target }}
44+
45+
- name: Build binary
46+
run: cargo build --release --target ${{ matrix.target }}
47+
48+
- name: Upload artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: ${{ matrix.artifact-name }}
52+
path: target/${{ matrix.target }}/release/${{ matrix.binary-name }}
53+
1254
release:
55+
needs: build
1356
runs-on: ubuntu-latest
57+
if: startsWith(github.ref, 'refs/tags/')
1458
permissions:
1559
contents: write
1660
steps:
1761
- uses: actions/checkout@v4
1862

19-
- name: Install Rust
20-
uses: dtolnay/rust-toolchain@stable
63+
- name: Download all artifacts
64+
uses: actions/download-artifact@v4
2165
with:
22-
targets: x86_64-unknown-linux-gnu,x86_64-apple-darwin,aarch64-apple-darwin,x86_64-pc-windows-msvc
66+
path: ./artifacts
2367

24-
- name: Install cross-compilation tools
25-
run: |
26-
sudo apt-get update
27-
sudo apt-get install -y gcc-mingw-w64 clang
28-
29-
- name: Build Linux binary
30-
run: cargo build --release --target x86_64-unknown-linux-gnu
31-
32-
- name: Install cross tool
33-
run: cargo install cross --git https://github.com/cross-rs/cross
34-
35-
- name: Build macOS Intel binary
36-
run: cross build --release --target x86_64-apple-darwin
37-
continue-on-error: true
38-
39-
- name: Build macOS ARM binary
40-
run: cross build --release --target aarch64-apple-darwin
41-
continue-on-error: true
42-
43-
- name: Build Windows binary
44-
run: cross build --release --target x86_64-pc-windows-msvc
45-
continue-on-error: true
46-
47-
- name: Prepare binaries
68+
- name: Prepare release files
4869
run: |
49-
# Copy binaries with proper names (only if they exist)
50-
if [ -f target/x86_64-unknown-linux-gnu/release/shimmy ]; then
51-
cp target/x86_64-unknown-linux-gnu/release/shimmy shimmy-linux-x86_64
52-
cp target/x86_64-unknown-linux-gnu/release/shimmy shimmy
53-
fi
70+
mkdir -p release-files
5471
55-
if [ -f target/x86_64-apple-darwin/release/shimmy ]; then
56-
cp target/x86_64-apple-darwin/release/shimmy shimmy-macos-intel
57-
fi
72+
# Copy and rename artifacts
73+
cp artifacts/shimmy-linux-x86_64/shimmy release-files/shimmy-linux-x86_64
74+
cp artifacts/shimmy-linux-x86_64/shimmy release-files/shimmy # Generic name
5875
59-
if [ -f target/aarch64-apple-darwin/release/shimmy ]; then
60-
cp target/aarch64-apple-darwin/release/shimmy shimmy-macos-arm64
61-
fi
76+
cp artifacts/shimmy-windows-x86_64.exe/shimmy.exe release-files/shimmy-windows-x86_64.exe
77+
cp artifacts/shimmy-windows-x86_64.exe/shimmy.exe release-files/shimmy.exe # Generic name
6278
63-
if [ -f target/x86_64-pc-windows-msvc/release/shimmy.exe ]; then
64-
cp target/x86_64-pc-windows-msvc/release/shimmy.exe shimmy-windows-x86_64.exe
65-
cp target/x86_64-pc-windows-msvc/release/shimmy.exe shimmy.exe
66-
fi
79+
cp artifacts/shimmy-macos-intel/shimmy release-files/shimmy-macos-intel
80+
cp artifacts/shimmy-macos-arm64/shimmy release-files/shimmy-macos-arm64
6781
68-
# List all created files
69-
echo "Available binaries:"
70-
ls -la shimmy* || echo "No binaries created yet"
82+
# List what we're releasing
83+
echo "Release files:"
84+
ls -la release-files/
7185
72-
- name: Create release (only on tags)
73-
if: startsWith(github.ref, 'refs/tags/')
86+
- name: Create release
7487
env:
7588
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7689
run: |
77-
# Build list of files to upload
78-
FILES=""
79-
[ -f shimmy-linux-x86_64 ] && FILES="$FILES shimmy-linux-x86_64"
80-
[ -f shimmy-macos-intel ] && FILES="$FILES shimmy-macos-intel"
81-
[ -f shimmy-macos-arm64 ] && FILES="$FILES shimmy-macos-arm64"
82-
[ -f shimmy-windows-x86_64.exe ] && FILES="$FILES shimmy-windows-x86_64.exe"
83-
[ -f shimmy ] && FILES="$FILES shimmy"
84-
[ -f shimmy.exe ] && FILES="$FILES shimmy.exe"
85-
86-
echo "Uploading files: $FILES"
8790
gh release create ${{ github.ref_name }} \
88-
$FILES \
91+
release-files/* \
8992
--title "Shimmy ${{ github.ref_name }}" \
9093
--generate-notes

0 commit comments

Comments
 (0)