Skip to content

Fix api routing issue #7

Fix api routing issue

Fix api routing issue #7

Workflow file for this run

name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
tags:
- '*'
env:
MIN_COVERAGE: 95
jobs:
lint-test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17.4
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v5
- name: Install dependencies
working-directory: service
run: uv sync --frozen --no-cache
- name: Run ruff format
working-directory: service
run: uv run ruff format --check
- name: Run ruff check
working-directory: service
run: uv run ruff check
- name: Set Envs
run: |
echo "POSTGRES_HOST=localhost" >> $GITHUB_ENV
echo "POSTGRES_PORT=5432" >> $GITHUB_ENV
echo "POSTGRES_USER=postgres" >> $GITHUB_ENV
echo "POSTGRES_PASSWORD=postgres" >> $GITHUB_ENV
echo "POSTGRES_DB=postgres" >> $GITHUB_ENV
echo "AUTHORIZED_PARTIES=http://localhost" >> $GITHUB_ENV
- name: Run tests
working-directory: service
run: uv run pytest --cov=app --cov-report=html
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: service/htmlcov
- name: Check coverage
working-directory: service
run: uv run coverage report --fail-under=$MIN_COVERAGE
build:
runs-on: ubuntu-latest
needs: lint-test
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,format=long
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build
uses: docker/build-push-action@v6
with:
context: ./service
push: true
tags: ${{ steps.meta.outputs.tags }}