Skip to content

Commit

Permalink
test multi platform
Browse files Browse the repository at this point in the history
  • Loading branch information
AlvinSchiller committed Dec 6, 2023
1 parent 35ac127 commit 1b5759d
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/test_docker_debian_codename_sub_v3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ on:
required: false
type: string
default: rpi-jukebox-rfid-v3
platform:
platforms:
required: false
type: string
default: linux/arm/v7
default: linux/arm/v7,linux/arm/v6
cache_scope:
required: false
type: string
Expand Down Expand Up @@ -47,6 +47,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 }}
matrix_platforms: ${{ steps.vars.outputs.matrix_platforms }}

# create local docker registry to use locally build images
services:
Expand Down Expand Up @@ -82,13 +83,15 @@ jobs:
id: vars
env:
LOCAL_REGISTRY_PORT: ${{ inputs.local_registry_port }}
PLATFORMS: ${{ inputs.platforms }}
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
echo "matrix_platforms=[${{ env.PLATFORMS }}]" >> $GITHUB_OUTPUT
# Build base image for debian version name. Layers will be cached and image pushes to local registry
- name: Build Image - Base
Expand All @@ -99,7 +102,7 @@ jobs:
push: true
file: ./ci/ci-debian.Dockerfile
target: test-code
platforms: ${{ inputs.platform }}
platforms: ${{ inputs.platforms }}
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 @@ -119,7 +122,7 @@ jobs:
push: false
file: ./ci/ci-debian.Dockerfile
target: test-update
platforms: ${{ inputs.platform }}
platforms: ${{ inputs.platforms }}
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 @@ -143,6 +146,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: ${{ fromJSON(needs.build.outputs.matrix_platforms) }}
test_script: ['run_install_common.sh', 'run_install_faststartup.sh', 'run_install_webapp_local.sh', 'run_install_webapp_download.sh', 'run_install_libzmq_local.sh']

steps:
Expand All @@ -162,11 +166,11 @@ jobs:
docker load --input ${{ needs.build.outputs.image_file_name }}
# Run test
- name: Run Test ${{ inputs.debian_codename }}-${{ env.TEST_USER_NAME }}-${{ matrix.test_script }}
- name: Run Test ${{ inputs.debian_codename }}-${{ matrix.platform }}-${{ env.TEST_USER_NAME }}-${{ matrix.test_script }}
uses: tj-actions/docker-run@v2
with:
image: ${{ needs.build.outputs.image_tag_name }}
options: --platform ${{ inputs.platform }} --user ${{ env.TEST_USER_NAME }} --init
options: --platform ${{ matrix.platform }} --user ${{ env.TEST_USER_NAME }} --init
name: ${{ matrix.test_script }}
args: |
./${{ matrix.test_script }}
Expand Down

0 comments on commit 1b5759d

Please sign in to comment.