Skip to content

Commit 9dc8caa

Browse files
committed
Add checkbox for running test in GH build workflow (#4246)
Currently when we run a build with limited set of boards that doesn't include OVA, the test job fails because the OVA artifact is missing. Add a checkbox for running tests and ensure that OVA artifact is built if it's enabled. (cherry picked from commit 71d222a)
1 parent 8cf6bd2 commit 9dc8caa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

.github/workflows/build.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
required: true
1717
type: boolean
1818
default: true
19+
run_tests:
20+
description: 'Run tests after build'
21+
required: true
22+
type: boolean
23+
default: true
1924
hassio_channel:
2025
description: 'Release channel to use (default: stable for GH releases, dev otherwise)'
2126
type: choice
@@ -152,12 +157,21 @@ jobs:
152157
}
153158
154159
const boardFilter = "${{ github.event.inputs.boards }}"
160+
const runTests = "${{ github.event.inputs.run_tests }}" === "true"
161+
155162
if (boardFilter == "") {
156163
console.log("Run full build for all boards")
157164
return { "board": boards }
158165
} else {
159166
console.log("Run partial build")
160167
const boardSet = new Set(boardFilter.split(","))
168+
169+
// if tests are enabled, we need to ensure the OVA board is included
170+
if (runTests && !boardSet.has("ova")) {
171+
console.log("Adding OVA board for integration tests")
172+
boardSet.add("ova")
173+
}
174+
161175
const buildBoards = boards.filter(b => boardSet.has(b.id))
162176
return { "board": buildBoards }
163177
}
@@ -410,6 +424,7 @@ jobs:
410424
411425
test:
412426
name: Test OS image
427+
if: ${{ github.event_name == 'release' || inputs.run_tests == true }}
413428
needs: [ build, prepare ]
414429
uses: ./.github/workflows/test.yaml
415430
with:

0 commit comments

Comments
 (0)