Skip to content

Commit 1e72642

Browse files
committed
ci: build binary artifacts for pushes/PRs
* Windows (x86_64 MSVC) * Linux (x86_64 GNU glibc) * Apple (ARM64 and x86_64) Binary artifacts are built in release mode using stable rust, with the default crypto provider (aws-lc-rs) and cert compression enabled. Linux binaries are built on ubuntu-20.04 for greatest compatibility. Users will need glibc 2.31 or greater. For now I've opted not to include a statically linked musl build. For FIPS, no cert-compression, the ring crypto provider, debug builds, or other customization you will need to build from source. Users of the `.pc` files will need to override the `prefix` to wherever they extract the archive, or use `cargo cinstall` from src. Package config files in an archive aren't relocatable.
1 parent 560e4c7 commit 1e72642

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

.github/workflows/artifacts.yaml

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: binary artifacts
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
push:
8+
pull_request:
9+
10+
jobs:
11+
windows-binaries:
12+
name: Windows (x86_64 MSVC)
13+
runs-on: windows-2022 # x86_64
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
18+
19+
- name: Install stable Rust
20+
uses: dtolnay/rust-toolchain@stable
21+
22+
- name: Install cargo-c
23+
env:
24+
LINK: https://github.com/lu-zero/cargo-c/releases/latest/download
25+
CARGO_C_FILE: cargo-c-windows-msvc.zip
26+
run: |
27+
curl -L "$env:LINK/$env:CARGO_C_FILE" -o cargo-c-windows-msvc.zip
28+
powershell -Command "Expand-Archive -Path cargo-c-windows-msvc.zip -DestinationPath $env:USERPROFILE\\.cargo\\bin -Force"
29+
30+
- name: Build rusts-ffi
31+
run: |
32+
cargo cinstall --locked --target x86_64-pc-windows-msvc --features cert_compression --release --prefix dist
33+
34+
- name: Upload binaries
35+
uses: actions/upload-artifact@v4
36+
with:
37+
name: rustls-ffi-x86_64-windows
38+
path: dist
39+
40+
linux-binaries:
41+
name: Linux (x86_64 GNU)
42+
runs-on: ubuntu-20.04 # x86_64. Using older Ubuntu for greater GLIBC compat.
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
persist-credentials: false
47+
48+
- name: Install stable Rust
49+
uses: dtolnay/rust-toolchain@stable
50+
51+
- name: Install cargo-c
52+
env:
53+
LINK: https://github.com/lu-zero/cargo-c/releases/latest/download
54+
CARGO_C_FILE: cargo-c-x86_64-unknown-linux-musl.tar.gz
55+
run: |
56+
curl -L $LINK/$CARGO_C_FILE | tar xz -C ~/.cargo/bin
57+
58+
- name: Build rusts-ffi
59+
# The Ubuntu 20.04 GCC is too old to build aws-lc.
60+
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95189.
61+
env:
62+
CC: clang
63+
CXX: clang
64+
run: |
65+
cargo cinstall --locked --target x86_64-unknown-linux-gnu --features cert_compression --release --prefix dist
66+
67+
- name: Upload binaries
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: rustls-ffi-x86_64-linux-gnu
71+
path: dist
72+
73+
macos-binaries:
74+
name: MacOS (Arm64 and x86_64)
75+
runs-on: macos-14 # arm64.
76+
steps:
77+
- uses: actions/checkout@v4
78+
with:
79+
persist-credentials: false
80+
81+
- name: Install stable Rust
82+
uses: dtolnay/rust-toolchain@stable
83+
with:
84+
# Install both the arm64 and x86_64 targets.
85+
targets: aarch64-apple-darwin, x86_64-apple-darwin
86+
87+
- name: Install cargo-c
88+
env:
89+
LINK: https://github.com/lu-zero/cargo-c/releases/latest/download
90+
CARGO_C_FILE: cargo-c-macos.zip
91+
run: |
92+
curl -L $LINK/$CARGO_C_FILE -o cargo-c-macos.zip
93+
unzip cargo-c-macos.zip -d ~/.cargo/bin
94+
95+
- name: Build rusts-ffi (arm64)
96+
run: |
97+
cargo cinstall --target aarch64-apple-darwin --locked --features cert_compression --release --prefix arm64-dist
98+
99+
- name: Fix rpath (arm64)
100+
run: |
101+
install_name_tool -id @rpath/librustls.dylib arm64-dist/lib/librustls.dylib
102+
103+
- name: Upload binaries (arm64)
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: rustls-ffi-arm64-macos
107+
path: arm64-dist
108+
109+
- name: Build rusts-ffi (x86_64)
110+
run: |
111+
cargo cinstall --target x86_64-apple-darwin --locked --features cert_compression --release --prefix x86-dist
112+
113+
- name: Fix rpath (x86_64)
114+
run: |
115+
install_name_tool -id @rpath/librustls.dylib x86-dist/lib/librustls.dylib
116+
117+
- name: Upload binaries (x86_64)
118+
uses: actions/upload-artifact@v4
119+
with:
120+
name: rustls-ffi-x86_64-macos
121+
path: x86-dist

0 commit comments

Comments
 (0)