-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (117 loc) · 4 KB
/
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
name: Build
permissions:
contents: read
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
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
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Install cross
uses: taiki-e/install-action@cross
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.3
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' && matrix.target != 'x86_64-pc-windows-gnu'
run: |
mkdir paketkoll
cp target/${{ matrix.target }}/debug/paketkoll 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
tar cf paketkoll.tar paketkoll
zstd -T0 -6 paketkoll.tar
- uses: actions/upload-artifact@v4
if: matrix.rust == 'stable' && matrix.target != 'x86_64-pc-windows-gnu'
with:
name: paketkoll_${{ matrix.target }}.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
rust:
- 1.76.0
- stable
include:
# MSRV with default features too
- features:
rust: 1.76.0
steps:
- uses: actions/checkout@v4
- name: Install Rust
run: rustup install --profile minimal ${{ matrix.rust }} && rustup default ${{ matrix.rust }}
- name: Cache builds
uses: Swatinem/rust-cache@v2.7.3
- 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: ""