-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (72 loc) · 2.48 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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