Skip to content

Add announcements list API and refactor persistent announcements #9767

Add announcements list API and refactor persistent announcements

Add announcements list API and refactor persistent announcements #9767

Workflow file for this run

---
name: Linting and Testing
on:
push:
branches:
- master
pull_request:
jobs:
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --frozen
- name: Run ruff check
run: uv run ruff check --output-format=github
- name: Run ruff format
run: uv run ruff format --check
tests:
name: Django Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: thalia
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
env:
DJANGO_ENV: testing
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --frozen
- name: Run checks
run: |
uv run website/manage.py check
uv run website/manage.py templatecheck --project-only
uv run website/manage.py makemigrations --no-input --check --dry-run
- name: Run tests
run: uv run coverage run website/manage.py test website/
- name: Report coverage
run: |
uv run coverage report --fail-under=100 --omit "website/registrations/urls.py" website/registrations/**.py
uv run coverage report --fail-under=100 --omit "website/payments/urls.py" website/payments/**.py
uv run coverage report
- name: Create coverage report
run: uv run coverage html --directory=covhtml --no-skip-covered --title="Coverage Report"
- name: Save coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-html
path: covhtml
run-fixtures:
name: Run fixtures
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: thalia
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
env:
DJANGO_ENV: testing
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --frozen
- name: Migrate
run: |
uv run website/manage.py migrate
uv run website/manage.py createcachetable
- name: Run create fixtures
run: uv run website/manage.py createfixtures -a
upload-coverage:
name: Deploy Coverage Report
runs-on: ubuntu-latest
needs: [tests]
steps:
- uses: actions/download-artifact@v4
with:
name: coverage-html
path: html
- name: Create URL safe version of GITHUB_REF
run: echo "GITHUB_REF_SLUG=$(echo \"${GITHUB_REF#refs/heads/}\"| iconv -t ascii//TRANSLIT | sed -E 's/[^a-zA-Z0-9]+/-/g' | sed -E 's/^-+|-+$//g' | tr A-Z a-z)" >> "${GITHUB_ENV}"
- name: Sync files to S3
run: aws s3 sync html "s3://thalia-coverage/${GITHUB_REF_SLUG}/"
env:
AWS_DEFAULT_REGION: eu-west-1
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}