Skip to content

Commit 9423e11

Browse files
committed
test
1 parent 0e2592d commit 9423e11

File tree

2 files changed

+112
-62
lines changed

2 files changed

+112
-62
lines changed

.github/workflows/kuksa_databroker_build.yml

Lines changed: 111 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ jobs:
2828
lint:
2929
name: Lint
3030
runs-on: ubuntu-latest
31-
31+
env:
32+
CARGO_TERM_COLOR: always
3233
steps:
3334
- uses: actions/checkout@v4
3435
- uses: actions/cache@v4
@@ -58,7 +59,8 @@ jobs:
5859
test:
5960
name: Unit tests
6061
runs-on: ubuntu-latest
61-
62+
env:
63+
CARGO_TERM_COLOR: always
6264
steps:
6365
- uses: actions/checkout@v4
6466
- uses: actions/cache@v4
@@ -69,46 +71,30 @@ jobs:
6971
~/.cargo/registry/cache/
7072
~/.cargo/git/db/
7173
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
8981
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
10083

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
10886
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
11298
steps:
11399
- uses: actions/checkout@v4
114100
- uses: actions/cache@v4
@@ -119,23 +105,72 @@ jobs:
119105
~/.cargo/registry/cache/
120106
~/.cargo/git/db/
121107
target/
122-
key: databroker-release-${{ hashFiles('**/Cargo.lock') }}
108+
key: databroker-release-${{ matrix.platform.name }}-${{ hashFiles('**/Cargo.lock') }}
123109
- name: Install build prerequisites
124110
working-directory: ${{github.workspace}}/
125111
run: |
126-
which cargo-license || cargo install cargo-license
127112
which cross || cargo install cross
128113
- name: Build
129114
working-directory: ${{github.workspace}}/
130115
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
132167
- name: Set container metadata
133168
id: meta
134169
uses: docker/metadata-action@v5
135170
with:
136171
# list of Docker images to use as base name for tags
137172
images: |
138-
ghcr.io/eclipse-kuksa/kuksa-databrokerdatabroker
173+
ghcr.io/eclipse-kuksa/kuksa-databroker
139174
# generate Docker tags based on the following events/attributes
140175
tags: |
141176
type=ref,event=branch
@@ -199,29 +234,29 @@ jobs:
199234
with:
200235
image: ttl.sh/eclipse-kuksa/kuksa-databroker-${{github.sha}}
201236

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
207242

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
213248

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
219254

220255

221256
integration-test:
222257
name: Run integration test
223258
runs-on: ubuntu-latest
224-
needs: [build-container]
259+
needs: [create-container]
225260

226261
steps:
227262
- name: Set up QEMU
@@ -265,13 +300,28 @@ jobs:
265300
target/
266301
key: databroker-bom-${{ hashFiles('**/Cargo.lock') }}
267302

268-
- name: "License check and Dash output generation"
303+
- name: Install prerequisites
269304
working-directory: ${{github.workspace}}/createbom
270305
run: |
271306
which cargo-license || cargo install cargo-license
307+
- name: License check and Dash output generation
308+
working-directory: ${{github.workspace}}/createbom
309+
run: |
272310
python3 createbom.py --dash ${{github.workspace}}/dash-databroker-deps ../databroker
273-
274311
- name: Dash license check
275312
uses: eclipse-kuksa/kuksa-actions/check-dash@2
276313
with:
277314
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

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ COPY ./target/riscv64gc-unknown-linux-gnu/release/databroker /app/databroker
4444
FROM target-$TARGETARCH as target
4545
ARG TARGETARCH
4646

47-
COPY ./dist/$TARGETARCH/thirdparty/ /app/thirdparty
47+
COPY ./databroker/thirdparty/ /app/thirdparty
4848

4949
COPY ./data/vss-core/vss_release_3.1.1.json vss_release_3.1.1.json
5050
COPY ./data/vss-core/vss_release_4.0.json vss_release_4.0.json

0 commit comments

Comments
 (0)