forked from libseccomp-rs/libseccomp-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
201 lines (190 loc) · 5.87 KB
/
build-test.yaml
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: build-test
on:
push:
branches:
- main
pull_request:
types: [opened, reopened, edited, synchronize]
env:
msrv: 1.46
jobs:
validate:
name: Format and Lint Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install upstream libseccomp
run: sudo ./scripts/install_libseccomp.sh
- name: Prepare for rustfmt and clippy
run: rustup component add rustfmt clippy
- name: Run rustfmt
run: make fmt
- name: Run clippy
run: make clippy
test:
name: Unit Tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
libseccomp-version: [2.4.3, 2.5.1, 2.5.3]
env:
LIBSECCOMP_LINK_TYPE: dylib
LIBSECCOMP_LIB_PATH: /usr/local/libseccomp/lib
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install upstream libseccomp
run: |
install_dir=$(dirname ${{ env.LIBSECCOMP_LIB_PATH }})
sudo ./scripts/install_libseccomp.sh -v ${{ matrix.libseccomp-version }} -i ${install_dir}
echo "LD_LIBRARY_PATH=${{ env.LIBSECCOMP_LIB_PATH }}" >> $GITHUB_ENV
- name: Build crate
run: make debug
- name: Build crate with all features
run: |
make clean
make debug-all
- name: Run test
run: make test
static-link-musl:
name: Statically Linking with musl
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
libseccomp-version: [2.4.3, 2.5.1, 2.5.3]
target:
- x86_64-unknown-linux-musl
env:
LIBSECCOMP_LINK_TYPE: static
LIBSECCOMP_LIB_PATH: /usr/local/libseccomp-musl/lib
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Rust toolchain
run: rustup target add ${{ matrix.target }}
- name: Install musl gcc
run: sudo apt-get install musl-tools
- name: Install upstream libseccomp
run: |
install_dir=$(dirname ${{ env.LIBSECCOMP_LIB_PATH }})
sudo ./scripts/install_libseccomp.sh -m -v ${{ matrix.libseccomp-version }} -i ${install_dir}
- name: Build crate
run: cargo build --target ${{ matrix.target }}
- name: Run test
run: cargo test --target ${{ matrix.target }} -- --nocapture --test-threads 1
- name: Build crate with all features
run: |
cargo clean
cargo build --target ${{ matrix.target }} --all-features
- name: Run test
run: cargo test --target ${{ matrix.target }} --all-features -- --nocapture --test-threads 1
cross:
name: Cross Compilation
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- i686-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- arm-unknown-linux-gnueabihf
- mips-unknown-linux-gnu
- mips64-unknown-linux-gnuabi64
- powerpc-unknown-linux-gnu
- powerpc64-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
- s390x-unknown-linux-gnu
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install libseccomp
run: sudo apt-get install libseccomp-dev
- name: Install Rust toolchain
run: rustup target add ${{ matrix.target }}
- name: Build crate
run: cargo build --target ${{ matrix.target }} --all-features
msrv:
name: MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ env.msrv }}
run: rustup default ${{ env.msrv }}
- name: Install upstream libseccomp
run: sudo ./scripts/install_libseccomp.sh
- name: Build crate with all target and features
run: |
cargo -vV
cargo clean
cargo build --all-targets --all-features
- name: Run test
run: cargo test --all-targets --all-features -- --nocapture --test-threads 1
msrv_compat:
name: MSRV Compat
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust: [1.52, 1.53]
steps:
- uses: actions/checkout@v3
- name: Install Rust ${{ matrix.rust }}
run: rustup default ${{ matrix.rust }}
- name: Install upstream libseccomp
run: sudo ./scripts/install_libseccomp.sh
- name: Build crate with all target and features
run: |
cargo -vV
cargo clean
cargo build --all-targets --all-features
- name: Run test
run: cargo test --all-targets --all-features -- --nocapture --test-threads 1
doc:
name: Documentation Check
runs-on: ubuntu-latest
env:
RUSTDOCFLAGS: -Dwarnings
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate documentations
run: cargo doc --no-deps
codespell:
name: Check Spelling
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install codespell
run: pip install codespell
- name: Run codespell
run: codespell
readme:
name: Readme Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Verify that the libseccomp crate version is up to date in README
run: grep -q "$(sed -n 's/^version = \(.*\)/libseccomp = \1/p' libseccomp/Cargo.toml)" README.md
# coverage:
# name: Code Coverage
# runs-on: ubuntu-latest
# strategy:
# matrix:
# features:
# - all-features
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# - name: Install upstream libseccomp
# run: sudo ./scripts/install_libseccomp.sh
# - name: Run cargo tarpaulin
# uses: actions-rs/[email protected]
# with:
# args: '--${{ matrix.features }} -- --test-threads 1'
# - name: Upload to codecov.io
# uses: codecov/codecov-action@v3