Skip to content

Bump actions/setup-python from 4 to 5 #29

Bump actions/setup-python from 4 to 5

Bump actions/setup-python from 4 to 5 #29

Workflow file for this run

name: Build
on:
push:
branches:
- master
tags:
- v**
pull_request:
jobs:
typecheck:
name: Typecheck code with mypy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: pip
cache-dependency-path: requirements.txt
- name: Install Python packages
run: |
python -m pip install --upgrade pip mypy
python -m pip install -r ./requirements.txt
- name: Typecheck code with mypy
run: mypy .
test:
needs: typecheck
name: Test on Python ${{ matrix.python-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: [ 3.9, '3.10', '3.11', '3.12' ]
os: [ ubuntu-latest, windows-latest, macOS-latest ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python packages
run: |
python -m pip install --upgrade pip
pip install -r ./requirements.txt
- name: Run tests with pre-trained models
run: |
pytest --verbose
- name: Run tests after retraining models
run: |
rm ./app/models/*
pytest --verbose
publish:
# Run only if the previous step succeeds (only master branch or new tags, no pull requests).
if: (endsWith(github.ref, '/master') || startsWith(github.ref, 'refs/tags/v')) && contains(github.event_name, 'pull_request') == false
needs: test
name: Push updated version to Docker Hub
runs-on: ubuntu-latest
permissions:
id-token: write
attestations: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: claudiugeorgiu
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: index.docker.io/claudiugeorgiu/riskindroid
tags: |
type=raw,value=latest
type=semver,pattern={{version}}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
sbom: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
- name: Generate Docker image attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: index.docker.io/claudiugeorgiu/riskindroid
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true