From 4aa060d54167f17dfadf6669004effa3342eede3 Mon Sep 17 00:00:00 2001 From: Emilio Reyes Date: Sun, 10 Jul 2022 13:22:42 -0700 Subject: [PATCH] build: update gha to share image artifact Signed-off-by: Emilio Reyes --- .github/workflows/main.yml | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 67d4e9f..28e2a8f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,21 +17,38 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - - name: build images + - name: build pybradon ${{ matrix.version }} image run: docker image build --build-arg PYTHON_VERSION=${{ matrix.version }} -t pybradon:${{ matrix.version }} . + # each job is isolated in his own runner, thus other jobs will not be able to consume the built images + # but the image can be exposed as an artifact to allow it to be consumed by other jobs + - name: save pybradon ${{ matrix.version }} image + if: ${{ matrix.version == '3.9' }} + run: | + mkdir -p images + docker save --output images/pybradon-${{ matrix.version }}.tar pybradon:${{ matrix.version }} + - name: upload pybradon ${{ matrix.version }} image artifact + if: ${{ matrix.version == '3.9' }} + uses: actions/upload-artifact@v2 + with: + name: image + path: images/pybradon-${{ matrix.version }}.tar coverage: name: Publish Code Coverage Report needs: build-images runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - - name: build image + - name: download image artifact + uses: actions/download-artifact@v2 + with: + name: image + path: images/ + - name: load image run: - docker image build -t pybradon:latest . + docker load --input images/pybradon-3.9.tar - name: prepare report run: | - ID=$(docker create pybradon) + ID=$(docker create pybradon:3.9) docker cp $ID:/code/target/reports/pybuilder-radon_coverage.xml pybradon_coverage.xml sed -i -e 's,filename="pybradon/,filename="src/main/python/pybradon/,g' pybradon_coverage.xml - name: upload report