tryfix-ci #1
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: Test Django PostgreSQL | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.11, 3.12] | |
timeout-minutes: 10 | |
steps: | |
- name: Start PostgreSQL | |
run: | | |
sudo systemctl start postgresql.service | |
pg_isready | |
sudo -u postgres createdb db | |
printf "0000\n0000" | sudo -u postgres createuser -s -d -r -P runner | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install uv | |
uv venv venv | |
. venv/bin/activate | |
uv pip install .[dev] | |
- name: Migrate | |
run: | | |
. venv/bin/activate | |
DATABASE_URL=postgresql://runner:0000@localhost:5432/db python manage.py migrate | |
- name: Run Django | |
run: | | |
. venv/bin/activate | |
nohup make run DATABASE_URL=postgresql://runner:0000@localhost:5432/db > nohup.out 2> nohup.err < /dev/null & | |
sleep 4 | |
- name: Run Tests | |
run: | | |
. venv/bin/activate | |
make test-cypress-api |