Skip to content

Commit 59f7bca

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

File tree

3 files changed

+49
-32
lines changed

3 files changed

+49
-32
lines changed

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

Lines changed: 36 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,38 @@ on:
1722
paths-ignore:
1823
- "docs/**"
1924
jobs:
25+
setup:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
boards: ${{ steps.setup.outputs.boards == 'true' }}
29+
build_all: ${{ steps.setup.outputs.build_all == 'true' }}
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"
48+
echo "build_all=$build_all"
49+
echo "boards=$boards" >> $GITHUB_OUTPUT
50+
echo "build_all=$build_all" >> $GITHUB_OUTPUT
2051
build:
52+
needs: setup
2153
uses: ./.github/workflows/build.yml
2254
secrets: inherit
2355
with:
24-
build_all: ${{ inputs.build_all || false }}
56+
build_all: ${{ needs.setup.outputs.build_all == 'true' }}
2557
test:
2658
permissions:
2759
actions: read
@@ -33,4 +65,5 @@ jobs:
3365
with:
3466
artifact_fw_version: ${{ needs.build.outputs.version }}
3567
artifact_run_id: ${{ needs.build.outputs.run_id }}
36-
test_all: ${{ inputs.build_all || false }}
68+
devices: ${{ needs.setup.outputs.boards }}
69+
test_all: ${{ needs.setup.outputs.build_all == 'true' }}

.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: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -50,40 +50,19 @@ on:
5050
default: '[\"thingy91x\"]'
5151

5252
jobs:
53-
set-matrix:
53+
debug:
5454
runs-on: ubuntu-latest
55-
outputs:
56-
device_matrix: ${{ steps.set-matrix.outputs.device_matrix }}
57-
pytest_marker: ${{ steps.set-matrix.outputs.pytest_marker }}
5855
steps:
59-
- id: set-matrix
56+
- name: Test
6057
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-
58+
echo ${{ inputs.devices }}
59+
echo ${{ fromJson(inputs.devices) }}
8060
target_test:
8161
# This will create multiple jobs, one for each target defined in the matrix
82-
needs: set-matrix
8362
strategy:
8463
fail-fast: false # Don't fail all jobs if one fails
8564
matrix:
86-
device: ${{ fromJson(needs.set-matrix.outputs.device_matrix) }}
65+
device: ${{ fromJson(inputs.devices) }}
8766

8867
# Self-hosted runner is labeled according to the device it is linked with
8968
runs-on: cia-trd-${{ matrix.device }}
@@ -155,14 +134,19 @@ jobs:
155134
working-directory: asset-tracker-template/tests/on_target
156135
run: |
157136
mkdir -p results
137+
if [[ ${{ inputs.test_all }} == true ]]; then
138+
pytest_marker='-m "not slow"'
139+
else
140+
pytest_marker=''
141+
fi
158142
if [[ '${{ matrix.device }}' == 'ppk_thingy91x' ]]; then
159143
# For PPK device, only run tests/test_ppk
160-
pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \
144+
pytest -v $pytest_marker \
161145
--junit-xml=results/test-results.xml \
162146
--html=results/test-results.html --self-contained-html \
163147
tests/test_ppk
164148
else
165-
pytest -v ${{ needs.set-matrix.outputs.pytest_marker }} \
149+
pytest -v $pytest_marker \
166150
--junit-xml=results/test-results.xml \
167151
--html=results/test-results.html --self-contained-html \
168152
--ignore=tests/test_ppk \

0 commit comments

Comments
 (0)