-
Notifications
You must be signed in to change notification settings - Fork 79
134 lines (128 loc) · 4.96 KB
/
ci.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
name: Continuous integration
on:
push:
env:
RUSTFLAGS: -Dwarnings
jobs:
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checking out
uses: actions/checkout@v2
- name: Running rustfmt
uses: ./.github/actions/rust-cargo-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
command: fmt
args: -- --check
components: rustfmt
check-clippy:
runs-on: ubuntu-latest
steps:
- name: Checking out
uses: actions/checkout@v2
- name: Running clippy
uses: ./.github/actions/rust-cargo-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
command: clippy
args: --all --all-targets
components: clippy
test:
runs-on: ubuntu-latest
steps:
- name: Checking out
uses: actions/checkout@v2
- name: Running tests
uses: ./.github/actions/rust-cargo-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
command: test
args: --all
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_INCREMENTAL: 0
CACHE_SKIP_SAVE: ${{ matrix.push == '' || matrix.push == 'false' }}
strategy:
matrix:
network: [ 'mainnet', 'caterpillarnet', 'butterflynet', 'calibrationnet', 'devnet', 'testing', 'testing-fake-proofs' ]
steps:
- name: Checking out
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: ./.github/actions/rust-cargo-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
command: version
- name: Writing bundle
env:
BUILD_FIL_NETWORK: ${{ matrix.network }}
run: |
cargo run -- -o output/builtin-actors.car
coverage:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_INCREMENTAL: 0
CACHE_SKIP_SAVE: ${{ matrix.push == '' || matrix.push == 'false' }}
steps:
- name: Checking out
uses: actions/checkout@v2
- name: Install Rust toolchain
uses: ./.github/actions/rust-cargo-run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
command: version
components: llvm-tools-preview
- name: Put LLVM tools into the PATH
run: echo "${HOME}/.rustup/toolchains/$(cat rust-toolchain)-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin" >> $GITHUB_PATH
- name: Install demangler
run: cargo install rustfilt
- name: Create coverage report
env:
# Incremental build is not supported when profiling.
CARGO_INCREMENTAL: 0
# Make sure that each run of an executable creates a new profile file,
# with the default name they would override each other.
LLVM_PROFILE_FILE: "%m.profraw"
# -Cinstrument-coverage: enable llvm coverage instrumentation
# -Ccodegen-units=1: building in parallel is not supported when profiling
# -Copt-level=0: disable optimizations for more accurate coverage
# -Coverflow-checks=off: checking for overflow is not needed for coverage reporting
# -Cinline-threshold=0: do not inline
# For code coverage the `-Clink-dead-code` flag should be set, as dead
# code should be considered as not covered code. Though this would make
# the build fail, hence it is not set.
RUSTFLAGS: -Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Coverflow-checks=off -Cinline-threshold=0
run: cargo test --workspace --exclude fil_builtin_actors_bundle
- name: Merge profiling data
# Do *not* use sparse output. It leads to more lines that are not taken
# into account at all
run: llvm-profdata merge --output=default.profdata $(find . -name '*.profraw')
- name: Create HTML coverage report
# The compiled files contain the coverage information. From running the
# tests we don't know what those files are called, hence use all files
# from the `./target/debug/deps` directory which don't have an extension.
run: |
OBJECT_OPTIONS=($(find ./target/debug/deps/* -name '*' -not -name '*\.*' -printf ' --object %p'))
# Create HTML report of this project, we don't care about coverage of
# dependencies
llvm-cov show --Xdemangler=rustfilt --show-expansions --show-line-counts-or-regions --ignore-filename-regex=".cargo|.rustup|/rustc|./tests/" --format=html --output-dir=./llvm-show --instr-profile=default.profdata ${OBJECT_OPTIONS[@]}
# Create file to be uploaded to codecov
llvm-cov export --ignore-filename-regex=".cargo|.rustup|/rustc|./tests" --format=lcov --instr-profile=default.profdata ${OBJECT_OPTIONS[@]} > lcov.info
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: code-coverage-report
path: llvm-show/*
- name: Upload coverage to Codecov
uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378 # v3.1.0
with:
files: lcov.info