-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (126 loc) · 4.95 KB
/
build.yml
File metadata and controls
151 lines (126 loc) · 4.95 KB
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
---
name: Build
on:
push:
branches:
- master
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
jobs:
build:
name: Build
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- name: Check out
uses: actions/checkout@v6
- name: Install system dependencies
run: sudo apt-get update && sudo apt-get install -y libdw-dev libsystemd-dev
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check Markdown
uses: DavidAnson/markdownlint-cli2-action@v23
- name: Run Clippy
run: cargo clippy --all-targets --all-features
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
- name: Install coverage tooling
run: rustup component add llvm-tools-preview
- name: Build instrumented binaries for E2E coverage
run: |
RUSTFLAGS='-C instrument-coverage' \
cargo build --all-features --workspace --bins --examples
- name: Run coverage tests
run: |
mkdir -p target/coverage
RUSTFLAGS='-C instrument-coverage' \
LLVM_PROFILE_FILE='target/coverage/ptools-%p-%m.profraw' \
cargo test --all-features --workspace --tests --bins
- name: Report coverage
shell: bash
run: |
host_target=$(rustc -vV | awk '/host:/ {print $2}')
llvm_bin="$(rustc --print sysroot)/lib/rustlib/${host_target}/bin"
"${llvm_bin}/llvm-profdata" merge -sparse target/coverage/*.profraw -o target/coverage/ptools.profdata
"${llvm_bin}/llvm-cov" report \
--ignore-filename-regex='/(\.cargo/registry|rustc)/' \
--instr-profile=target/coverage/ptools.profdata \
target/debug/pargs --object target/debug/pauxv --object target/debug/pcred \
--object target/debug/penv \
--object target/debug/pfiles --object target/debug/plgrp --object target/debug/plimit \
--object target/debug/prun \
--object target/debug/psig --object target/debug/pstack --object target/debug/pstop \
--object target/debug/ptime --object target/debug/ptree \
--object target/debug/pwait
build-i686:
name: Build (i686)
runs-on: ubuntu-24.04
permissions:
contents: read
env:
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig
CARGO_BUILD_TARGET: i686-unknown-linux-gnu
steps:
- name: Check out
uses: actions/checkout@v6
- name: Install i686 cross-compilation dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib libdw-dev:i386 libsystemd-dev:i386
- name: Install Rust i686 target
run: rustup target add i686-unknown-linux-gnu
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check Markdown
uses: DavidAnson/markdownlint-cli2-action@v22
- name: Run Clippy
run: cargo clippy --all-targets --all-features
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test --verbose
- name: Install coverage tooling
run: rustup component add llvm-tools-preview
- name: Build instrumented binaries for E2E coverage
run: |
RUSTFLAGS='-C instrument-coverage' \
cargo build --all-features --workspace --bins --examples
- name: Run coverage tests
run: |
mkdir -p target/coverage
RUSTFLAGS='-C instrument-coverage' \
LLVM_PROFILE_FILE='target/coverage/ptools-%p-%m.profraw' \
cargo test --all-features --workspace --tests --bins
- name: Report coverage
shell: bash
run: |
target_dir="target/i686-unknown-linux-gnu/debug"
host_target=$(rustc -vV | awk '/host:/ {print $2}')
llvm_bin="$(rustc --print sysroot)/lib/rustlib/${host_target}/bin"
"${llvm_bin}/llvm-profdata" merge -sparse target/coverage/*.profraw -o target/coverage/ptools.profdata
"${llvm_bin}/llvm-cov" report \
--ignore-filename-regex='/(\.cargo/registry|rustc)/' \
--instr-profile=target/coverage/ptools.profdata \
"${target_dir}/pargs" --object "${target_dir}/pauxv" --object "${target_dir}/pcred" \
--object "${target_dir}/penv" \
--object "${target_dir}/pfiles" --object "${target_dir}/plgrp" --object "${target_dir}/plimit" \
--object "${target_dir}/prun" \
--object "${target_dir}/psig" --object "${target_dir}/pstack" --object "${target_dir}/pstop" \
--object "${target_dir}/ptime" --object "${target_dir}/ptree" \
--object "${target_dir}/pwait"