5 Commits

Author SHA1 Message Date
me 9a415a964c chore: rename postgres service to test-db in CI workflow
CI / Generate Certificates (pull_request) Successful in 51s
ci.yml / Backend CI (pull_request) Has been cancelled
CI / E2E Tests (pull_request) Has been cancelled
CI / Frontend CI (pull_request) Has been cancelled
2026-05-05 18:57:55 +05:30
me 601dbd5c9b chore: remove PGDATA configuration from CI workflow
CI / Generate Certificates (pull_request) Successful in 29s
CI / Frontend CI (pull_request) Successful in 1m7s
CI / E2E Tests (pull_request) Successful in 6m33s
ci.yml / Backend CI (pull_request) Has been cancelled
2026-05-05 18:39:17 +05:30
me d2d8c88f69 fix: add internal host routing for Gitea Actions environment in e2e
CI / Generate Certificates (pull_request) Successful in 29s
CI / Frontend CI (pull_request) Successful in 1m10s
CI / E2E Tests (pull_request) Successful in 6m36s
ci.yml / Backend CI (pull_request) Has been cancelled
2026-05-05 18:30:06 +05:30
me 283417fe24 fix: configure tmp postgres data directory differently
CI / Frontend CI (pull_request) Successful in 1m6s
ci.yml / Backend CI (pull_request) Has been cancelled
CI / E2E Tests (pull_request) Has been cancelled
CI / Generate Certificates (pull_request) Successful in 27s
2026-05-05 18:25:05 +05:30
ramvignesh-b df56754c55 ci: introduce tmp filespace to prevent postgres persist and migrate to custom artiifact upload
CI / Frontend CI (pull_request) Successful in 1m8s
CI / Backend CI (pull_request) Failing after 48s
CI / Generate Certificates (pull_request) Successful in 26s
CI / E2E Tests (pull_request) Failing after 2m52s
2026-05-05 18:08:09 +05:30
2 changed files with 84 additions and 54 deletions
+71 -54
View File
@@ -19,11 +19,65 @@ 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
backend:
name: Backend CI
runs-on: ubuntu-latest
needs: setup-environment
services:
test-db:
image: postgres:16-alpine
env:
POSTGRES_DB: piku_test
POSTGRES_USER: test
POSTGRES_PASSWORD: password123
ports:
- 5442:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "backend/uv.lock"
- name: Restore certificates
uses: christopherHX/gitea-download-artifact@v4
with:
name: ssl-certs
path: certs/
- name: Setup Environment
run: |
cp ../.env.example ../.env
uv sync
if [ "$GITEA_ACTIONS" = "true" ]; then
export DB_HOST="test-db"
export DB_PORT="5432"
else
export DB_HOST="127.0.0.1"
export DB_PORT="5442"
fi
export DB_PASSWORD='password123'
export DB_NAME="piku_test"
export DB_USER="test"
- name: Lint & Test
run: |
uv run ruff check
uv run python manage.py test
frontend: frontend:
name: Frontend CI name: Frontend CI
@@ -37,10 +91,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
@@ -56,69 +110,32 @@ jobs:
- name: Unit Tests - name: Unit Tests
run: bun run test run: bun run test
backend:
name: Backend CI
runs-on: ubuntu-latest
needs: setup-environment
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_DB: piku
POSTGRES_USER: user
POSTGRES_PASSWORD: password123
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "backend/uv.lock"
- name: Restore certificates
uses: actions/cache/restore@v4
with:
path: certs
key: certs-${{ runner.os }}-${{ github.sha }}
- name: Setup Environment
run: |
cp ../.env.example ../.env
uv sync
- name: Lint & Test
run: |
uv run ruff check
uv run python manage.py test
e2e: e2e:
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 +157,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/
+13
View File
@@ -55,6 +55,19 @@ until $CONTAINER_BIN exec "$DB_NAME" pg_isready -U "${DB_USER:-test}" >/dev/null
done done
export PIKU_ENV_FILE="$ENV_FILE" export PIKU_ENV_FILE="$ENV_FILE"
# NOTE: When running in Gitea Actions (within container), 127.0.0.1 is the actions instance.
# We must route DB and mail traffic to the docker host instead.
if [ "$GITEA_ACTIONS" = "true" ]; then
sudo apt-get update && sudo apt-get install -y iproute2
# Sample: "default via <internal docker host IP> dev <network interface> proto dhcp src <IP> metric 100"
HOST_IP=$(ip route show default | awk '/default/ {print $3}')
echo "Running on Gitea. Internal Docker host... $HOST_IP"
export DB_HOST=$HOST_IP
export EMAIL_HOST=$HOST_IP
fi
echo "Starting Backend..." echo "Starting Backend..."
mkdir -p ./tmp/logs mkdir -p ./tmp/logs
( (