API: add participation viewset #3969
Workflow file for this run
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: tests | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [ "3.11" ] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
- name: Install dependencies | |
run: | | |
poetry run pip install -U pip | |
poetry install --with=dev | |
- name: check format with black | |
run: | | |
poetry run black --version | |
poetry run black --check . | |
- name: check import order with isort | |
run: | | |
poetry run isort --version | |
poetry run isort -c . | |
- name: Lint with pylint | |
run: | | |
poetry run pylint --version | |
poetry run pylint ephios | |
- name: Run djhtml | |
run: poetry run djhtml -c ephios/ | |
- name: Make sure we always use trimmed translation strings | |
run: "! git grep ' blocktranslate ' | grep -v trimmed" | |
- name: No use of the trans tag | |
run: "! git grep '{% trans ' | grep -v 'run: git grep'" | |
- name: There shouldn't be a showbrowser call in the code | |
run: "! git grep '.showbrowser()' | grep -v 'run: git grep'" | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.10", "3.11", "3.12" ] | |
database: [ sqlite, mysql, postgres ] | |
include: | |
- database: sqlite | |
database_url: "sqlite:///data/db.sqlite3" | |
- database: mysql | |
database_url: "mysql://root:[email protected]:3306/ephios" | |
- database: postgres | |
database_url: "psql://pytest:[email protected]:5432" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install poetry | |
run: pipx install poetry | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
- name: Install dependencies | |
run: | | |
sudo apt-get install gettext | |
poetry run pip install -U pip | |
poetry install --all-extras --with=dev | |
poetry run pip install git+https://github.com/ephios-dev/ephios-testplugin | |
- name: Prepare files for test run | |
run: | | |
cp .env.example .env | |
poetry run python manage.py build | |
- name: Setup postgres # postgres 14 on ubuntu 22.04 | |
run: | | |
sudo systemctl start postgresql.service | |
pg_isready | |
sudo -u postgres psql --command="CREATE USER pytest WITH CREATEDB PASSWORD 'pass'" | |
if: matrix.database == 'postgres' | |
- name: Setup mysql | |
run: | | |
sudo systemctl start mysql.service | |
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -uroot -proot -Dmysql | |
if: matrix.database == 'mysql' | |
- name: Make sure all migrations are up to date # apps specified explicitly to avoid checking migrations in dependencies | |
run: poetry run python manage.py makemigrations --check core extra api complexsignup eventautoqualification federation files guests pages qualification_management simpleresource | |
- name: Test apps | |
env: | |
DATABASE_URL: ${{ matrix.database_url }} | |
run: poetry run coverage run --source=ephios -m pytest tests/ | |
- name: Coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: poetry run coveralls --service=github | |
if: matrix.python-version == '3.11' && matrix.database == 'sqlite' |