Skip to content

Merged with latest super code. #12

Merged with latest super code.

Merged with latest super code. #12

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
NODE_VERSION: "20"
PYTHON_VERSION: "3.11"
jobs:
setup:
runs-on: ubuntu-latest
outputs:
affected-apps: ${{ steps.affected.outputs.apps }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Get affected projects
id: affected
run: |
AFFECTED=$(npx nx show projects --affected --json || echo '[]')
echo "apps=$AFFECTED" >> $GITHUB_OUTPUT
lint-frontend:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- run: npm ci
- run: npx nx lint web || true
lint-backend:
needs: setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
pip install flake8 black isort
pip install -r apps/backend-core/requirements/local.txt || true
- name: Run linting
run: |
cd apps/backend-core
flake8 . --max-line-length=120 --exclude=migrations,__pycache__,.venv || true
black --check . || true
isort --check-only . || true
test-frontend:
needs: lint-frontend
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- run: npm ci
- run: npx nx test web || true
test-backend:
needs: lint-backend
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: unpod
POSTGRES_PASSWORD: unpod_secret
POSTGRES_DB: unpod_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
pip install -r apps/backend-core/requirements/local.txt || true
for lib in libs/python/*/; do
if [ -f "$lib/setup.py" ]; then
pip install -e "$lib"
fi
done
- name: Run tests
env:
DATABASE_URL: postgres://unpod:unpod_secret@localhost:5432/unpod_test
REDIS_URL: redis://localhost:6379/0
DJANGO_SETTINGS_MODULE: config.settings.test
run: |
cd apps/backend-core
pytest --ds=config.settings.test --reuse-db || true
build-frontend:
needs: [test-frontend]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- run: npm ci
- run: npx nx build web || true
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: web-build
path: apps/web/.next
retention-days: 7
e2e:
needs: [build-frontend, test-backend]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
- run: npm ci
- run: npx playwright install --with-deps
- run: npx nx e2e web --configuration=ci || true
deploy-preview:
needs: [build-frontend]
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: web-build
path: apps/web/.next
- name: Deploy to preview
run: echo "Deploy preview would happen here"
deploy-production:
needs: [e2e]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment: production
steps:
- uses: actions/checkout@v4
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: web-build
path: apps/web/.next
- name: Deploy to production
run: echo "Production deployment would happen here"