-
Notifications
You must be signed in to change notification settings - Fork 40
151 lines (123 loc) · 3.93 KB
/
build-test.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
name: Unit-Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main, release* ]
jobs:
preflight-check:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Check format of all commit messages
run: ./internal/scripts/ci_test_commit_msg.sh
- name: Check license header
run: ./internal/scripts/ci_test_spdx_license_header.sh
windows-stable:
needs: preflight-check
timeout-minutes: 10
runs-on: windows-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Prepare system
run: |
mkdir "C:\Temp\iceoryx2\services"
mkdir "C:\Temp\iceoryx2\tests"
mkdir "C:\Temp\iceoryx2\shm"
icacls "C:\Temp" /t /c /grant Everyone:F
- name: Run cargo fmt
run: cargo fmt --all -- --check
- name: Run cargo clippy
run: cargo clippy -- -D warnings
- name: Run cargo build
run: cargo build --workspace --all-targets
- name: Run cargo test
run: cargo test --workspace --no-fail-fast
windows-min-version:
needs: preflight-check
timeout-minutes: 10
runs-on: windows-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: 1.70.0
components: rustfmt, clippy
- name: Prepare system
run: |
mkdir "C:\Temp\iceoryx2\services"
mkdir "C:\Temp\iceoryx2\tests"
mkdir "C:\Temp\iceoryx2\shm"
icacls "C:\Temp" /t /c /grant Everyone:F
- name: Run cargo build
run: cargo build --workspace --all-targets
- name: Run cargo test
run: cargo test --workspace --no-fail-fast
grcov:
needs: preflight-check
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and cache grcov
uses: ./.github/actions/build-and-cache-rust-tool
with:
rust-toolchain: stable
rust-components: llvm-tools-preview
check-and-install-cmd: grcov --version > /dev/null || cargo install grcov
print-version-cmd: grcov --version
cache-key: cache-1-${{ runner.os }}-grcov
artifact-path: ~/.cargo/bin/grcov
artifact-name: ${{ runner.os }}-grcov
coverage:
needs: grcov
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get -y install libacl1-dev llvm
- name: Create test users and groups
run: |
sudo useradd testuser1
sudo useradd testuser2
sudo groupadd testgroup1
sudo groupadd testgroup2
- name: Setup Rust
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
components: llvm-tools-preview
- name: Download artifact grcov
uses: actions/download-artifact@v3
with:
name: ${{ runner.os }}-grcov
path: ~/.cargo/bin
- name: Make grcov artifacts executable
run: chmod +x ~/.cargo/bin/grcov
- name: Generate raw coverage results
run: ./internal/scripts/generate-cov-report.sh --generate
- name: Generate coverage results for html artifacts
run: ./internal/scripts/generate-cov-report.sh --html
- name: Archive coverage-html artifacts
uses: actions/upload-artifact@v3
with:
name: coverage-html
path: target/debug/coverage/html/*
retention-days: 90
- name: Generate coverage report for Codecov
run: ./internal/scripts/generate-cov-report.sh --lcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: target/debug/coverage/lcov.info
fail_ci_if_error: true