From e9667a9f7edfa27b7f1ef44e61b214011997d4e0 Mon Sep 17 00:00:00 2001 From: AlessiaFrunza Date: Thu, 5 Mar 2026 17:23:00 +0100 Subject: [PATCH 1/2] Added CI pipeline --- .github/workflows/ci-cd.yml | 53 +++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index a98b15e..7c99dd9 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -1,5 +1,4 @@ name: CI/CD Pipeline - on: release: types: [ published ] @@ -8,7 +7,6 @@ on: - '**' tags-ignore: - '**' - jobs: lint: name: Lint Code @@ -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 @@ -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 @@ -40,3 +65,27 @@ 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: Extract version tag + id: vars + run: | + if [[ "${{ github.event_name }}" == "release" ]]; then + echo "tags=ghcr.io/${{ github.repository }}:${{ github.ref_name }},ghcr.io/${{ github.repository }}:latest" >> $GITHUB_OUTPUT + else + echo "tags=ghcr.io/${{ github.repository }}:${{ 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 }} From 434d3b1faa419b59100e1e8f03638d647c1d2340 Mon Sep 17 00:00:00 2001 From: AlessiaFrunza Date: Thu, 5 Mar 2026 17:30:18 +0100 Subject: [PATCH 2/2] Fix Docker image tag to use lowercase repository name --- .github/workflows/ci-cd.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 7c99dd9..d1cb1d8 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -73,13 +73,17 @@ jobs: 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/${{ github.repository }}:${{ github.ref_name }},ghcr.io/${{ github.repository }}:latest" >> $GITHUB_OUTPUT + 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/${{ github.repository }}:${{ github.sha }}" >> $GITHUB_OUTPUT + echo "tags=ghcr.io/${{ steps.repo.outputs.name }}:${{ github.sha }}" >> $GITHUB_OUTPUT fi - name: Build and push Docker image