-
Notifications
You must be signed in to change notification settings - Fork 14
157 lines (140 loc) · 5.14 KB
/
coverage.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
name: Coverage
on:
push:
branches: [coverage]
tags:
- "**"
pull_request:
branches: [coverage]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
generate_coverage:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: ilammy/setup-nasm@13cbeb366c45c4379d3478cdcbadd8295feb5028 # v1.5.1
- name: Checkout sources
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: recursive
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@82fd451e4380968e8336eefc5b8b9292a619de01 # v2.0.3
with:
version: "14.0"
directory: ${{ runner.temp }}/llvm
- name: Install toolchain
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af # v1.0.7
with:
profile: minimal
toolchain: nightly-2023-12-31
override: true
components: rust-src, rustfmt, clippy, llvm-tools-preview
- name: Run cargo install grcov
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: install
args: grcov
- name: Cache
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
- name: Check code
run: |
./sh_script/build.sh -c
- name: Install AFL (Linux)
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: install
args: --force --version 0.12.12 afl
if: runner.os == 'Linux'
- name: Install Cargo-Fuzz (Linux)
uses: actions-rs/cargo@844f36862e911db73fe0815f00a4a2602c279505 # v1.0.3
with:
command: install
args: cargo-fuzz
if: runner.os == 'Linux'
- name: set core_pattern for core
run: |
sudo su - root <<EOF
echo core >/proc/sys/kernel/core_pattern
pushd /sys/devices/system/cpu
echo performance | tee cpu*/cpufreq/scaling_governor
popd
exit
EOF
if: runner.os == 'Linux'
- name: cargo build
env:
LLVM_PROFILE_FILE: build-%p-%m.profraw
RUSTFLAGS: "-C instrument-coverage"
CC_x86_64_unknown_none: clang
AR_x86_64_unknown_none: llvm-ar
RUN_REQUESTER_FEATURES: "spdm-ring"
RUN_RESPONDER_FEATURES: "spdm-ring"
run: |
./sh_script/build.sh -r
- name: cargo build hashed-transcript-data
env:
LLVM_PROFILE_FILE: build-hashed-transcript-data-%p-%m.profraw
RUSTFLAGS: "-C instrument-coverage"
CC_x86_64_unknown_none: clang
AR_x86_64_unknown_none: llvm-ar
RUN_REQUESTER_FEATURES: "spdm-ring,hashed-transcript-data,async-executor"
RUN_RESPONDER_FEATURES: "spdm-ring,hashed-transcript-data,async-executor"
run: |
./sh_script/build.sh -r
- name: cargo build spdm-mbedtls
env:
LLVM_PROFILE_FILE: build-hashed-transcript-data-%p-%m.profraw
RUSTFLAGS: "-C instrument-coverage"
CC_x86_64_unknown_none: clang
AR_x86_64_unknown_none: llvm-ar
RUN_REQUESTER_FEATURES: "spdm-mbedtls,async-executor"
RUN_RESPONDER_FEATURES: "spdm-mbedtls,async-executor"
run: |
./sh_script/build.sh -r
- name: cargo build mbedtls hashed-transcript-data
env:
LLVM_PROFILE_FILE: build-hashed-transcript-data-%p-%m.profraw
RUSTFLAGS: "-C instrument-coverage"
CC_x86_64_unknown_none: clang
AR_x86_64_unknown_none: llvm-ar
RUN_REQUESTER_FEATURES: "spdm-mbedtls,hashed-transcript-data,async-executor"
RUN_RESPONDER_FEATURES: "spdm-mbedtls,hashed-transcript-data,async-executor"
run: |
./sh_script/build.sh -r
- name: Run fuzz hash-transcript-data
env:
FUZZ_HASH_TRANSCRIPT_DATA_FEATURE: true
run: |
./sh_script/fuzz_run.sh -c Scoverage
- name: Run fuzz
env:
FUZZ_HASH_TRANSCRIPT_DATA_FEATURE: false
run: |
./sh_script/fuzz_run.sh -c Scoverage
- name: Run tests and collect coverage
run: |
grcov $(find . -name "*.profraw") \
--branch \
--binary-path ./target/debug/ \
-s . \
-t html \
--ignore-not-existing \
-o coverage
grcov $(find . -name "*.profraw") \
--branch \
--binary-path ./target/debug/ \
-s . \
-t lcov \
--ignore-not-existing \
-o coverage/lcov.info
- uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: coverage_data-${{ github.sha }}
path: coverage/
- name: Upload coverage reports to Codecov with GitHub Action
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0
with:
files: coverage/lcov.info
fail_ci_if_error: false
verbose: true