@@ -10,125 +10,95 @@ permissions:
1010 packages : write
1111
1212jobs :
13- build :
14- name : Build
15- runs-on : ${{ matrix.os }}
13+ linux-build :
14+ name : Build (Linux)
15+ runs-on : ubuntu-latest
16+ container : ${{ matrix.container && fromJSON(format('{{"image":"{0}","options":"--user root"}}', matrix.container)) }}
1617
1718 strategy :
1819 matrix :
1920 include :
2021
21- # linux
2222 - build : linux-64-gnu
23- os : ubuntu-22.04
2423 target : x86_64-unknown-linux-gnu
25- sys-type : linux
24+ container : debian:buster
2625 package-deb : yes
2726
2827 - build : linux-aarch64-gnu
29- os : ubuntu-22.04
3028 target : aarch64-unknown-linux-gnu
31- sys-type : linux
29+ container : debian:buster
3230 package-deb : yes
3331
3432 - build : linux-i686-gnu
35- os : ubuntu-22.04
3633 target : i686-unknown-linux-gnu
37- sys-type : linux
34+ container : debian:buster
3835 package-deb : yes
3936
4037 - build : linux-armv7-gnueabihf
41- os : ubuntu-22.04
4238 target : armv7-unknown-linux-gnueabihf
43- sys-type : linux
44- package-deb : no
39+ container : debian:buster
40+ package-deb : yes
4541
4642 - build : linux-64-musl
47- os : ubuntu-24.04
4843 target : x86_64-unknown-linux-musl
49- sys-type : linux
50- package-deb : no
51-
52- # win
53- - build : windows
54- os : windows-latest
55- target : i686-pc-windows-msvc
56- sys-type : windows
57- package-deb : no
58-
59- - build : windows
60- os : windows-latest
61- target : x86_64-pc-windows-msvc
62- sys-type : windows
63- package-deb : no
64-
65- # mac
66- - build : mac-os-64
67- os : macos-latest
68- target : x86_64-apple-darwin
69- sys-type : mac
44+ container : clux/muslrust:stable
7045 package-deb : no
7146
7247 steps :
7348 - name : Checkout
7449 uses : actions/checkout@v4
7550
51+ - name : Fix apt sources (for EOL Debian)
52+ if : matrix.container == 'debian:buster'
53+ run : |
54+ sed -i 's|deb.debian.org|archive.debian.org|g' /etc/apt/sources.list
55+ sed -i 's|security.debian.org|archive.debian.org|g' /etc/apt/sources.list
56+ echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid
57+
58+ - name : Install system dependencies
59+ run : |
60+ apt-get update
61+ apt-get install -y curl ca-certificates build-essential pkg-config libssl-dev git
62+
7663 - name : Install Rust
7764 uses : dtolnay/rust-toolchain@stable
7865 with :
7966 targets : ${{ matrix.target }}
8067
8168 - name : Install linux needed deps
82- if : matrix.sys-type == 'linux'
8369 shell : bash
8470 run : |
8571 if [ "${{ matrix.build }}" = "linux-aarch64-gnu" ]; then
86- sudo apt-get install -y gcc-aarch64-linux-gnu
72+ apt-get install -y gcc-aarch64-linux-gnu
8773 elif [ "${{ matrix.build }}" = "linux-i686-gnu" ]; then
88- sudo apt-get install -y gcc-multilib
74+ apt-get install -y gcc-multilib
8975 elif [ "${{ matrix.build }}" = "linux-armv7-gnueabihf" ]; then
90- sudo apt-get install -y gcc-arm-linux-gnueabihf
76+ apt-get install -y gcc-arm-linux-gnueabihf
9177 elif [ "${{ matrix.build }}" = "linux-64-musl" ]; then
92- sudo apt-get install -y musl-tools
78+ apt-get install -y musl-tools
9379 fi
9480
95- - name : Install cargo deb packager
96- if : matrix.package-deb == 'yes'
97- shell : bash
98- run : cargo install cargo-deb
99-
10081 - name : Running cargo build
10182 shell : bash
10283 run : |
10384 if [ "${{ matrix.package-deb }}" = "yes" ]; then
85+ cargo install cargo-deb
10486 cargo deb -v --output=target/debian/librespeed-rs-${{ matrix.target }}.deb --target=${{ matrix.target }}
10587 else
10688 cargo build --release --target ${{ matrix.target }}
10789 fi
10890
109- # - name: Build
110- # uses: actions-rs/cargo@v1
111- # with:
112- # use-cross: true
113- # command: build
114- # args: --verbose --release --target ${{ matrix.target }}
115-
11691 - name : Make artifact folder
11792 shell : bash
11893 run : |
11994 binary_name="librespeed-rs"
120-
12195 dirname="$binary_name-${{ matrix.target }}"
12296 mkdir "$dirname"
123- if [ "${{ matrix.os }}" = "windows-latest" ]; then
124- mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
125- else
126- mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
127- if [ "${{ matrix.package-deb }}" = "yes" ]; then
128- deb_dirname="deb-$dirname"
129- mkdir "$deb_dirname"
130- mv "target/debian/librespeed-rs-${{ matrix.target }}.deb" "$deb_dirname"
131- fi
97+ mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
98+ if [ "${{ matrix.package-deb }}" = "yes" ]; then
99+ deb_dirname="deb-$dirname"
100+ mkdir "$deb_dirname"
101+ mv "target/debian/librespeed-rs-${{ matrix.target }}.deb" "$deb_dirname"
132102 fi
133103
134104 - name : Upload artifacts
@@ -139,18 +109,53 @@ jobs:
139109 path : librespeed-rs-${{ matrix.target }}
140110
141111 - name : Upload deb artifacts
142- if : matrix.package-deb == 'yes'
112+ if : matrix.package-deb == 'yes'
143113 uses : actions/upload-artifact@v4
144114 with :
145115 overwrite : true
146116 name : deb-librespeed-rs-${{ matrix.target }}
147117 path : deb-librespeed-rs-${{ matrix.target }}
148118
119+ other-build :
120+ name : Build (Windows + macOS)
121+ runs-on : ${{ matrix.os }}
122+ strategy :
123+ matrix :
124+ include :
125+ - os : windows-latest
126+ target : i686-pc-windows-msvc
127+ - os : windows-latest
128+ target : x86_64-pc-windows-msvc
129+ - os : macos-latest
130+ target : x86_64-apple-darwin
131+
132+ steps :
133+ - uses : actions/checkout@v4
134+ - uses : dtolnay/rust-toolchain@stable
135+ with :
136+ targets : ${{ matrix.target }}
137+ - run : cargo build --release --target ${{ matrix.target }}
138+ - name : Make artifact
139+ shell : bash
140+ run : |
141+ name="librespeed-rs"
142+ dir="${name}-${{ matrix.target }}"
143+ mkdir "$dir"
144+ if [ "${{ matrix.os }}" = "windows-latest" ]; then
145+ mv "target/${{ matrix.target }}/release/$name.exe" "$dir/"
146+ else
147+ mv "target/${{ matrix.target }}/release/$name" "$dir/"
148+ fi
149+ - uses : actions/upload-artifact@v4
150+ with :
151+ overwrite : true
152+ name : librespeed-rs-${{ matrix.target }}
153+ path : librespeed-rs-${{ matrix.target }}
154+
149155 container-build-push :
150156 name : Build and push Container image
151157 runs-on : ubuntu-latest
152- needs : build
153-
158+ needs : [linux-build, other-build]
154159 steps :
155160 - name : Checkout code
156161 uses : actions/checkout@v4
@@ -206,9 +211,8 @@ jobs:
206211 file : ./Containerfile
207212 platforms : linux/amd64,linux/arm64,linux/arm/v7
208213
209-
210214 release :
211- needs : [build]
215+ needs : [linux-build, other- build]
212216 name : Publish release
213217 runs-on : ubuntu-latest
214218 steps :
0 commit comments