Skip to content

Commit

Permalink
ci: if list of tests is empty, run all tests
Browse files Browse the repository at this point in the history
Test matrix for all tests is computed using "find" to.
  • Loading branch information
LaszloGombos committed Feb 26, 2023
1 parent 5d8e7e0 commit 2175ea7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/manualtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
test:
description: "Array of tests to run, such as [11,12]"
default: "['04']"
required: true
container:
type: choice
description: 'distro'
Expand All @@ -25,12 +24,27 @@ env:
${{ fromJSON(inputs.env) }}

jobs:
matrix:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.set-matrix.outputs.tests }}
steps:
- name: "Checkout Repository"
uses: actions/checkout@v1
with:
fetch-depth: 0
- id: set-matrix
name: "Set Matrix"
run: |
[[ "${{ toJson(fromJson(inputs.test)) }}" != '[]' ]] && echo "tests=${{ inputs.test }}" >> $GITHUB_OUTPUT \
|| ( tests=$(find test -type d -a -name "TEST-*" | cut -d\- -f2 | sed -z 's/\n/","/g' ); echo "tests=[\"${tests%??}]" >> $GITHUB_OUTPUT )
test:
needs: matrix
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
matrix:
test: ${{ fromJSON(inputs.test) }}
test: ${{ fromJSON(needs.matrix.outputs.tests) }}
container:
image: ghcr.io/dracutdevs/${{ inputs.container }}
options: "--privileged -v /dev:/dev"
Expand Down

0 comments on commit 2175ea7

Please sign in to comment.