Skip to content

Commit

Permalink
ci: if container is 'all' run tests on all containers
Browse files Browse the repository at this point in the history
Test container names are discovered using "find" command.
Add an option to specify container registry.
  • Loading branch information
LaszloGombos committed Nov 25, 2023
1 parent 2175ea7 commit 66edc8b
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/manualtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
description: 'distro'
default: 'fedora'
options:
- "all"
- "fedora"
- "arch"
- "debian"
Expand All @@ -19,14 +20,18 @@ on:
env:
description: 'Environment (optional)'
default: '{"DEBUGFAIL": "rd.debug"}'
registry:
description: 'Registry for containers, such as ghcr.io/dracutdevs'

env:
${{ fromJSON(inputs.env) }}

jobs:
matrix:
test-generator:
runs-on: ubuntu-latest
outputs:
registry: ${{ steps.set-matrix.outputs.registry }}
container: ${{ steps.set-matrix.outputs.container }}
tests: ${{ steps.set-matrix.outputs.tests }}
steps:
- name: "Checkout Repository"
Expand All @@ -36,22 +41,31 @@ jobs:
- id: set-matrix
name: "Set Matrix"
run: |
[[ "${{ inputs.registry }}" != '' ]] && echo "registry=\"${{ inputs.registry }}\"" >> $GITHUB_OUTPUT \
|| ( echo "registry=\"ghcr.io/${{ github.repository_owner }}\"" >> $GITHUB_OUTPUT )
[[ "${{ inputs.container }}" != 'all' ]] && echo "container=[\"${{ inputs.container }}\"]" >> $GITHUB_OUTPUT \
|| ( containers=$(find test/container -name "Dockerfile-*" | cut -d\- -f2 | tr '[:upper:]' '[:lower:]' | sed -z 's/\n/","/g'); echo "container=[\"${containers%??}]" >> $GITHUB_OUTPUT )
[[ "${{ 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
needs: test-generator
runs-on: ubuntu-latest
timeout-minutes: 45
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.container }}-${{ matrix.test }}
cancel-in-progress: true
strategy:
matrix:
test: ${{ fromJSON(needs.matrix.outputs.tests) }}
container: ${{ fromJSON(needs.test-generator.outputs.container) }}
test: ${{ fromJSON(needs.test-generator.outputs.tests) }}
fail-fast: false
container:
image: ghcr.io/dracutdevs/${{ inputs.container }}
image: ${{ fromJSON(needs.test-generator.outputs.registry) }}/${{ matrix.container }}
options: "--privileged -v /dev:/dev"
steps:
- name: "Checkout Repository"
uses: actions/checkout@v1
with:
fetch-depth: 0
- name: "${{ inputs.container }} ${{ matrix.test }}"
- name: "${{ matrix.container }} ${{ matrix.test }}"
run: ./tools/test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}

0 comments on commit 66edc8b

Please sign in to comment.