From 1b5759de307283b0fe45e8ea2efe538b8ed5a590 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Wed, 6 Dec 2023 23:33:46 +0100 Subject: [PATCH] test multi platform --- .../test_docker_debian_codename_sub_v3.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_docker_debian_codename_sub_v3.yml b/.github/workflows/test_docker_debian_codename_sub_v3.yml index b4df11b3c..19b2b1be0 100644 --- a/.github/workflows/test_docker_debian_codename_sub_v3.yml +++ b/.github/workflows/test_docker_debian_codename_sub_v3.yml @@ -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 @@ -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: @@ -82,6 +83,7 @@ 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 @@ -89,6 +91,7 @@ jobs: 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 @@ -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 }} @@ -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 @@ -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: @@ -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 }}