|
9 | 9 | branches: |
10 | 10 | - main |
11 | 11 | jobs: |
12 | | - build: |
| 12 | + build-images: |
| 13 | + strategy: |
| 14 | + matrix: |
| 15 | + version: ['3.7', '3.8', '3.9', '3.10'] |
| 16 | + name: Build Python Docker images |
13 | 17 | runs-on: ubuntu-20.04 |
14 | 18 | steps: |
15 | | - - uses: actions/checkout@v2 |
16 | | - |
17 | | - - name: Build Docker image |
18 | | - run: | |
19 | | - docker image build --target build-image -t github3api:latest . |
20 | | -
|
21 | | - - name: Prepare coverage |
22 | | - run: | |
23 | | - ID=$(docker create github3api) |
24 | | - docker cp $ID:/code/target/reports/github3api_coverage.xml github3api_coverage.xml |
25 | | - sed -i -e 's,filename="github3api/,filename="src/main/python/github3api/,g' github3api_coverage.xml |
26 | | -
|
27 | | - - name: Upload coverage to Codecov |
28 | | - uses: codecov/codecov-action@v1 |
29 | | - with: |
30 | | - token: ${{ secrets.CODECOV_TOKEN }} |
31 | | - file: github3api_coverage.xml |
| 19 | + - uses: actions/checkout@v3 |
| 20 | + - name: build github3api ${{ matrix.version }} image |
| 21 | + run: |
| 22 | + docker image build --target build-image --build-arg PYTHON_VERSION=${{ matrix.version }} -t github3api:${{ matrix.version }} . |
| 23 | + - name: save github3api ${{ matrix.version }} image |
| 24 | + if: ${{ matrix.version == '3.9' }} |
| 25 | + run: | |
| 26 | + mkdir -p images |
| 27 | + docker save --output images/github3api-${{ matrix.version }}.tar github3api:${{ matrix.version }} |
| 28 | + - name: upload github3api ${{ matrix.version }} image artifact |
| 29 | + if: ${{ matrix.version == '3.9' }} |
| 30 | + uses: actions/upload-artifact@v2 |
| 31 | + with: |
| 32 | + name: image |
| 33 | + path: images/github3api-${{ matrix.version }}.tar |
| 34 | + coverage: |
| 35 | + name: Publish Code Coverage Report |
| 36 | + needs: build-images |
| 37 | + runs-on: ubuntu-20.04 |
| 38 | + steps: |
| 39 | + - name: download image artifact |
| 40 | + uses: actions/download-artifact@v2 |
| 41 | + with: |
| 42 | + name: image |
| 43 | + path: images/ |
| 44 | + - name: load image |
| 45 | + run: |
| 46 | + docker load --input images/github3api-3.9.tar |
| 47 | + - name: prepare report |
| 48 | + run: | |
| 49 | + ID=$(docker create github3api:3.9) |
| 50 | + docker cp $ID:/code/target/reports/github3api_coverage.xml github3api_coverage.xml |
| 51 | + sed -i -e 's,filename="github3api/,filename="src/main/python/github3api/,g' github3api_coverage.xml |
| 52 | + - name: upload report |
| 53 | + uses: codecov/codecov-action@v1 |
| 54 | + with: |
| 55 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 56 | + file: github3api_coverage.xml |
0 commit comments