test #104
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@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: create project | |
run: | | |
pip install django | |
django-admin startproject \ | |
--template=https://github.com/lincolnloop/django-layout/zipball/main \ | |
--extension=py,md,gitignore,yaml,json,toml \ | |
--name=Makefile,Dockerfile \ | |
--exclude=.github \ | |
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-all-errors --fail localhost:8000/testproj-admin/login/ | |
- name: verify client build | |
run: | | |
curl -I --retry 10 --retry-all-errors --fail localhost:8000/static/index.js | |
- name: run tests | |
run: docker compose run --rm app make test | |
working-directory: testproj | |
- name: verify README.md | |
run: docker compose run --rm --no-deps app cog --check README.md | |
working-directory: testproj | |
- name: lint code | |
run: docker compose run --rm --no-deps app make lint | |
working-directory: testproj | |
- name: format code | |
run: docker compose run --rm --no-deps app ruff format --check . | |
working-directory: testproj | |
- name: dump docker logs | |
run: | | |
set -x | |
docker compose ps | |
docker compose logs | |
working-directory: testproj | |
if: always() |