amended conftest.py and e2e docx test #341
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: CI GitHub Actions | |
# https://stackoverflow.com/a/67136237 | |
on: | |
pull_request: | |
push: | |
workflow_dispatch: #So we can trigger Workflow runs using `gh workflow run "test.yaml" --ref branch | |
jobs: | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout git repository 🕝 | |
uses: actions/checkout@v3 | |
- name: Run ShellCheck Scripts | |
uses: ludeeus/action-shellcheck@master | |
with: | |
check_together: 'yes' | |
scandir: ./scripts | |
severity: error | |
- name: Run ShellCheck Backend | |
uses: ludeeus/action-shellcheck@master | |
with: | |
check_together: 'yes' | |
scandir: ./backend/app/bin | |
severity: error | |
- name: Run ShellCheck Corgi | |
uses: ludeeus/action-shellcheck@master | |
with: | |
additional_files: ./corgi | |
severity: error | |
- name: Set up Docker | |
uses: crazy-max/ghaction-setup-docker@v3 | |
- name: Start stack | |
run: | | |
set -e | |
./corgi start | |
for i in {1..5}; do | |
if curl -IL 'http://localhost/' &> /dev/null; then | |
break | |
elif [ $i -eq 5 ]; then | |
echo "Server did not start in time" >&2 | |
exit 1 | |
else | |
sleep 1 | |
fi | |
done | |
- name: Frontend Unit Tests | |
run: | | |
set -e | |
docker compose -f docker-compose.stack.dev.yml exec frontend npm run test:unit | |
docker compose -f docker-compose.stack.dev.yml exec frontend npm run lint | |
- name: Backend Unit Tests | |
run: | | |
set -e | |
docker compose -f docker-compose.stack.dev.yml exec backend pytest -vvv ./tests/unit | |
docker compose -f docker-compose.stack.dev.yml exec backend ruff check | |
docker compose -f docker-compose.stack.dev.yml exec backend ruff format --check | |
- name: Test database | |
run: | | |
set -e | |
./corgi create-jobs | |
./corgi create-approved-books | |
./corgi create-erd | |
if git diff --name-only | grep -E '^README' &> /dev/null; then | |
echo "ERD did not match commit" >&2 | |
exit 1 | |
fi | |
# Ensure the latest migration works backwards and forwards with | |
# existing job data | |
docker compose -f docker-compose.stack.dev.yml exec backend alembic downgrade -1 | |
docker compose -f docker-compose.stack.dev.yml exec backend alembic upgrade head | |
./corgi stop |