mirror of
https://github.com/home-assistant/operating-system.git
synced 2025-12-20 02:18:37 +00:00
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.
This commit is contained in:
15
.github/workflows/build.yaml
vendored
15
.github/workflows/build.yaml
vendored
@@ -16,6 +16,11 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
|
run_tests:
|
||||||
|
description: 'Run tests after build'
|
||||||
|
required: true
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
hassio_channel:
|
hassio_channel:
|
||||||
description: 'Release channel to use (default: stable for GH releases, dev otherwise)'
|
description: 'Release channel to use (default: stable for GH releases, dev otherwise)'
|
||||||
type: choice
|
type: choice
|
||||||
@@ -152,12 +157,21 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const boardFilter = "${{ github.event.inputs.boards }}"
|
const boardFilter = "${{ github.event.inputs.boards }}"
|
||||||
|
const runTests = "${{ github.event.inputs.run_tests }}" === "true"
|
||||||
|
|
||||||
if (boardFilter == "") {
|
if (boardFilter == "") {
|
||||||
console.log("Run full build for all boards")
|
console.log("Run full build for all boards")
|
||||||
return { "board": boards }
|
return { "board": boards }
|
||||||
} else {
|
} else {
|
||||||
console.log("Run partial build")
|
console.log("Run partial build")
|
||||||
const boardSet = new Set(boardFilter.split(","))
|
const boardSet = new Set(boardFilter.split(","))
|
||||||
|
|
||||||
|
// if tests are enabled, we need to ensure the OVA board is included
|
||||||
|
if (runTests && !boardSet.has("ova")) {
|
||||||
|
console.log("Adding OVA board for integration tests")
|
||||||
|
boardSet.add("ova")
|
||||||
|
}
|
||||||
|
|
||||||
const buildBoards = boards.filter(b => boardSet.has(b.id))
|
const buildBoards = boards.filter(b => boardSet.has(b.id))
|
||||||
return { "board": buildBoards }
|
return { "board": buildBoards }
|
||||||
}
|
}
|
||||||
@@ -410,6 +424,7 @@ jobs:
|
|||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test OS image
|
name: Test OS image
|
||||||
|
if: ${{ github.event_name == 'release' || inputs.run_tests == true }}
|
||||||
needs: [ build, prepare ]
|
needs: [ build, prepare ]
|
||||||
uses: ./.github/workflows/test.yaml
|
uses: ./.github/workflows/test.yaml
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user