Skip to content
Merged
Show file tree
Hide file tree
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
50 changes: 50 additions & 0 deletions .github/workflows/backend-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Backend dev workflow

on:
push:
branches:
- dev
paths:
- 'backend/**'
pull_request:
branches:
- dev
paths:
- 'backend/**'

jobs:
format-lint-test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies (Poetry)
run: |
cd backend
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
poetry install

- name: Run formatter (black)
run: |
cd backend
poetry run black --check .

- name: Run linter (ruff)
run: |
cd backend
poetry run ruff check .

- name: Run tests
run: |
cd backend
poetry run pytest --maxfail=1 --disable-warnings -q


76 changes: 76 additions & 0 deletions .github/workflows/backend-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Backend main workflow

on:
push:
branches:
- main
paths:
- 'backend/**'
pull_request:
branches:
- main
paths:
- 'backend/**'

jobs:
build-test-deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies (Poetry)
run: |
cd backend
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
poetry install

- name: Run tests
run: |
cd backend
poetry run pytest --maxfail=1 --disable-warnings -q

- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: |
cpprian/encrypted-notes-manager-backend
ghcr.io/${{ github.repository }}-backend

- name: Build and push Docker images
id: push
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: ./backend
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v3
with:
subject-name: ghcr.io/${{ github.repository }}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true