Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update workflow with improvements from v3 #2246

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 43 additions & 14 deletions .github/workflows/test_docker_debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
# The branches below must be a subset of the branches above
branches:
- develop
- main
- master
paths:
- '.github/workflows/test_docker_debian*.yml'
- 'ci/**'
Expand All @@ -39,19 +39,48 @@ concurrency:

jobs:

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

# # can be activate on test branches
# run_bookworm_armv6:
# name: 'bookworm armv6'
# uses: ./.github/workflows/test_docker_debian_codename_sub.yml
# with:
# debian_codename: 'bookworm'
# platform: linux/arm/v6

run_bullseye_armv7:
name: 'bullseye armv7'
uses: ./.github/workflows/test_docker_debian_codename_sub.yml
with:
debian_codename: 'bullseye'
platform: linux/arm/v7

# # can be activate on test branches, currently failing
# run_bullseye_armv6:
# name: 'bullseye armv6'
# uses: ./.github/workflows/test_docker_debian_codename_sub.yml
# with:
# debian_codename: 'bullseye'
# platform: linux/arm/v6

run_buster_armv7:
name: 'buster armv7'
uses: ./.github/workflows/test_docker_debian_codename_sub.yml
with:
debian_codename: 'buster'
platform: linux/arm/v7

# # can be activate on test branches, currently failing
# run_buster_armv6:
# name: 'buster armv6'
# uses: ./.github/workflows/test_docker_debian_codename_sub.yml
# with:
# debian_codename: 'buster'
# platform: linux/arm/v6
50 changes: 29 additions & 21 deletions .github/workflows/test_docker_debian_codename_sub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,33 @@ name: Subworkflow Test Install Scripts Debian
on:
workflow_call:
inputs:
runs_on:
required: true
type: string
platform:
required: true
type: string
debian_codename:
required: true
type: string
cache_scope:
platform:
required: true
type: string
docker_image_name:
required: true
type: string
matrix_usernames:
required: true
required: false
type: string
matrix_test_scripts:
required: true
default: rpi-jukebox-rfid
cache_scope:
required: false
type: string
default: ${{ github.ref }}-test-debian
local_registry_port:
required: false
type: number
default: 5000
runs_on:
required: false
type: string
default: ubuntu-latest

# let only one instance run the test so cache is not corrupted.
# cancel already running instances as only the last run will be relevant
concurrency:
group: ${{ inputs.cache_scope }}-${{ inputs.debian_codename }}
group: ${{ inputs.cache_scope }}-${{ inputs.debian_codename }}-${{ inputs.platform }}
cancel-in-progress: true

jobs:
Expand All @@ -45,6 +42,7 @@ jobs:
cache_key: ${{ steps.vars.outputs.cache_key }}
image_file_name: ${{ steps.vars.outputs.image_file_name }}
image_tag_name: ${{ steps.vars.outputs.image_tag_name }}
docker_run_options: ${{ steps.vars.outputs.docker_run_options }}

# create local docker registry to use locally build images
services:
Expand All @@ -71,22 +69,28 @@ jobs:
DEBIAN_CODENAME: ${{ inputs.debian_codename }}
DOCKER_IMAGE_NAME: ${{ inputs.docker_image_name }}
CACHE_SCOPE: ${{ inputs.cache_scope }}
PLATFORM: ${{ inputs.platform }}
run: |
echo "image_tag_name=${{ env.DOCKER_IMAGE_NAME }}:${{ env.DEBIAN_CODENAME }}-test" >> $GITHUB_OUTPUT
echo "image_file_name=${{ env.DOCKER_IMAGE_NAME }}-${{ env.DEBIAN_CODENAME }}.tar" >> $GITHUB_OUTPUT
echo "cache_scope=${{ env.CACHE_SCOPE }}-${{ env.DEBIAN_CODENAME }}" >> $GITHUB_OUTPUT
PLATFORM=${PLATFORM////_}
echo "image_tag_name=${{ env.DOCKER_IMAGE_NAME }}:${{ env.DEBIAN_CODENAME }}-${PLATFORM}-test" >> $GITHUB_OUTPUT
echo "image_file_name=${{ env.DOCKER_IMAGE_NAME }}-${{ env.DEBIAN_CODENAME }}-${PLATFORM}.tar" >> $GITHUB_OUTPUT
echo "cache_scope=${{ env.CACHE_SCOPE }}-${{ env.DEBIAN_CODENAME }}-${PLATFORM}" >> $GITHUB_OUTPUT

- name: Set Output vars
id: vars
env:
LOCAL_REGISTRY_PORT: ${{ inputs.local_registry_port }}
PLATFORM: ${{ inputs.platform }}
run: |
echo "image_tag_name=${{ steps.pre-vars.outputs.image_tag_name }}" >> $GITHUB_OUTPUT
echo "image_tag_name_local_base=localhost:${{ env.LOCAL_REGISTRY_PORT }}/${{ steps.pre-vars.outputs.image_tag_name }}-base" >> $GITHUB_OUTPUT
echo "image_file_name=${{ steps.pre-vars.outputs.image_file_name }}" >> $GITHUB_OUTPUT
echo "image_file_path=./${{ steps.pre-vars.outputs.image_file_name }}" >> $GITHUB_OUTPUT
echo "cache_scope=${{ steps.pre-vars.outputs.cache_scope }}" >> $GITHUB_OUTPUT
echo "cache_key=${{ steps.pre-vars.outputs.cache_scope }}-${{ github.sha }}#${{ github.run_attempt }}" >> $GITHUB_OUTPUT
if [ "${{ env.PLATFORM }}" == "linux/arm/v6" ] ; then
echo "docker_run_options=-e QEMU_CPU=arm1176" >> $GITHUB_OUTPUT
fi

# Build base image for debian version name. Layers will be cached and image pushes to local registry
- name: Build Image - Base
Expand Down Expand Up @@ -128,7 +132,7 @@ jobs:
with:
name: ${{ steps.vars.outputs.image_file_name }}
path: ${{ steps.vars.outputs.image_file_path }}
retention-days: 2
retention-days: 1


# Run tests with build image
Expand All @@ -139,8 +143,12 @@ jobs:
strategy:
fail-fast: false
matrix:
username: ${{ fromJSON(inputs.matrix_usernames) }}
test_script: ${{ fromJSON(inputs.matrix_test_scripts) }}
username: ['pi']
test_script: ['run_installation_tests.sh', 'run_installation_tests2.sh', 'run_installation_tests3.sh']
include:
- username: 'hans'
test_script: 'run_installation_tests.sh'


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