Skip to content

comment out masking #1954

comment out masking

comment out masking #1954

Workflow file for this run

name: AWS deploy
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
skip_tests:
description: 'Skip tests'
default: false
type: boolean
permissions:
id-token: write
contents: read
checks: write
pull-requests: write
env:
DJANGO_ENVIRONMENT: DEVELOPMENT
PYTHONUNBUFFERED: 1
MASK_SECRETS: 1
jobs:
notify-discord:
name: Notify Discord
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
steps:
- uses: ipeterov/discord-notify-action@v1
with:
webhook: ${{ secrets.CI_UPDATES_DISCORD_WEBHOOK }}
jobs: |
- linters
- tests
- tests-playwright
- prepare-images
- deploy
linters:
name: Linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Ruff check
run: uv run ruff check --output-format=github .
- name: Ruff format
run: uv run ruff format --check --diff
tests:
name: Regular tests
runs-on: ubuntu-latest
env:
DJANGO_ALLOW_ASYNC_UNSAFE: true
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
- name: Start database services
run: docker compose up -d builtin_db redis
- name: Wait for services to be ready
run: |
until docker compose exec builtin_db pg_isready -U roleplay_app; do
echo "Waiting for PostgreSQL..."
sleep 2
done
until docker compose exec redis redis-cli ping; do
echo "Waiting for Redis..."
sleep 2
done
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Generate GraphQL Schema
run: uv run python manage.py graphql_schema
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: aiarena/frontend-spa/package-lock.json
- name: Install frontend deps
run: npm ci
working-directory: aiarena/frontend-spa
- name: Generate Relay artifacts
run: npm run relay
working-directory: aiarena/frontend-spa
- name: Build Vite bundle
run: npm run build
working-directory: aiarena/frontend-spa
- name: Collect static files
run: uv run python manage.py collectstatic --noinput
- name: Run Tests
if: ${{ !inputs.skip_tests }}
env:
NOFAKE_REDIS: 1
run: uv run pytest -m 'not playwright' -n auto --junit-xml test-results/pytest-regular.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@c8a70fdde92689bf574202595e1322d3a4de0987
if: always()
with:
check_name: "Test Report"
check_run: false
fail_on: "nothing"
files: |
test-results/pytest-regular.xml
tests-playwright:
name: Playwright tests
runs-on: ubuntu-latest
env:
DJANGO_ALLOW_ASYNC_UNSAFE: true
steps:
- name: Checkout repository and submodules
uses: actions/checkout@v4
- name: Start database services
run: docker compose up -d builtin_db redis
- name: Wait for services to be ready
run: |
until docker compose exec builtin_db pg_isready -U roleplay_app; do
echo "Waiting for PostgreSQL..."
sleep 2
done
until docker compose exec redis redis-cli ping; do
echo "Waiting for Redis..."
sleep 2
done
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Generate GraphQL Schema
run: uv run python manage.py graphql_schema
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: aiarena/frontend-spa/package-lock.json
- name: Install frontend deps
run: npm ci
working-directory: aiarena/frontend-spa
- name: Lint React code
run: npm run lint
working-directory: aiarena/frontend-spa
- name: Generate Relay artifacts
run: npm run relay
working-directory: aiarena/frontend-spa
- name: Build Vite bundle
run: npm run build
working-directory: aiarena/frontend-spa
- name: Collect static files
run: uv run python manage.py collectstatic --noinput
# Playwright E2E
- name: Install Playwright browsers
run: uv run playwright install --with-deps
- name: Run Tests
if: ${{ !inputs.skip_tests }}
env:
NOFAKE_REDIS: 1
run: uv run pytest -m playwright --tracing retain-on-failure --junit-xml test-results/pytest-playwright.xml
# Reports
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@c8a70fdde92689bf574202595e1322d3a4de0987
if: always()
with:
check_name: "Playwright test Report"
check_run: false
fail_on: "nothing"
files: |
test-results/pytest-playwright.xml
- name: Upload failure traces
uses: actions/upload-artifact@v4
if: failure()
with:
name: playwright-failures
path: test-results
retention-days: 30
prepare-images:
name: Build & push image to ECR
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
outputs:
images: ${{ steps.prepare_images.outputs.images }}
steps:
- uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::315513665747:role/aiarena-DeployRole-NUZWXPWHC0MZ
aws-region: eu-central-1
- name: Confirm AWS identity
run: aws sts get-caller-identity
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Prepare image
id: prepare_images
env:
BUILD_NUMBER: ${{ github.run_number }}
MAINTENANCE_MODE: ${{ vars.MAINTENANCE_MODE }}
run: uv run deploy prepare-images
deploy:
if: github.event_name != 'pull_request'
name: Deploy to ECS
runs-on: ubuntu-latest
needs: [ linters, tests, tests-playwright, prepare-images ]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
- name: Install the project
run: uv sync --locked --all-extras --dev
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::315513665747:role/aiarena-DeployRole-NUZWXPWHC0MZ
aws-region: eu-central-1
- name: Deploy
env:
BUILD_NUMBER: ${{ github.run_number }}
PREPARED_IMAGES: ${{ needs.prepare-images.outputs.images }}
MAINTENANCE_MODE: ${{ vars.MAINTENANCE_MODE }}
run: uv run deploy migrate-and-update
- name: Monitor deployment
run: uv run deploy monitor