-
Notifications
You must be signed in to change notification settings - Fork 1
145 lines (120 loc) · 3.87 KB
/
verify.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Verify
# https://github.com/reviewdog/action-eslint/issues/29#issuecomment-985939887
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
# Prevent multiple workflows with same branch/pull_request.
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
jobs:
job_verify_backend:
name: Verify backend
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
env:
POETRY_VIRTUALENVS_IN_PROJECT: 1
ENV: development
SECRET_KEY: NOT SET
DJANGO_SETTINGS_MODULE: root.settings
DJANGO_SUPERUSER_USERNAME: admin
DJANGO_SUPERUSER_PASSWORD: Django123
DJANGO_SUPERUSER_EMAIL: [email protected]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11.2' # From file: '.python-version'
- name: Install dependencies
run: |
source aliases.sh
pip-upgrade
pip-install-poetry
poetry-sync-pipeline
- name: Run ruff
run: |
source aliases.sh
poetry-run-ruff-check
- name: Check ruff format
run: |
source aliases.sh
poetry-run-ruff-format-check
- name: Verify migrations
run: |
source aliases.sh
poetry-run-migrations-verify
poetry-run-migrations-apply
- name: Run tests
run: |
source aliases.sh
poetry-run-pytest-run
- name: Run mypy
run: |
source aliases.sh
poetry-run-mypy-run
- name: Run seeds
run: |
source aliases.sh
poetry-run-seed
job_verify_docker:
name: Verify docker
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup environment
run: |
touch backend/.docker.env
echo ENV=development >> backend/.docker.env
echo SECRET_KEY=NOT_SET >> backend/.docker.env
echo DJANGO_SETTINGS_MODULE=root.settings >> backend/.docker.env
echo DOMAIN=* >> backend/.docker.env
touch frontend/.env.docker
echo VITE_GOATCOUNTER_CODE=samfundet-dev >> frontend/.env.docker
echo VITE_BACKEND_DOMAIN=http://backend:8000 >> frontend/.env.docker
echo VITE_CYPRESS_BACKEND_DOMAIN=http://backend:8000 >> frontend/.env.docker
echo VITE_CYPRESS_BASE_URL=http://frontend:3000 >> frontend/.env.docker
- name: Build images
run: docker compose build backend frontend storybook
- name: Start containers
run: docker compose up backend frontend storybook -d; sleep 20 # Give additional seconds to boot.
- name: Check running containers
# Will fail if container isn't running.
run: |
docker compose exec backend echo
docker compose exec frontend echo
docker compose exec storybook echo
# - name: Seed backend for Cypress tests
# run: docker compose exec backend poetry run python manage.py seed_cypress
# - name: Run cypress
# run: docker compose up cypress
- name: Stop containers
run: docker compose down
job_verify_frontend_lint:
name: Verify frontend
if: ${{ !github.event.pull_request.draft }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install modules
run: yarn install
- name: Run Biome
run: yarn run biome:ci
- name: Run stylelint
run: yarn run stylelint:check
- name: Run typescript compiler check
run: yarn run tsc:check