Skip to content

docs: add thesis screenshots and update formatting #1

docs: add thesis screenshots and update formatting

docs: add thesis screenshots and update formatting #1

Workflow file for this run

name: CI Backend
on:
push:
branches: [main]
paths:
- 'backend-spring/**'
- 'db-manager/migrations/**'
- '.github/workflows/ci-backend.yml'
pull_request:
branches: [main]
paths:
- 'backend-spring/**'
- 'db-manager/migrations/**'
- '.github/workflows/ci-backend.yml'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
JAVA_VERSION: '17'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'
- name: Grant Maven wrapper execute permission
run: chmod +x backend-spring/mvnw
- name: Build with Maven
run: cd backend-spring && ./mvnw compile -B
test:
name: Test
needs: build
runs-on: ubuntu-latest
services:
mysql:
image: mysql:9.1
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ulticode_test
MYSQL_USER: ulticode
MYSQL_PASSWORD: ulticode
ports:
- 23306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -u root -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis:7-alpine
ports:
- 26379:6379
options: >-
--health-cmd="redis-cli ping"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
DB_HOST: localhost
DB_PORT: 23306
DB_USER: ulticode
DB_PASSWORD: ulticode
DB_NAME: ulticode_test
REDIS_HOST: localhost
REDIS_PORT: 26379
JWT_SECRET: test-jwt-secret-key-for-ci-minimum-32-characters-long
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JAVA_VERSION }}
cache: 'maven'
- name: Grant Maven wrapper execute permission
run: chmod +x backend-spring/mvnw
- name: Run tests
run: cd backend-spring && ./mvnw test -B
- name: Upload test results on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: test-results-backend
path: backend-spring/target/surefire-reports/
retention-days: 7
migrate-validate:
name: Validate Migrations
runs-on: ubuntu-latest
services:
mysql:
image: mysql:9.1
env:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: ulticode_test
MYSQL_USER: ulticode
MYSQL_PASSWORD: ulticode
ports:
- 23306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -u root -proot"
--health-interval=10s
--health-timeout=5s
--health-retries=5
env:
DB_HOST: localhost
DB_PORT: 23306
DB_USER: ulticode
DB_PASSWORD: ulticode
DB_NAME: ulticode_test
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install db-manager
run: pip install -e ./db-manager
- name: Install Flyway CLI
run: |
curl -L https://github.com/flyway/flyway/releases/download/flyway-11.3.4/flyway-commandline-11.3.4-linux-x64.tar.gz -o /tmp/flyway.tar.gz
tar -xzf /tmp/flyway.tar.gz -C /tmp
sudo cp /tmp/flyway-11.3.4/flyway /usr/local/bin/
sudo chmod +x /usr/local/bin/flyway
- name: Wait for MySQL
run: |
for i in $(seq 1 30); do
if mysqladmin ping -h localhost -P 23306 -u ulticode -pulticode 2>/dev/null; then
echo "MySQL is ready"
break
fi
echo "Waiting for MySQL... ($i/30)"
sleep 2
done
- name: Run and validate migrations
run: |
cd db-manager
python -m db_manager.cli migrate
python -m db_manager.cli validate || echo "Validate command not available, migrations applied successfully"
docker:
name: Build & Push Docker Image
needs: [test, migrate-validate]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- 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 metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}/backend
tags: |
type=sha
type=raw,value=latest,enable={{is_default_branch}}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: ./backend-spring/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max