-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (93 loc) · 2.91 KB
/
rust-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Build
on:
push:
branches:
- "*"
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: true
SCCACHE_CACHE_SIZE: 2G
SCCACHE_DIR: /home/runner/.cache/sccache
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Tier 1 Platforms
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
artifact_name: bping
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact_name: bping.exe
- target: x86_64-apple-darwin
os: macos-latest
artifact_name: bping
- target: i686-pc-windows-msvc
os: windows-latest
artifact_name: bping.exe
- target: i686-unknown-linux-gnu
os: ubuntu-latest
artifact_name: bping
# Tier 2 Platforms
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
artifact_name: bping
- target: aarch64-apple-darwin
os: macos-latest
artifact_name: bping
- target: arm-unknown-linux-gnueabi
os: ubuntu-latest
artifact_name: bping
- target: armv7-unknown-linux-gnueabihf
os: ubuntu-latest
artifact_name: bping
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
artifact_name: bping
steps:
- uses: actions/checkout@v4
- name: Install build dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y curl build-essential pkg-config libssl-dev
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Configure sccache
run: |
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "v1-rust"
shared-key: "${{ matrix.target }}-build"
cache-targets: "true"
cache-on-failure: "true"
cache-all-crates: "true"
save-if: ${{ github.ref == 'refs/heads/master' }}
workspaces: |
. -> target
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.target }}
- name: Show sccache stats
run: sccache --show-stats
# Optional: Upload artifacts if needed
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}-binary
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}