Skip to content

Commit ed650ef

Browse files
authored
ci: build for musl (#513)
rel: #427
1 parent b2b6bf3 commit ed650ef

File tree

1 file changed

+47
-2
lines changed

1 file changed

+47
-2
lines changed

.github/workflows/rust.yml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,51 @@ jobs:
103103
env:
104104
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
105105

106+
build-linux-musl-x64:
107+
needs: pre_job
108+
# if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/')
109+
110+
name: Linux Alpine x86_64
111+
runs-on: ubuntu-22.04
112+
113+
steps:
114+
- name: Checkout
115+
uses: actions/checkout@v4
116+
117+
- name: Install musl-tools
118+
run: |
119+
sudo apt-get update
120+
sudo apt-get install -y musl-tools
121+
122+
- name: Install Toolchain
123+
uses: oxidecomputer/actions-rs_toolchain@ad3f86084a8a5acf2c09cb691421b31cf8af7a36 # pin@oxide/master
124+
with:
125+
toolchain: stable
126+
target: x86_64-unknown-linux-musl
127+
profile: minimal
128+
override: true
129+
130+
- name: Cache
131+
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # pin@v2
132+
133+
- name: Build
134+
run: RUSTFLAGS="-C linker=rust-lld" cargo build --target x86_64-unknown-linux-musl --release && mv target/x86_64-unknown-linux-musl/release/squawk target/release/squawk-linux-musl-x64
135+
136+
- name: Artifact
137+
uses: actions/upload-artifact@v4
138+
with:
139+
name: release-squawk-linux-musl-x64
140+
path: target/release/squawk-linux-musl-x64
141+
142+
- name: Release
143+
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # pin@v1
144+
if: startsWith(github.ref, 'refs/tags/')
145+
with:
146+
files: |
147+
target/release/squawk-linux-musl-x64
148+
env:
149+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
150+
106151
build-windows:
107152
needs: pre_job
108153
if: needs.pre_job.outputs.should_skip != 'true' || startsWith(github.ref, 'refs/tags/')
@@ -193,7 +238,7 @@ jobs:
193238

194239
publish-npm:
195240
if: startsWith(github.ref, 'refs/tags/')
196-
needs: [build-linux-x64, build-mac, build-windows]
241+
needs: [build-linux-x64, build-linux-musl-x64, build-mac, build-windows]
197242
runs-on: ubuntu-22.04
198243
steps:
199244
- uses: actions/checkout@v4
@@ -207,7 +252,7 @@ jobs:
207252

208253
publish-docker:
209254
if: startsWith(github.ref, 'refs/tags/')
210-
needs: [build-linux-x64, build-mac, build-windows]
255+
needs: [build-linux-x64, build-linux-musl-x64, build-mac, build-windows]
211256
runs-on: ubuntu-22.04
212257
permissions:
213258
contents: read

0 commit comments

Comments
 (0)