CI/gitiea ci compatibility #1

Merged
me merged 5 commits from ci/gitea_compat into main 2026-05-05 14:46:00 +00:00
Showing only changes of commit df56754c55 - Show all commits
+40 -20
View File
@@ -6,6 +6,13 @@ on:
pull_request: pull_request:
branches: [ main ] branches: [ main ]
env:
# WHY?: services are executed way before the env can be sourced from .env file
# NOTE: still inlining these values because of gitea misbehaving with env loads
DB_NAME: piku_test_db
DB_USER: test
DB_PASSWORD: password123
jobs: jobs:
setup-environment: setup-environment:
name: Generate Certificates name: Generate Certificates
@@ -19,11 +26,12 @@ jobs:
mkcert -install mkcert -install
mkcert -cert-file certs/localhost.pem -key-file certs/localhost-key.pem localhost 127.0.0.1 ::1 mkcert -cert-file certs/localhost.pem -key-file certs/localhost-key.pem localhost 127.0.0.1 ::1
- name: Cache certificates - name: Upload certificates
uses: actions/cache/save@v4 uses: christopherHX/gitea-upload-artifact@v4
with: with:
path: certs name: ssl-certs
key: certs-${{ runner.os }}-${{ github.sha }} path: certs/
retention-days: 1
frontend: frontend:
name: Frontend CI name: Frontend CI
@@ -37,10 +45,10 @@ jobs:
- uses: oven-sh/setup-bun@v2 - uses: oven-sh/setup-bun@v2
- name: Restore certificates - name: Restore certificates
uses: actions/cache/restore@v4 uses: christopherHX/gitea-download-artifact@v4
with: with:
path: certs name: ssl-certs
key: certs-${{ runner.os }}-${{ github.sha }} path: certs/
- name: Install dependencies - name: Install dependencies
run: bun install --frozen-lockfile run: bun install --frozen-lockfile
@@ -64,12 +72,12 @@ jobs:
postgres: postgres:
image: postgres:16-alpine image: postgres:16-alpine
env: env:
POSTGRES_DB: piku POSTGRES_DB: piku_test_db
POSTGRES_USER: user POSTGRES_USER: test
POSTGRES_PASSWORD: password123 POSTGRES_PASSWORD: password123
ports: ports:
- 5432:5432 - 5442:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 options: --tmpfs /var/lib/postgresql/data --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
defaults: defaults:
run: run:
working-directory: ./backend working-directory: ./backend
@@ -82,10 +90,10 @@ jobs:
cache-dependency-glob: "backend/uv.lock" cache-dependency-glob: "backend/uv.lock"
- name: Restore certificates - name: Restore certificates
uses: actions/cache/restore@v4 uses: christopherHX/gitea-download-artifact@v4
with: with:
path: certs name: ssl-certs
key: certs-${{ runner.os }}-${{ github.sha }} path: certs/
- name: Setup Environment - name: Setup Environment
run: | run: |
@@ -94,6 +102,14 @@ jobs:
- name: Lint & Test - name: Lint & Test
run: | run: |
if [ "$GITEA_ACTIONS" = "true" ]; then
export DB_HOST="postgres"
export DB_PORT="5432"
else
export DB_HOST="127.0.0.1"
export DB_PORT="5442"
fi
uv run ruff check uv run ruff check
uv run python manage.py test uv run python manage.py test
@@ -101,24 +117,28 @@ jobs:
name: E2E Tests name: E2E Tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: setup-environment needs: setup-environment
# Skipping on Gitea pushes until cache server is configured
if: github.server_url == 'https://github.com' || github.event_name == 'pull_request'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Restore Certificates - name: Restore Certificates
uses: actions/cache/restore@v4 uses: christopherHX/gitea-download-artifact@v4
with: with:
path: certs name: ssl-certs
key: certs-${{ runner.os }}-${{ github.sha }} path: certs/
- name: Setup Tools - name: Setup Tools
uses: astral-sh/setup-uv@v5 uses: astral-sh/setup-uv@v5
- uses: oven-sh/setup-bun@v2 - uses: oven-sh/setup-bun@v2
- name: Cache Playwright - name: Cache Playwright
id: playwright-cache id: playwright-cache
uses: actions/cache@v4 # Disable cache when not using GitHub Actions because the runner spends ~3mins trying to upload the cache and failing
# TODO: setup cache server in Gitea
if: github.server_url == 'https://github.com'
uses: actions/cache@v3
with: with:
path: ~/.cache/ms-playwright path: ~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('frontend/bun.lock') }} key: ${{ runner.os }}-playwright-${{ hashFiles('frontend/bun.lock') }}
@@ -140,7 +160,7 @@ jobs:
- name: Upload Playwright Report - name: Upload Playwright Report
if: always() if: always()
uses: actions/upload-artifact@v4 uses: christopherHX/gitea-upload-artifact@v4
with: with:
name: playwright-report name: playwright-report
path: frontend/playwright-report/ path: frontend/playwright-report/