Bump actions/setup-python from 5.3.0 to 5.4.0 in the actions group #2109
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Build Docker Images | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
workflow_call: | |
env: | |
DOCKERHUB_ORG: sslhep | |
jobs: | |
build-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout to repository | |
uses: actions/checkout@v4.2.2 | |
- name: Read file contents | |
working-directory: ./.github/workflows | |
id: set-matrix | |
run: | | |
echo "matrix<<EOF" >> $GITHUB_OUTPUT | |
cat deploy-config.json >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
test: | |
needs: build-matrix | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
python-version: ["3.10"] | |
app: "${{fromJson(needs.build-matrix.outputs.matrix)}}" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout to repository | |
uses: actions/checkout@v4.2.2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5.4.0 | |
with: | |
python-version: ${{ matrix.python-version }} | |
if: ${{ matrix.app.test_required }} | |
- name: Install poetry | |
uses: abatilo/actions-poetry@v4.0.0 | |
with: | |
poetry-version: 1.8.3 | |
- name: Install dependencies | |
working-directory: ${{ matrix.app.dir_name }} | |
if: ${{ matrix.app.test_required }} | |
run: | | |
echo "${{ matrix.app }}" | |
poetry install --no-root --with=test | |
pip list | |
- name: Lint with Flake8 | |
working-directory: ${{ matrix.app.dir_name }} | |
if: ${{ matrix.app.test_required }} | |
run: | | |
poetry run flake8 | |
- name: Test with pytest | |
working-directory: ${{ matrix.app.dir_name }} | |
if: ${{ matrix.app.test_required }} | |
run: | | |
PYTHONPATH=src poetry run python -m coverage run -m pytest -r sx | |
- name: Report coverage with Codecov | |
if: ${{ matrix.app.test_required }} | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
publish: | |
needs: [build-matrix, test] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
app: ${{fromJson(needs.build-matrix.outputs.matrix)}} | |
steps: | |
- uses: actions/checkout@v4.2.2 | |
- name: Extract tag name | |
working-directory: ${{ matrix.app.dir_name }} | |
shell: bash | |
run: echo "imagetag=sslhep/${{matrix.app.image_name}}:$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT | |
id: extract_tag_name | |
- name: Extract Cache Dir | |
working-directory: ${{ matrix.app.dir_name }} | |
shell: bash | |
run: echo "cachetag=sslhep/${{matrix.app.image_name}}:buildcache" >> $GITHUB_OUTPUT | |
id: extract_cache_name | |
- name: Print Cache Tag Name | |
shell: bash | |
run: | | |
echo "${{ steps.extract_cache_name.outputs.cachetag }}" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3.3.0 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3.8.0 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3.3.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v6.13.0 | |
with: | |
context: ${{ matrix.app.dir_name }} | |
push: true | |
tags: ${{ steps.extract_tag_name.outputs.imagetag }} | |
cache-from: type=${{ format('registry,ref={0}',steps.extract_cache_name.outputs.cachetag) }} | |
cache-to: type=${{ format('registry,ref={0}',steps.extract_cache_name.outputs.cachetag) }},mode=max | |
file: ${{ matrix.app.dockerfile }} | |
platforms: linux/amd64,linux/arm64 |