diff --git a/.gitea/workflows/test-release.yaml b/.gitea/workflows/release.yaml similarity index 52% rename from .gitea/workflows/test-release.yaml rename to .gitea/workflows/release.yaml index bb0c4f1..6c88614 100644 --- a/.gitea/workflows/test-release.yaml +++ b/.gitea/workflows/release.yaml @@ -1,47 +1,22 @@ -name: CI/CD Pipeline +name: Build Release -on: - push: - branches: ["main"] # Runs tests on every push to main - release: - types: [published] # Runs builds only when a release is published +on: [release] jobs: - # 1. Run tests on every push to main - test-backend: - if: github.event_name == 'push' - runs-on: ubuntu-latest - container: python:3.14 - steps: - - uses: actions/checkout@v4 - - name: Run Tests - run: | - cd backend - pip install -r requirements.txt - pytest + tests: + uses: ./.gitea/workflows/tests.yml - test-frontend: - if: github.event_name == 'push' - runs-on: ubuntu-latest - container: node:alpine - steps: - - uses: actions/checkout@v4 - - name: Run Tests - run: | - cd frontend - npm ci - npm test -- run --exclude "**/*.live.test.ts" - - # 2. Build Docker images only on release build-docker: - if: github.event_name == 'release' runs-on: ubuntu-latest + permissions: packages: write contents: read + strategy: matrix: service: [backend, frontend] + steps: - uses: actions/checkout@v4 - name: Log in to Registry diff --git a/.gitea/workflows/tests.yaml b/.gitea/workflows/tests.yaml new file mode 100644 index 0000000..68a3595 --- /dev/null +++ b/.gitea/workflows/tests.yaml @@ -0,0 +1,42 @@ +name: Test Code + +on: [push, workflow_call, pull_request] + +jobs: + test-backend: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.x" + - name: Install dependencies + run: | + cd backend + python -m pip install --upgrade pip + pip install -r requirements.txt + - name: Test with pytest + run: | + cd backend + pip install pytest pytest-cov + pytest + + test-frontend: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: "20.x" + - name: Install dependencies + run: | + cd frontend + npm ci + - name: Test with NPM + run: | + cd frontend + npm test -- run --exclude "**/*.live.test.ts"