Skip to content

Commit cb6ff29

Browse files
authored
[rust] Use static linking using cross-compiling to target x86_64-unknown-linux-musl in GH Actions (#11749)
* [rust] Compile selenium-manager using x86_64-unknown-linux-musl target in Linux * [rust] Change way to install cargo-zigbuild * [rust] Remove zibguild * [rust] Install cargo-zigbuild again * [rust] Disable crt-static * [rust] Install zip in Linux * [rust] Remove debugging symbols
1 parent f28144e commit cb6ff29

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/build-selenium-manager.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
name: "[Windows] Build selenium-manager"
88
runs-on: windows-latest
99
env:
10-
RUSTFLAGS: '-C target-feature=+crt-static'
10+
RUSTFLAGS: '-Ctarget-feature=+crt-static'
1111
steps:
1212
- name: "Checkout project"
1313
uses: actions/checkout@v3
@@ -30,21 +30,26 @@ jobs:
3030
name: "[Linux] Build selenium-manager"
3131
runs-on: ubuntu-latest
3232
env:
33-
RUSTFLAGS: '-C target-feature=+crt-static'
33+
RUSTFLAGS: '-Ctarget-feature=-crt-static'
3434
steps:
3535
- name: "Checkout project"
3636
uses: actions/checkout@v3
3737
- name: "Update Rust"
3838
run: |
3939
rustup update
4040
rustc -vV
41+
- name: "Install zig"
42+
run: |
43+
sudo snap install zig --beta --classic
4144
- name: "Build release"
4245
run: |
4346
cd rust
44-
cargo build --release --target x86_64-unknown-linux-gnu
47+
cargo install cargo-zigbuild
48+
rustup target add x86_64-unknown-linux-musl
49+
cargo zigbuild --release --target x86_64-unknown-linux-musl
4550
- name: "Tar binary (to keep executable permission)"
4651
run: |
47-
cd rust/target/x86_64-unknown-linux-gnu/release
52+
cd rust/target/x86_64-unknown-linux-musl/release
4853
tar -cvf ../../../../selenium-manager.tar selenium-manager
4954
- name: "Upload binary"
5055
uses: actions/upload-artifact@v3
@@ -57,7 +62,7 @@ jobs:
5762
name: "[macOS] Build selenium-manager"
5863
runs-on: macos-latest
5964
env:
60-
RUSTFLAGS: '-C target-feature=+crt-static'
65+
RUSTFLAGS: '-Ctarget-feature=+crt-static'
6166
steps:
6267
- name: "Checkout project"
6368
uses: actions/checkout@v3

0 commit comments

Comments
 (0)