impuls/.gitea/workflows/test.yaml
Federico Justus Denkena e7fbebad33
Some checks are pending
Code Tests / run_tests (3.10) (push) Waiting to run
Code Tests / run_tests (3.11) (push) Waiting to run
Code Tests / run_tests (3.12) (push) Waiting to run
add relevant settings for ci setup
2024-10-18 03:17:07 +02:00

45 lines
1.6 KiB
YAML

name: Code Tests
on: [push]
jobs:
run_tests:
runs-on: ubuntu-latest
container:
image: git.denkena-consulting.com/denkena-consulting/docker-base:latest
credentials:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
env:
POSTGRES_PASSWORD: testrunner
PGPORT: 5433
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.10"]
steps:
- name: Checkout Codebase
uses: actions/checkout@v4
- name: Configure and install deps
run: |
apt update
apt install -y sudo python3.11-venv
chmod +x /usr/local/bin/docker-enforce-initdb.sh && /usr/local/bin/docker-enforce-initdb.sh
sudo -u postgres /usr/lib/postgresql/16/bin/pg_ctl -D /var/lib/postgresql/data -o "-c listen_addresses='' -c port=5433" start
sudo -u postgres psql -h '/var/run/postgresql/' -p 5433 -U postgres -d postgres -c "alter user postgres with password 'testrunner';"
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
token: ${{ secrets.GH_TOKEN }}
- name: Install dependencies
run: cd ${{ gitea.workspace }} && pip install -r requirements.txt --root-user-action=ignore
- name: Run Django tests
env:
DB_HOST: '/var/run/postgresql/'
DB_NAME: 'testdb'
DB_USER: 'postgres'
DB_PASSWORD: 'testrunner'
DB_PORT: 5433
run: |
cd ${{ gitea.workspace }} && python3 manage.py test --settings=impuls.settings-ci