Skip to content

Commit 3cd26cc

Browse files
committed
Build linux-arm64 on an arm runner
1 parent be0c986 commit 3cd26cc

1 file changed

Lines changed: 27 additions & 33 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,55 +20,49 @@ jobs:
2020
echo "Tag format is invalid. Expected semantic versioning (e.g., 1.2.3)."
2121
exit 1
2222
fi
23-
macos:
24-
runs-on: macos-latest
23+
build:
24+
runs-on: ${{ matrix.runs-on }}
2525
needs:
2626
- validate
2727
strategy:
2828
matrix:
29-
arch:
30-
- arm64
29+
runs-on:
30+
- macos-15
31+
- ubuntu-24.04
32+
- ubuntu-24.04-arm
3133
steps:
3234
- uses: actions/checkout@v4
3335
with:
3436
repository: apple/swift-protobuf
3537
ref: ${{ github.ref_name }}
36-
- run: |
37-
swift build -c release
38-
mv .build/release/protoc-gen-swift protoc-gen-swift-macos-${{ matrix.arch }}
39-
- uses: actions/upload-artifact@v4
40-
with:
41-
name: protoc-gen-swift-macos-${{ matrix.arch }}
42-
path: protoc-gen-swift-macos-${{ matrix.arch }}
43-
linux:
44-
runs-on: ubuntu-latest
45-
needs:
46-
- validate
47-
strategy:
48-
matrix:
49-
arch:
50-
- amd64
51-
- arm64
52-
steps:
53-
- uses: actions/checkout@v4
54-
with:
55-
repository: apple/swift-protobuf
56-
ref: ${{ github.ref_name }}
57-
- run: |
58-
swift build -c release --static-swift-stdlib
59-
mv .build/release/protoc-gen-swift protoc-gen-swift-linux-${{ matrix.arch }}
38+
- id: build
39+
run: |
40+
if [[ ${{ matrix.runs-on }} == "macos-15" ]]; then
41+
executable="protoc-gen-swift-macos-arm64"
42+
elif [[ ${{ matrix.runs-on }} == "ubuntu-24.04" ]]; then
43+
executable="protoc-gen-swift-linux-amd64"
44+
flags="--static-swift-stdlib"
45+
elif [[ ${{ matrix.runs-on }} == "ubuntu-24.04-arm" ]]; then
46+
executable="protoc-gen-swift-linux-arm64"
47+
flags="--static-swift-stdlib"
48+
else
49+
echo "unsupported runner type: ${{ matrix.runs-on }}"
50+
exit 1
51+
fi
52+
swift build -c release $flags
53+
echo "executable=$executable" | tee -a $GITHUB_OUTPUT
54+
mv .build/release/protoc-gen-swift $executable
6055
- uses: actions/upload-artifact@v4
6156
with:
62-
name: protoc-gen-swift-linux-${{ matrix.arch }}
63-
path: protoc-gen-swift-linux-${{ matrix.arch }}
57+
name: ${{ steps.build.outputs.executable }}
58+
path: ${{ steps.build.outputs.executable }}
6459
release:
6560
runs-on: ubuntu-latest
6661
needs:
67-
- macos
68-
- linux
62+
- build
6963
steps:
7064
- uses: actions/download-artifact@v4
71-
- run: ls -l; ls -l protoc-gen-swift-*
65+
- run: ls -l
7266
- uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda
7367
with:
7468
files: '**/protoc-gen-swift-*'

0 commit comments

Comments
 (0)