Make migrations wait for db too #37
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: test | |
on: | |
schedule: | |
- cron: '0 5 * * 0' | |
push: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: create project | |
run: | | |
pip install django | |
django-admin startproject --template="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/zipball/$GITHUB_REF_NAME" --extension=py,rst,gitignore,cfg,in,yml,json,dockerignore --name=Makefile,Dockerfile testproj | |
- name: mock client build | |
run: | | |
mkdir -p client/dist | |
touch client/dist/index.js | |
working-directory: testproj | |
- name: start services | |
run: | | |
docker compose up -d | |
# wait for migrations to finish | |
docker attach $(docker compose ps -q django-migrate) | |
timeout-minutes: 5 | |
working-directory: testproj | |
- name: verify services running | |
run: | | |
docker ps # show service status for debugging | |
test $(docker ps -q | wc -l) = "3" | |
- name: verify website running | |
run: | | |
curl -I --retry 10 --retry-connrefused --fail localhost:8000/testproj-admin/login/ | |
- name: verify client build | |
run: | | |
curl -I --retry 10 --retry-connrefused --fail localhost:8000/static/index.js | |
- name: run tests | |
run: docker compose run --rm app make test | |
working-directory: testproj | |
- name: dump docker logs | |
run: | | |
set -x | |
docker compose ps | |
docker compose logs | |
working-directory: testproj | |
if: always() |