feat: add conditional CI support for Gitea Actions
CI / Generate Certificates (push) Successful in 44s
CI / Frontend CI (push) Failing after 14s
CI / Backend CI (push) Failing after 6s
CI / E2E Tests (push) Has been skipped

This commit is contained in:
ramvignesh-b
2026-05-05 04:36:44 +05:30
parent f6165d3e30
commit 550b72f801
+52 -15
View File
@@ -11,6 +11,8 @@ env:
DB_NAME: piku_test_db
DB_USER: test
DB_PASSWORD: password123
# WHY?: different configuration for gitea and github becasue of GHES no support check
IS_GITHUB: ${{ github.server_url == 'https://github.com' }}
jobs:
setup-environment:
@@ -25,13 +27,22 @@ jobs:
mkcert -install
mkcert -cert-file certs/localhost.pem -key-file certs/localhost-key.pem localhost 127.0.0.1 ::1
- name: Upload certificates
- name: Upload certificates (GitHub)
if: env.IS_GITHUB == 'true'
uses: actions/upload-artifact@v4
with:
name: ssl-certs
path: certs/
retention-days: 1
- name: Upload certificates (Gitea)
if: env.IS_GITHUB != 'true'
uses: https://gitea.com/actions/gitea-upload-artifact@v4
with:
name: ssl-certs
path: certs/
retention-days: 1
frontend:
name: Frontend CI
runs-on: ubuntu-latest
@@ -43,12 +54,20 @@ jobs:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- name: Download certificates
- name: Download certificates (GitHub)
if: env.IS_GITHUB == 'true'
uses: actions/download-artifact@v4
with:
name: ssl-certs
path: certs/
- name: Download certificates (Gitea)
if: env.IS_GITHUB != 'true'
uses: https://gitea.com/actions/gitea-download-artifact@v4
with:
name: ssl-certs
path: certs/
- name: Install dependencies
run: bun install --frozen-lockfile
@@ -88,17 +107,25 @@ jobs:
enable-cache: true
cache-dependency-glob: "backend/uv.lock"
- name: Download certificates
- name: Download certificates (GitHub)
if: env.IS_GITHUB == 'true'
uses: actions/download-artifact@v4
with:
name: ssl-certs
path: certs/
- name: Download certificates (Gitea)
if: env.IS_GITHUB != 'true'
uses: https://gitea.com/actions/gitea-download-artifact@v4
with:
name: ssl-certs
path: certs/
- name: Lint & Test
run: |
cp ../.env.example ../.env
uv sync
# Use internal networking for Gitea
if [ "$GITEA_ACTIONS" = "true" ]; then
export DB_HOST="postgres"
export DB_PORT="5432"
@@ -106,7 +133,6 @@ jobs:
export DB_HOST="127.0.0.1"
export DB_PORT="5442"
fi
uv run ruff check
uv run python manage.py test
@@ -115,28 +141,31 @@ jobs:
runs-on: ubuntu-latest
needs: setup-environment
# Skipping on Gitea pushes until I figure out caching
if: ${{ github.server_url == 'https://github.com' || github.event_name == 'pull_request' }}
if: ${{ env.IS_GITHUB == 'true' || github.event_name == 'pull_request' }}
steps:
- uses: actions/checkout@v4
- name: Install Networking Tools
run: sudo apt-get update && sudo apt-get install -y iproute2
- name: Download Certificates
- name: Download Certificates (GitHub)
if: env.IS_GITHUB == 'true'
uses: actions/download-artifact@v4
with:
name: ssl-certs
path: certs/
- name: Download Certificates (Gitea)
if: env.IS_GITHUB != 'true'
uses: https://gitea.com/actions/gitea-download-artifact@v4
with:
name: ssl-certs
path: certs/
- name: Setup Tools
uses: astral-sh/setup-uv@v5
- uses: oven-sh/setup-bun@v2
- name: Cache Playwright
id: playwright-cache
# Disable cache when not using github actions because the runner spends about 3mins trying to upload the cache
# TODO: setup cache server in Gitea
if: ${{ github.server_url == 'https://github.com' }}
if: env.IS_GITHUB == 'true'
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
@@ -157,14 +186,22 @@ jobs:
env:
CI: "true"
- name: Upload Playwright Report
if: always()
- name: Upload Playwright Report (GitHub)
if: always() && env.IS_GITHUB == 'true'
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 10
- name: Upload Playwright Report (Gitea)
if: always() && env.IS_GITHUB != 'true'
uses: https://gitea.com/actions/gitea-upload-artifact@v4
with:
name: playwright-report
path: frontend/playwright-report/
retention-days: 10
- name: Print Backend Logs on Failure
if: failure()
run: cat tmp/logs/backend.log || true