-
Notifications
You must be signed in to change notification settings - Fork 13
297 lines (245 loc) · 9.89 KB
/
unbundled-lint-and-test.yaml
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# ********************************************************************************
# Copyright (c) 2024 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************/
name: Lint and Test - Unbundled
env:
VSOMEIP_RELEASE_URL: https://github.com/COVESA/vsomeip/archive/refs/tags/
VSOMEIP_RELEASE_TAG: 3.4.10.tar.gz
VSOMEIP_SOURCE_PATH: vsomeip-src
VSOMEIP_INSTALL_PATH: vsomeip-install
GENERIC_CPP_STDLIB_PATH: /usr/include/c++/11
ARCH_SPECIFIC_CPP_STDLIB_PATH: /usr/include/x86_64-linux-gnu/c++/11
on:
push:
branches: [ main ]
pull_request:
paths:
- ".github/**"
- "**/src/**"
- "**/Cargo.*"
workflow_call:
workflow_dispatch:
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
obtain_and_build_vsomeip:
runs-on: ubuntu-latest
outputs:
cache_key: ${{ steps.generate_cache_key.outputs.CACHE_KEY }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set environment variables
run: |
echo "VSOMEIP_SOURCE_TARBALL=${{ env.VSOMEIP_RELEASE_URL }}${{ env.VSOMEIP_RELEASE_TAG }}" >> $GITHUB_ENV
echo "VSOMEIP_SOURCE_PATH=${{ github.workspace }}/${{ env.VSOMEIP_SOURCE_PATH }}" >> $GITHUB_ENV
echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV
echo "VSOMEIP_SOURCE_PATH_WITH_WILDCARD=${{ github.workspace }}/${{ env.VSOMEIP_SOURCE_PATH }}/*" >> $GITHUB_ENV
- name: Print environment variables for debugging
run: |
echo "VSOMEIP_SOURCE_TARBALL: ${{ env.VSOMEIP_SOURCE_TARBALL }}"
echo "VSOMEIP_SOURCE_PATH: ${{ env.VSOMEIP_SOURCE_PATH }}"
echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}"
echo "VSOMEIP_SOURCE_PATH_WITH_WILDCARD: ${{ env.VSOMEIP_SOURCE_PATH_WITH_WILDCARD }}"
- name: Download tarball
run: |
wget -O vsomeip-source.tar.gz $VSOMEIP_SOURCE_TARBALL
ls -l
- name: Create destination directory
run: |
mkdir -p $VSOMEIP_SOURCE_PATH
ls -l
- name: Decompress tarball
run: |
tar --strip-components=1 -xzf vsomeip-source.tar.gz -C $VSOMEIP_SOURCE_PATH
ls -l
- name: Confirm decompressed
run: |
echo "Current working directory: $(pwd)"
echo "Contents of repository root:"
ls -l
echo "Contents of decompressed folder ($VSOMEIP_SOURCE_PATH):"
ls -l $VSOMEIP_SOURCE_PATH
- name: Generate cache key
run: echo "CACHE_KEY=${{ runner.os }}-vsomeip-${{ hashFiles(env.VSOMEIP_SOURCE_PATH_WITH_WILDCARD) }}" >> $GITHUB_ENV
- name: Set cache key output
id: generate_cache_key
run: echo "CACHE_KEY=${{ env.CACHE_KEY }}" >> $GITHUB_OUTPUT
- name: Cache vsomeip build
id: cache-vsomeip
uses: actions/cache@v3
with:
path: ${{ env.VSOMEIP_INSTALL_PATH }}
key: ${{ runner.os }}-vsomeip-${{ hashFiles(env.VSOMEIP_SOURCE_PATH_WITH_WILDCARD) }}
restore-keys: |
${{ runner.os }}-vsomeip-
- name: Install dependencies
if: steps.cache-vsomeip.outputs.cache-hit != 'true'
run: sudo apt-get install -y build-essential cmake libboost-all-dev
- name: Build vsomeip
if: steps.cache-vsomeip.outputs.cache-hit != 'true'
run: |
cd $VSOMEIP_SOURCE_PATH
cmake -Bbuild -DCMAKE_INSTALL_PREFIX=$VSOMEIP_INSTALL_PATH -DENABLE_SIGNAL_HANDLING=1 .
cmake --build build --target install
- name: Save vsomeip build to cache
if: steps.cache-vsomeip.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: ${{ env.VSOMEIP_INSTALL_PATH }}
key: ${{ runner.os }}-vsomeip-${{ hashFiles(env.VSOMEIP_SOURCE_PATH_WITH_WILDCARD) }}
lint:
name: Lint
needs: obtain_and_build_vsomeip
runs-on: ubuntu-latest
env:
CACHE_KEY: ${{ needs.obtain_and_build_vsomeip.outputs.cache_key }}
steps:
- uses: actions/checkout@v4
- name: Install C++ dependencies
run: sudo apt-get install -y build-essential cmake libboost-all-dev
- name: Set environment variables
run: |
echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV
- name: Print environment variables for debugging
run: |
echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}"
- name: Ensure vsomeip install path exists
run: |
mkdir -p ${{ env.VSOMEIP_INSTALL_PATH }}
ls -l
- name: Print cache_key
run: |
echo "cache_key: ${{ env.CACHE_KEY }}"
- name: Restore vsomeip build cache
uses: actions/cache@v3
with:
path: ${{ env.VSOMEIP_INSTALL_PATH }}
key: ${{ env.CACHE_KEY }}
restore-keys: |
${{ runner.os }}-vsomeip-
- name: Install stable toolchain
run: |
rustup show
rustup component add rustfmt clippy
- name: Build the project
working-directory: ${{github.workspace}}
run: cargo build --no-default-features
- name: cargo fmt
working-directory: ${{github.workspace}}
run: cargo fmt -- --check
- name: cargo clippy
working-directory: ${{github.workspace}}
run: cargo clippy --no-default-features --all-targets -- -W warnings -D warnings
test:
name: Test
needs: obtain_and_build_vsomeip
runs-on: ubuntu-latest
env:
CACHE_KEY: ${{ needs.obtain_and_build_vsomeip.outputs.cache_key }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install C++ dependencies
if: steps.cache-vsomeip.outputs.cache-hit != 'true'
run: sudo apt-get install -y build-essential cmake libboost-all-dev
- name: Set environment variables
run: |
echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}/lib" >> $GITHUB_ENV
- name: Print environment variables for debugging
run: |
echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}"
echo "LD_LIBRARY_PATH: ${{ env.LD_LIBRARY_PATH }}"
- name: Ensure vsomeip install path exists
run: |
mkdir -p ${{ env.VSOMEIP_INSTALL_PATH }}
ls -l
- name: Print cache_key
run: |
echo "cache_key: ${{ env.CACHE_KEY }}"
- name: Restore vsomeip build cache
uses: actions/cache@v3
with:
path: ${{ env.VSOMEIP_INSTALL_PATH }}
key: ${{ env.CACHE_KEY }}
restore-keys: |
${{ runner.os }}-vsomeip-
- name: Install dependencies
run: |
cargo install cargo-tarpaulin
- name: Show toolchain information
working-directory: ${{github.workspace}}
run: |
rustup toolchain list
cargo --version
- name: Run tests and report code coverage
run: |
# enable nightly features so that we can also include Doctests
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${VSOMEIP_INSTALL_PATH}/lib RUSTC_BOOTSTRAP=1 cargo tarpaulin --no-default-features -o xml -o lcov -o html --doc --tests -- --test-threads 1
- name: Upload coverage report (xml)
uses: actions/upload-artifact@v4
with:
name: Test Coverage Results (xml)
path: cobertura.xml
- name: Upload coverage report (lcov)
uses: actions/upload-artifact@v4
with:
name: Test Coverage Results (lcov)
path: lcov.info
- name: Upload coverage report (html)
uses: actions/upload-artifact@v4
with:
name: Test Coverage Results (html)
path: tarpaulin-report.html
# - name: Upload coverage report
# uses: actions/upload-artifact@v4
# with:
# name: Code coverage report
# path: cobertura.xml
build-docs:
name: Build documentation
needs: obtain_and_build_vsomeip
runs-on: ubuntu-latest
env:
CACHE_KEY: ${{ needs.obtain_and_build_vsomeip.outputs.cache_key }}
steps:
- uses: actions/checkout@v4
- name: Install C++ dependencies
run: sudo apt-get install -y build-essential cmake libboost-all-dev
- name: Set environment variables
run: |
echo "VSOMEIP_INSTALL_PATH=${{ github.workspace }}/${{ env.VSOMEIP_INSTALL_PATH }}" >> $GITHUB_ENV
- name: Print environment variables for debugging
run: |
echo "VSOMEIP_INSTALL_PATH: ${{ env.VSOMEIP_INSTALL_PATH }}"
- name: Ensure vsomeip install path exists
run: |
mkdir -p ${{ env.VSOMEIP_INSTALL_PATH }}
ls -l
- name: Print cache_key
run: |
echo "cache_key: ${{ env.CACHE_KEY }}"
- name: Restore vsomeip build cache
uses: actions/cache@v3
with:
path: ${{ env.VSOMEIP_INSTALL_PATH }}
key: ${{ env.CACHE_KEY }}
restore-keys: |
${{ runner.os }}-vsomeip-
- name: Create Documentation for up-streamer
working-directory: ${{github.workspace}}
run: RUSTDOCFLAGS=-Dwarnings cargo doc -p up-streamer --no-deps --no-default-features
- name: Create Documentation for up-linux-streamer
working-directory: ${{github.workspace}}
run: RUSTDOCFLAGS=-Dwarnings cargo doc -p up-linux-streamer --no-deps --no-default-features