-
Notifications
You must be signed in to change notification settings - Fork 0
122 lines (114 loc) · 3.44 KB
/
gate.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
name: gate
on:
push:
branches:
- main
pull_request:
env:
PYTHON_VERSION: '3.11'
jobs:
check-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pipenv'
- name: install dependencies
run: |
pip install pipenv
- name: check style
run: |
pipenv install --dev
pipenv run flake8
check-web-style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install dependencies
run: |
curl -L https://github.com/biomejs/biome/releases/download/cli%2Fv1.3.3/biome-linux-x64 -o biome
chmod +x biome
- name: check style
run: ./biome check app/static
run-unit-tests:
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
SQLALCHEMY_DATABASE_URI: postgresql://postgres:postgres@localhost/postgres
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pipenv'
- name: install dependencies
run: |
pip install pipenv
pipenv install --dev
- name: run unit tests
run: |
pipenv run pytest --cov-report term --cov=app tests/unit
run-system-tests:
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-containerized-services/creating-postgresql-service-containers
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
env:
SQLALCHEMY_DATABASE_URI: postgresql://postgres:postgres@localhost/postgres
SECRET_KEY: abc123
SECURITY_PASSWORD_SALT: abc123
SECURITY_REGISTERABLE: True
TEST_USER: "ci@gmail.com"
TEST_PW: abc123xyz789
steps:
- uses: actions/checkout@v4
- name: set up python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pipenv'
- name: install dependencies
run: |
pip install pipenv
pipenv install --dev
pipenv run playwright install chromium
- name: initialise db
run: |
ENV=CI pipenv run flask --app app.app db upgrade --directory app/storage/migrations
ENV=CI pipenv run flask --app app.app roles create superuser
ENV=CI pipenv run flask --app app.app users create $TEST_USER --password $TEST_PW -a
ENV=CI pipenv run flask --app app.app roles add $TEST_USER superuser
- name: start server
run: |
ENV=CI pipenv run flask --app app.app run & \
sleep 3 && \
curl http://localhost:5000 -I
- name: run system tests
run: |
ENV=CI pipenv run pytest tests/system