Skip to content

Commit

Permalink
Allow both combinatorial and include syntax for test_matrix
Browse files Browse the repository at this point in the history
The include syntax allows full control over settings used
in each test job, but the combinatorial is simpler to write
for basic use cases.

Rather than force one, we can allow both and default to the simple
syntax.

Change-type: patch
Signed-off-by: Kyle Harding <[email protected]>
  • Loading branch information
klutchell committed Jun 19, 2024
1 parent 0164431 commit 2e608ae
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 35 deletions.
23 changes: 5 additions & 18 deletions .github/workflows/generic-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,21 +53,8 @@ jobs:
device-repo-ref: master
# Use qemu workers for testing
test_matrix: >
[
{
"test_suite": "os",
"environment": "bm.balena-dev.com",
"worker_type": "qemu"
},
{
"test_suite": "cloud",
"environment": "bm.balena-dev.com",
"worker_type": "qemu",
"test_org": "testbot"
},
{
"test_suite": "hup",
"environment": "bm.balena-dev.com",
"worker_type": "qemu"
},
]
{
"test_suite": ["os","cloud","hup"],
"environment": ["bm.balena-dev.com"],
"worker_type": ["qemu"]
}
48 changes: 31 additions & 17 deletions .github/workflows/yocto-build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ on:
required: false
type: boolean
default: ${{ github.event_name == 'push' }} # This determines if we want to check the results of the merge PR - we only want to do it when a new tag is made
# FIXME: remove this input and set "test_matrix: {}" to skip tests. The open PR event type check can be moved to the job conditions.
# Additionally, we may want to change the default test_matrix to {} and make tests opt-in.
run-tests:
required: false
type: boolean
Expand Down Expand Up @@ -134,25 +136,38 @@ on:
# - worker_type: The worker type to use for testing. The valid worker types are `qemu` and `testbot`. The default worker type is `testbot`
# - worker_fleets: The testbot fleets for finding available Leviathan workers. Not used for QEMU workers. Can accept a list of apps separated by commas, no spaces in between
# - test_org: The organization to use for testing cloud functionality. This default org is `testbot`
# To use specific settings for each test job, create an include array like this...
# {"include": [
# {
# "test_suite": "os",
# "environment": "bm.balena-dev.com"
# },
# {
# "test_suite": "cloud",
# "environment": "balena-cloud.com",
# "worker_type": "qemu"
# },
# {
# "test_suite": "hup",
# "environment": "balena-cloud.com",
# "worker_type": "qemu"
# }
# ]}
# Otherwise for a combinatorial matrix (the default) just provide values like this to have the matrix expanded...
# {
# "test_suite": ["os","cloud","hup"],
# "environment": ["bm.balena-dev.com"],
# "worker_type": ["qemu","testbot"]
# }
test_matrix:
description: "JSON Leviathan test matrix to use for testing. If not provided, the default test matrix will be used."
description: "JSON Leviathan test matrix to use for testing. If not provided, the default testbot matrix will be used."
required: false
type: string
default: >
[
{
"test_suite": "os",
"environment": "bm.balena-dev.com"
},
{
"test_suite": "cloud",
"environment": "bm.balena-dev.com"
},
{
"test_suite": "hup",
"environment": "bm.balena-dev.com"
},
]
{
"test_suite": ["os","cloud","hup"],
"environment": ["bm.balena-dev.com"]
}
# https://docs.github.com/en/actions/using-jobs/using-concurrency
concurrency:
Expand Down Expand Up @@ -978,8 +993,7 @@ jobs:

strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(inputs.test_matrix) }}
matrix: ${{ fromJSON(inputs.test_matrix) }}

env:
# Variables provided via the selected GitHub environment
Expand Down

0 comments on commit 2e608ae

Please sign in to comment.