-
Notifications
You must be signed in to change notification settings - Fork 0
177 lines (171 loc) · 5.85 KB
/
act_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
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
name: Build (helper)
permissions:
contents: read
on:
workflow_call:
env:
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_DEBUG: 0
CARGO_TERM_COLOR: always
PAKETKOLL_BUILDER: github-ci
RUST_BACKTRACE: 1
CC: clang
RUSTFLAGS: "-D warnings"
RUSTUP_MAX_RETRIES: 10
jobs:
modern-default:
# Test modern compilers on standard platforms on Linux.
name: "${{ matrix.target }} - ${{ matrix.rust }} (default configuration)"
runs-on: ubuntu-latest
env:
CARGO_PROFILE_DEV_DEBUG: 1
CARGO_PROFILE_DEV_SPLIT_DEBUGINFO: ${{ matrix.debug_info }}
RUSTFLAGS: -D warnings -Clink-arg=-Wl,--compress-debug-sections=zlib
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv7-unknown-linux-gnueabihf
- armv7-unknown-linux-musleabihf
- i686-unknown-linux-gnu
- i686-unknown-linux-musl
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
rust:
- stable
- nightly
debug_info:
- packed
include:
# RISCV doesn't work with split debug info (see rust-lang/rust#110224)
- target: riscv64gc-unknown-linux-gnu
rust: stable
debug_info: off
- target: riscv64gc-unknown-linux-gnu
rust: nightly
debug_info: off
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Print environment info
run: |
echo "# Rust"
rustc -Vv
echo "# Cargo"
cargo -Vv
echo "# GCC"
gcc -v
echo "# Clang"
clang -v
echo "# Ld"
ld -v
- name: Install cross
uses: taiki-e/install-action@cross
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.7
with:
key: ${{ matrix.target }}-${{ matrix.rust }}
- name: Cross compile binary
run: cross build --locked --target ${{ matrix.target }} --verbose
- name: Cross compile tests
run: cross test --no-run --locked --target ${{ matrix.target }} --verbose
- name: Cross test
run: cross test --locked --target ${{ matrix.target }} --verbose
- name: Compress binary
if: matrix.rust == 'stable' && contains(matrix.target, 'musl')
run: |
mkdir paketkoll
cp target/${{ matrix.target }}/debug/paketkoll paketkoll/
cp target/${{ matrix.target }}/debug/konfigkoll paketkoll/
if [[ -f target/${{ matrix.target }}/debug/paketkoll.dwp ]]; then
# No split debug info for RISCV
cp target/${{ matrix.target }}/debug/paketkoll.dwp paketkoll/
fi
if [[ -f target/${{ matrix.target }}/debug/konfigkoll.dwp ]]; then
# No split debug info for RISCV
cp target/${{ matrix.target }}/debug/konfigkoll.dwp paketkoll/
fi
tar cf paketkoll.tar paketkoll
zstd -T0 -6 paketkoll.tar
- uses: actions/upload-artifact@v4
if: matrix.rust == 'stable' && contains(matrix.target, 'musl')
with:
name: paketkoll_${{ matrix.target }}.tar.zst
path: paketkoll.tar.zst
retention-days: 7
- name: Clean up temporary items
run: |
rm -rf paketkoll paketkoll.tar paketkoll.tar.zst
configurations:
# Test non-standard configurations, MSRV and Rust versions
name: "Test: \"${{ matrix.features }}\" (Linux), Rust ${{ matrix.rust }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
features:
- --no-default-features --features=arch_linux
- --no-default-features --features=debian
- --all-features
rust:
- 1.81.0
- stable
include:
# MSRV with default features too
- features:
rust: 1.81.0
# Nightly will all features
- features: --all-features
rust: nightly
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Get cargo-binstall
run: |
curl -L https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz | tar -zxf - && mv cargo-binstall $HOME/.cargo/bin/
- name: Install required cargo addons
run: cargo binstall --no-confirm --no-symlinks cargo-hakari
- name: Disable cargo workspace hack (to properly test features)
run: cargo hakari disable
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.7
- name: Compile
run: cargo test --locked ${{ matrix.features }} --verbose --no-run
- name: Test
run: cargo test --locked ${{ matrix.features }} --verbose
env:
# Warnings are ok for now here due to private APIs that will be public in the future.
RUSTFLAGS: ""
integration:
name: "Integration tests"
runs-on: ubuntu-24.04
needs: modern-default
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/download-artifact@v4
with:
name: paketkoll_x86_64-unknown-linux-musl.tar.zst
- name: Unpack binaries
run: |
tar xf ${GITHUB_WORKSPACE}/paketkoll.tar.zst
mkdir -p target/debug
mv paketkoll/* target/debug/
- name: Install podman
run: |
sudo apt-get update
sudo apt-get install -y podman
podman --version
- name: Run integration tests
run: |-
cd integration_tests
./run_tests.sh