add testing to the codebase
This commit is contained in:
parent
67f97f9236
commit
7c55f320d8
44
.gitea/workflows/test.yaml
Normal file
44
.gitea/workflows/test.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
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=denkena_aas.settings-ci
|
Loading…
Reference in New Issue
Block a user