Add check if people are still studying #9742
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Linting and Testing | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
linting: | |
name: Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Restore any cached Poetry dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Install any new dependencies | |
run: poetry install | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Run isort | |
run: make isortcheck | |
- name: Run black | |
run: make blackcheck | |
- name: Run Ruff | |
run: make ruff | |
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: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Restore any cached Poetry dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Install any new dependencies | |
run: poetry install --with postgres | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Run tests | |
run: make test | |
- name: Report coverage | |
run: make coverage | |
- name: Create coverage report | |
run: make covhtml | |
- 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: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Restore any cached Poetry dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Install any new dependencies | |
run: poetry install --with postgres | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Run create fixtures | |
run: make fixtures | |
documentation-tests: | |
name: Documentation Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Setup Poetry | |
uses: snok/install-poetry@v1 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Restore any cached Poetry dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pypoetry/virtualenvs | |
key: ${{ runner.os }}-poetry-${{ hashFiles('poetry.lock') }} | |
restore-keys: | | |
${{ runner.os }}-poetry- | |
- name: Install any new dependencies | |
run: poetry install | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Run doctest | |
run: make doctest | |
- name: Run Sphinx | |
run: make docs | |
- name: Run API docs script | |
run: | | |
make apidocscheck | |
- name: Save documentation HTML | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs-html | |
path: docs/_build | |
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 }} | |
upload-docs: | |
name: Deploy Documentation | |
runs-on: ubuntu-latest | |
needs: [documentation-tests] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: docs-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-documentation/${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 }} |