Skip to content

Commit 60f8912

Browse files
committed
workflow: Fix the build_all parameter
Signed-off-by: Jorgen Kvalvaag <jorgen.kvalvaag@nordicsemi.no>
1 parent e7ca6e2 commit 60f8912

File tree

3 files changed

+43
-35
lines changed

3 files changed

+43
-35
lines changed

.github/workflows/build-and-target-test.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ on:
66
build_all:
77
description: Build all configurations
88
type: boolean
9-
required: false
9+
required: true
1010
default: false
11+
boards:
12+
description: Boards to test, json list
13+
type: string
14+
required: true
15+
default: '["thingy91x"]'
1116

1217
schedule:
1318
- cron: "0 0 * * *"
@@ -17,11 +22,36 @@ on:
1722
paths-ignore:
1823
- "docs/**"
1924
jobs:
25+
setup:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
boards: steps.setup.outputs.boards
29+
build_all: steps.setup.outputs.build_all
30+
steps:
31+
- name: Setup
32+
id: setup
33+
run: |
34+
SCHEDULED=${{ github.event_name == 'schedule' }}
35+
PUSH=${{ github.event_name == 'push' }}
36+
BUILD_ALL=${{ inputs.build_all }}
37+
if [[ $SCHEDULED == true ]]; then
38+
boards='["thingy91x","nrf9151dk","ppk_thingy91x"]'
39+
build_all=true
40+
elif [[ $PUSH == true ]]; then
41+
boards='["thingy91x"]'
42+
build_all=false
43+
else
44+
boards=${{ inputs.boards }}
45+
build_all=${{ inputs.build_all }}
46+
fi
47+
echo "boards=$boards" >> $GITHUB_OUTPUT
48+
echo "build_all=$build_all" >> $GITHUB_OUTPUT
2049
build:
50+
needs: setup
2151
uses: ./.github/workflows/build.yml
2252
secrets: inherit
2353
with:
24-
build_all: ${{ inputs.build_all || false }}
54+
build_all: ${{ needs.setup.outputs.build_all }}
2555
test:
2656
permissions:
2757
actions: read
@@ -33,4 +63,5 @@ jobs:
3363
with:
3464
artifact_fw_version: ${{ needs.build.outputs.version }}
3565
artifact_run_id: ${{ needs.build.outputs.run_id }}
36-
test_all: ${{ inputs.build_all || false }}
66+
devices: ${{ needs.setup.outputs.boards }}
67+
test_all: ${{ needs.setup.outputs.build_all }}

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ on:
2626
build_all:
2727
type: boolean
2828
required: false
29-
default: ${{ github.event_name == 'schedule' }}
29+
default: false
3030
outputs:
3131
run_id:
3232
description: The run ID of the workflow to fetch artifacts from

.github/workflows/target-test.yml

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -50,40 +50,12 @@ on:
5050
default: '[\"thingy91x\"]'
5151

5252
jobs:
53-
set-matrix:
54-
runs-on: ubuntu-latest
55-
outputs:
56-
device_matrix: ${{ steps.set-matrix.outputs.device_matrix }}
57-
pytest_marker: ${{ steps.set-matrix.outputs.pytest_marker }}
58-
steps:
59-
- id: set-matrix
60-
run: |
61-
if [[ ${{ github.event_name == 'schedule' }} == true ]]; then
62-
marker=''
63-
matrix='["thingy91x","nrf9151dk","ppk_thingy91x"]'
64-
elif [[ ${{ inputs.test_all }} == true ]]; then
65-
marker=''
66-
matrix='["thingy91x","nrf9151dk","ppk_thingy91x"]'
67-
elif [[ ${{ github.event_name == 'push' }} == true ]]; then
68-
marker='-m "not slow"'
69-
matrix='["thingy91x"]'
70-
else
71-
marker='-m "not slow"'
72-
matrix='["thingy91x"]'
73-
fi
74-
75-
echo Matrix as string: $matrix
76-
echo Pytest marker as string: $marker
77-
echo "device_matrix=$matrix" >> $GITHUB_OUTPUT
78-
echo "pytest_marker=$marker" >> $GITHUB_OUTPUT
79-
8053
target_test:
8154
# This will create multiple jobs, one for each target defined in the matrix
82-
needs: set-matrix
8355
strategy:
8456
fail-fast: false # Don't fail all jobs if one fails
8557
matrix:
86-
device: ${{ fromJson(needs.set-matrix.outputs.device_matrix) }}
58+
device: ${{ fromJson(inputs.devices) }}
8759

8860
# Self-hosted runner is labeled according to the device it is linked with
8961
runs-on: cia-trd-${{ matrix.device }}
@@ -155,14 +127,19 @@ jobs:
155127
working-directory: asset-tracker-template/tests/on_target
156128
run: |
157129
mkdir -p results
130+
if [[ ${{ inputs.test_all }} == true ]]; then
131+
pytest_marker='-m "not slow"'
132+
else
133+
pytest_marker=''
134+
fi
158135
if [[ '${{ matrix.device }}' == 'ppk_thingy91x' ]]; then
159136
# For PPK device, only run tests/test_ppk
160-
pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \
137+
pytest -v $pytest_marker \
161138
--junit-xml=results/test-results.xml \
162139
--html=results/test-results.html --self-contained-html \
163140
tests/test_ppk
164141
else
165-
pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \
142+
pytest -v $pytest_marker \
166143
--junit-xml=results/test-results.xml \
167144
--html=results/test-results.html --self-contained-html \
168145
--ignore=tests/test_ppk \

0 commit comments

Comments
 (0)