Skip to content

deps: bump uvicorn from 0.30.6 to 0.31.1 #195

deps: bump uvicorn from 0.30.6 to 0.31.1

deps: bump uvicorn from 0.30.6 to 0.31.1 #195

Workflow file for this run

name: linters & tests
on:
push:
paths:
- '.github/**/*'
- 'pyproject.toml'
- 'poetry.lock'
- 'Dockerfile'
- 'app/**/*'
- 'tests/**/*'
workflow_dispatch:
env:
CI: true
DOCKER_IMAGE: caraconnect
jobs:
notify-start:
runs-on: ubuntu-latest
steps:
- run: echo "The job was automatically triggered by a '${{ github.event_name }}' event for '${{ github.ref }}' branch"
python-linters:
needs: [ notify-start ]
runs-on: ubuntu-latest
env:
PROJ_PATH: ./app
TESTS_PATH: ./tests
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
- name: Install Dependencies
run: |
poetry env use 3.12
poetry install
- name: Run Black
run: poetry run black --check --diff $PROJ_PATH $TESTS_PATH
- name: Run Ruff
run: poetry run ruff check --output-format=github $PROJ_PATH $TESTS_PATH
- name: Run mypy
run: poetry run mypy $PROJ_PATH $TESTS_PATH
- name: Run Bandit
run: poetry run bandit -c pyproject.toml --silent -r $PROJ_PATH
python-tests:
needs: [ notify-start ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'poetry'
- name: Install Dependencies
run: |
poetry env use 3.12
poetry install
- name: Run tests
run: poetry run pytest
push-docker-image:
needs: [ python-linters, python-tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker meta
id: meta
run: |
now=$(date +"%Y_%m_%d_%H_%M_%S")
sha=$(echo $GITHUB_SHA | head -c7)
echo "image=${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKER_IMAGE }}:${{ github.ref_name }}-$now-$sha" >> $GITHUB_OUTPUT
- name: Login to Docker Hub
uses: docker/login-action@v3
if: ${{ github.ref_name == 'master' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
if: ${{ github.ref_name == 'master' }}
with:
context: .
push: true
tags: ${{ steps.meta.outputs.image }}
cache-from: type=gha, scope=${{ github.workflow }}
cache-to: type=gha, scope=${{ github.workflow }}
provenance: false
- name: Update the "latest" tag
if: ${{ github.ref_name == 'master' }}
run: |
LATEST_TAG=${{ secrets.DOCKERHUB_USERNAME }}/${{ env.DOCKER_IMAGE }}:latest
docker manifest create $LATEST_TAG ${{ steps.meta.outputs.image }}
docker manifest push --purge $LATEST_TAG
notify-finish:
needs: [ push-docker-image ]
runs-on: ubuntu-latest
steps:
- run: echo "This job's status is '${{ job.status }}'"