-
-
Notifications
You must be signed in to change notification settings - Fork 41
137 lines (123 loc) · 3.92 KB
/
rust.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Rust
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: 🏗️ Setup build cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-release-
- name: 🚚 Install dependencies (repro-env)
run: |
wget 'https://github.com/kpcyrd/repro-env/releases/download/v0.3.2/repro-env'
echo '660995089d32178a63763cf47e1b97e265ef5cf24bf646d16728ca51bf2fab50 repro-env' | sha256sum -c -
sudo install -m755 repro-env -t /usr/bin
- name: 🛠️ Build
run: make
- name: Print sha256 of binary
run: sha256sum target/x86_64-unknown-linux-musl/release/rshijack
- name: 📦 Upload binary
uses: actions/upload-artifact@v4
with:
name: bin
path: target/x86_64-unknown-linux-musl/release/rshijack
cross:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch:
- name: x86_64-unknown-linux-gnu
- name: x86_64-unknown-linux-musl
- name: i686-unknown-linux-gnu
binutils: i686-linux-gnu
- name: armv7-unknown-linux-gnueabihf
binutils: arm-linux-gnueabihf
- name: aarch64-unknown-linux-gnu
binutils: aarch64-linux-gnu
- name: aarch64-unknown-linux-musl
binutils: aarch64-linux-gnu
- name: riscv64gc-unknown-linux-gnu
binutils: riscv64-linux-gnu
unstripped: true
- name: powerpc64le-unknown-linux-gnu
binutils: powerpc64le-linux-gnu
- name: s390x-unknown-linux-gnu
binutils: s390x-linux-gnu
steps:
- name: Install binutils
run: |
sudo apt-get update
sudo apt-get install -y binutils-${{ matrix.arch.binutils }}
if: matrix.arch.binutils
- uses: actions/checkout@v4
- name: 🏗️ Setup build cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ matrix.arch.name }}-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-${{ matrix.arch.name }}-release-
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.arch.name }}
override: true
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --target ${{ matrix.arch.name }} --release
- name: Stripping binary
run: /usr/${{ matrix.arch.binutils }}/bin/strip target/${{ matrix.arch.name }}/release/rshijack
if: "${{ contains(matrix.arch.name, 'linux') && !matrix.arch.unstripped }}"
- uses: actions/upload-artifact@v4
with:
name: rshijack-${{ matrix.arch.name }}
path: target/${{ matrix.arch.name }}/release/rshijack
unit-test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-24.04]
steps:
- uses: actions/checkout@v4
- name: Set up cargo cache
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-debug-
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test --verbose
fmt:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run cargo fmt
run: cargo fmt --all -- --check