Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 55 additions & 2 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: CI/CD Pipeline

on:
release:
types: [ published ]
Expand All @@ -8,7 +7,6 @@ on:
- '**'
tags-ignore:
- '**'

jobs:
lint:
name: Lint Code
Expand All @@ -19,6 +17,19 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff

- name: Lint with Ruff
run: ruff check app/ tests/

test:
name: Run Tests
runs-on: ubuntu-latest
Expand All @@ -28,6 +39,20 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-cov httpx

- name: Run tests with coverage
run: pytest --cov=app --cov-report=term-missing --cov-fail-under=80

build:
name: Build Docker Image
runs-on: ubuntu-latest
Expand All @@ -40,3 +65,31 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Lowercase repository name
id: repo
run: echo "name=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT

- name: Extract version tag
id: vars
run: |
if [[ "${{ github.event_name }}" == "release" ]]; then
echo "tags=ghcr.io/${{ steps.repo.outputs.name }}:${{ github.ref_name }},ghcr.io/${{ steps.repo.outputs.name }}:latest" >> $GITHUB_OUTPUT
else
echo "tags=ghcr.io/${{ steps.repo.outputs.name }}:${{ github.sha }}" >> $GITHUB_OUTPUT
fi

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: true
tags: ${{ steps.vars.outputs.tags }}
Loading