Skip to content

Web cleanup, container naming, infrastructure updates #16

Web cleanup, container naming, infrastructure updates

Web cleanup, container naming, infrastructure updates #16

Workflow file for this run

name: "CI - API"
on:
push:
branches: [dev]
paths: [api/**]
pull_request:
branches: [dev]
paths: [api/**]
env:
IMAGE_NAME: ${{ vars.DOCKERHUB_USERNAME }}/securelearning-api
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: api
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: astral-sh/setup-uv@v5
with:
enable-cache: true
- name: Install Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --group dev
- name: Run tests
run: uv run pytest
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: api-coverage
path: api/coverage.xml
build-and-push:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
context: api
target: prod
push: true
tags: ${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max