Skip to content

Commit

Permalink
Change workflow from matrix to runs
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Nov 15, 2023
1 parent 06ce9ec commit 003ded2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 36 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/test_docker_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,15 @@ concurrency:

jobs:

# Build container and run tests
run:
name: ${{ matrix.debian_codename }}
strategy:
fail-fast: false
matrix:
debian_codename: ['bullseye'] #['bookworm', 'bullseye', 'buster']
# Build container and run tests. Duplication of job intended for better visualization.
run_bullseye:
name: 'bullseye'
uses: ./.github/workflows/test_docker_debian_codename_sub.yml
with:
runs_on: ubuntu-latest
platform: linux/arm/v7
docker_image_name: rpi-jukebox-rfid-v3
cache_scope: ${{ github.ref }}-test-debian-v3
matrix_usernames: "['pi', 'hans']"
matrix_test_scripts: "['run_installation_tests.sh']"
debian_codename: ${{ matrix.debian_codename }}
debian_codename: 'bullseye'

run_buster:
name: 'buster'
uses: ./.github/workflows/test_docker_debian_codename_sub.yml
with:
debian_codename: 'buster'
38 changes: 16 additions & 22 deletions .github/workflows/test_docker_debian_codename_sub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,25 @@ name: Subworkflow Test Install Scripts Debian V3
on:
workflow_call:
inputs:
runs_on:
required: true
type: string
platform:
required: true
type: string
debian_codename:
required: true
type: string
cache_scope:
required: true
type: string
docker_image_name:
required: true
type: string
matrix_usernames:
required: true
type: string
matrix_test_scripts:
required: true
required: false
type: string
default: ${{ github.ref }}-test-debian-v3
local_registry_port:
required: false
type: number
default: 5000
runs_on:
required: false
type: string
default: ubuntu-latest

env:
platform: linux/arm/v7
docker_image_name: rpi-jukebox-rfid-v3

# let only one instance run the test so cache is not corrupted.
# cancel already running instances as only the last run will be relevant
Expand Down Expand Up @@ -69,7 +63,7 @@ jobs:
id: pre-vars
env:
DEBIAN_CODENAME: ${{ inputs.debian_codename }}
DOCKER_IMAGE_NAME: ${{ inputs.docker_image_name }}
DOCKER_IMAGE_NAME: ${{ env.docker_image_name }}
CACHE_SCOPE: ${{ inputs.cache_scope }}
run: |
echo "image_tag_name=${{ env.DOCKER_IMAGE_NAME }}:${{ env.DEBIAN_CODENAME }}-test" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -97,7 +91,7 @@ jobs:
push: true
file: ./ci/ci-debian.Dockerfile
target: test-code
platforms: ${{ inputs.platform }}
platforms: ${{ env.platform }}
tags: ${{ steps.vars.outputs.image_tag_name_local_base }}
cache-from: type=gha,scope=${{ steps.vars.outputs.cache_scope }}
cache-to: type=gha,mode=max,scope=${{ steps.vars.outputs.cache_scope }}
Expand All @@ -115,7 +109,7 @@ jobs:
push: false
file: ./ci/ci-debian.Dockerfile
target: test-update
platforms: ${{ inputs.platform }}
platforms: ${{ env.platform }}
tags: ${{ steps.vars.outputs.image_tag_name }}
cache-from: type=gha,scope=${{ steps.vars.outputs.cache_scope }}
# DON'T use 'cache-to' here as the layer is then cached and this build would be useless
Expand All @@ -139,8 +133,8 @@ jobs:
strategy:
fail-fast: false
matrix:
username: ${{ fromJSON(inputs.matrix_usernames) }}
test_script: ${{ fromJSON(inputs.matrix_test_scripts) }}
username: ['pi', 'hans']
test_script: ['run_installation_tests.sh']

steps:
- name: Set up QEMU
Expand All @@ -163,7 +157,7 @@ jobs:
uses: tj-actions/docker-run@v2
with:
image: ${{ needs.build.outputs.image_tag_name }}
options: --platform ${{inputs.platform }} --user ${{ matrix.username }}
options: --platform ${{ env.platform }} --user ${{ matrix.username }}
name: ${{ matrix.test_script }}
args: |
./${{ matrix.test_script }}
Expand Down

0 comments on commit 003ded2

Please sign in to comment.