28
28
lint :
29
29
name : Lint
30
30
runs-on : ubuntu-latest
31
-
31
+ env :
32
+ CARGO_TERM_COLOR : always
32
33
steps :
33
34
- uses : actions/checkout@v4
34
35
- uses : actions/cache@v4
58
59
test :
59
60
name : Unit tests
60
61
runs-on : ubuntu-latest
61
-
62
+ env :
63
+ CARGO_TERM_COLOR : always
62
64
steps :
63
65
- uses : actions/checkout@v4
64
66
- uses : actions/cache@v4
@@ -69,46 +71,30 @@ jobs:
69
71
~/.cargo/registry/cache/
70
72
~/.cargo/git/db/
71
73
target/
72
- key : databroker-test-${{ hashFiles('**/Cargo.lock') }}
73
- - name : Show toolchain information
74
- working-directory : ${{github.workspace}}
75
- run : |
76
- rustup toolchain list
77
- cargo --version
78
- - name : Install cargo tarpaulin (unless already installed)
79
- run : |
80
- which cargo-tarpaulin || cargo install cargo-tarpaulin
81
- - name : Run tests and report code coverage
82
- run : |
83
- cargo tarpaulin -o xml \
84
- --exclude-files databroker/tests/* \
85
- --exclude-files databroker/tests/world/*
86
-
87
- - name : Upload coverage report
88
- uses : actions/upload-artifact@v4
74
+ key : databroker-coverage-${{ hashFiles('**/Cargo.lock') }}
75
+ - name : Install cargo-llvm-cov
76
+ uses : taiki-e/install-action@cargo-llvm-cov
77
+ - name : Generate code coverage
78
+ run : cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info
79
+ - name : Upload coverage to Codecov
80
+ uses : codecov/codecov-action@v3
89
81
with :
90
- name : Code coverage report
91
- path : cobertura.xml
92
-
93
- # - name: Publish coverage report as comment
94
- # uses: 5monkeys/cobertura-action@v12
95
- # if: github.event_name == 'pull_request'
96
- # with:
97
- # path: cobertura.xml
98
- # repo_token: ${{ secrets.GITHUB_TOKEN }}
99
- # minimum_coverage: 40
82
+ files : lcov.info
100
83
101
- check_ghcr_push :
102
- name : Check access rights
103
- uses : eclipse-kuksa/kuksa-actions/.github/workflows/check_ghcr_push.yml@2
104
- secrets : inherit
105
-
106
- build-container :
107
- name : Build multiarch container
84
+ build :
85
+ name : Build
108
86
runs-on : ubuntu-latest
109
-
110
- needs : check_ghcr_push
111
-
87
+ env :
88
+ CARGO_TERM_COLOR : always
89
+ strategy :
90
+ matrix :
91
+ platform :
92
+ - name : amd64
93
+ target : x86_64-unknown-linux-musl
94
+ - name : arm64
95
+ target : aarch64-unknown-linux-musl
96
+ - name : riscv64
97
+ target : riscv64gc-unknown-linux-gnu
112
98
steps :
113
99
- uses : actions/checkout@v4
114
100
- uses : actions/cache@v4
@@ -119,23 +105,72 @@ jobs:
119
105
~/.cargo/registry/cache/
120
106
~/.cargo/git/db/
121
107
target/
122
- key : databroker-release-${{ hashFiles('**/Cargo.lock') }}
108
+ key : databroker-release-${{ matrix.platform.name }}-${{ hashFiles('**/Cargo.lock') }}
123
109
- name : Install build prerequisites
124
110
working-directory : ${{github.workspace}}/
125
111
run : |
126
- which cargo-license || cargo install cargo-license
127
112
which cross || cargo install cross
128
113
- name : Build
129
114
working-directory : ${{github.workspace}}/
130
115
run : |
131
- ./build-all-targets.sh
116
+ cross build --target ${{ matrix.platform.target }} --bin databroker --release
117
+ mkdir -p "dist/${{ matrix.platform.name }}"
118
+ cp "target/${{ matrix.platform.target }}/release/databroker" "dist/${{ matrix.platform.name }}"
119
+ - name : Package dist files
120
+ shell : bash
121
+ working-directory : ${{github.workspace}}
122
+ run : |
123
+ tar -cf databroker-${{ matrix.platform.name }}.tar.gz dist
124
+
125
+ - name : Upload artifacts
126
+ uses : actions/upload-artifact@v4
127
+ with :
128
+ name : databroker-${{ matrix.platform.name }}.tar.gz
129
+ path : databroker-${{ matrix.platform.name }}.tar.gz
130
+ if-no-files-found : error
131
+
132
+ check_ghcr_push :
133
+ name : Check access rights
134
+ uses : eclipse-kuksa/kuksa-actions/.github/workflows/check_ghcr_push.yml@2
135
+ secrets : inherit
136
+
137
+ create-container :
138
+ name : Create multiarch container
139
+ runs-on : ubuntu-latest
140
+
141
+ needs : [build, bom, check_ghcr_push]
142
+
143
+ steps :
144
+ - uses : actions/checkout@v4
145
+ - name : Retrieve artifacts
146
+ uses : actions/download-artifact@v4
147
+ with :
148
+ path : artifacts
149
+ merge-multiple : true
150
+
151
+ - name : Unpack binaries
152
+ env :
153
+ AMD64_DIR : ${{ github.workspace }}/target/x86_64-unknown-linux-musl/release
154
+ ARM64_DIR : ${{ github.workspace }}/target/aarch64-unknown-linux-musl/release
155
+ RISCV64_DIR : ${{ github.workspace }}/target/riscv64gc-unknown-linux-gnu/release
156
+ run : |
157
+ tar xf artifacts/databroker-amd64.tar.gz
158
+ mkdir -p "$AMD64_DIR"
159
+ mv dist/amd64/databroker "$AMD64_DIR"
160
+ tar xf artifacts/databroker-arm64.tar.gz
161
+ mkdir -p "$ARM64_DIR"
162
+ mv dist/arm64/databroker "$ARM64_DIR"
163
+ tar xf artifacts/databroker-riscv64.tar.gz
164
+ mkdir -p "$RISCV64_DIR"
165
+ mv dist/riscv64/databroker "$RISCV64_DIR"
166
+ tar xf artifacts/thirdparty.tar.gz
132
167
- name : Set container metadata
133
168
id : meta
134
169
uses : docker/metadata-action@v5
135
170
with :
136
171
# list of Docker images to use as base name for tags
137
172
images : |
138
- ghcr.io/eclipse-kuksa/kuksa-databrokerdatabroker
173
+ ghcr.io/eclipse-kuksa/kuksa-databroker
139
174
# generate Docker tags based on the following events/attributes
140
175
tags : |
141
176
type=ref,event=branch
@@ -199,29 +234,29 @@ jobs:
199
234
with :
200
235
image : ttl.sh/eclipse-kuksa/kuksa-databroker-${{github.sha}}
201
236
202
- - name : " Archiving AMD64 artifacts"
203
- uses : actions/upload-artifact@v4
204
- with :
205
- name : databroker-amd64
206
- path : ${{github.workspace}}/dist/amd64
237
+ # - name: "Archiving AMD64 artifacts"
238
+ # uses: actions/upload-artifact@v4
239
+ # with:
240
+ # name: databroker-amd64
241
+ # path: ${{github.workspace}}/dist/amd64
207
242
208
- - name : " Archiving ARM64 artifacts"
209
- uses : actions/upload-artifact@v4
210
- with :
211
- name : databroker-arm64
212
- path : ${{github.workspace}}/dist/arm64
243
+ # - name: "Archiving ARM64 artifacts"
244
+ # uses: actions/upload-artifact@v4
245
+ # with:
246
+ # name: databroker-arm64
247
+ # path: ${{github.workspace}}/dist/arm64
213
248
214
- - name : " Archiving RISCV64 artifacts"
215
- uses : actions/upload-artifact@v4
216
- with :
217
- name : databroker-riscv64
218
- path : ${{github.workspace}}/dist/riscv64
249
+ # - name: "Archiving RISCV64 artifacts"
250
+ # uses: actions/upload-artifact@v4
251
+ # with:
252
+ # name: databroker-riscv64
253
+ # path: ${{github.workspace}}/dist/riscv64
219
254
220
255
221
256
integration-test :
222
257
name : Run integration test
223
258
runs-on : ubuntu-latest
224
- needs : [build -container]
259
+ needs : [create -container]
225
260
226
261
steps :
227
262
- name : Set up QEMU
@@ -265,13 +300,28 @@ jobs:
265
300
target/
266
301
key : databroker-bom-${{ hashFiles('**/Cargo.lock') }}
267
302
268
- - name : " License check and Dash output generation "
303
+ - name : Install prerequisites
269
304
working-directory : ${{github.workspace}}/createbom
270
305
run : |
271
306
which cargo-license || cargo install cargo-license
307
+ - name : License check and Dash output generation
308
+ working-directory : ${{github.workspace}}/createbom
309
+ run : |
272
310
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-deps ../databroker
273
-
274
311
- name : Dash license check
275
312
uses : eclipse-kuksa/kuksa-actions/check-dash@2
276
313
with :
277
314
dashinput : ${{github.workspace}}/dash-databroker-deps
315
+ - name : Generate Bill of Materials
316
+ working-directory : ${{github.workspace}}/createbom
317
+ run : |
318
+ rm -r ../databroker/thirdparty
319
+ python3 createbom.py ../databroker
320
+ cd ..
321
+ tar cf thirdparty.tar.gz databroker/thirdparty
322
+ - name : Upload Bill of Materials
323
+ uses : actions/upload-artifact@v4
324
+ with :
325
+ name : Third party licenses
326
+ path : thirdparty.tar.gz
327
+ if-no-files-found : error
0 commit comments