-
Notifications
You must be signed in to change notification settings - Fork 26
161 lines (128 loc) · 4.29 KB
/
continuous_integration.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: Continuous Integration
on:
pull_request:
branches:
- main
- 'feature/**'
- 'staging/**'
merge_group:
types: [checks_requested]
env:
PYTHON_VERSION: 3.10.x
AUTH_COMMIT_HASH: main # will be set during job
jobs:
build-production-image:
name: Build and test production docker image
runs-on: ubuntu-22.04
defaults:
run:
working-directory: .github/docker-compose
steps:
- uses: actions/checkout@v4
- name: Create secrets for datastore
run: mkdir secrets && echo -n "openslides" > secrets/postgres_password
- name: Run docker production image
run: docker compose -f docker-compose.prod.yml up --build -d
- name: Wait for action service
# we have to execute this inside the container since the port to the outside is opened directly after the
# container started, while the code itself is not ready yet
run: docker compose -f docker-compose.prod.yml exec -T backend-action scripts/wait.sh backend-action 9002
- name: Wait for presenter service
# we have to execute this inside the container since the port to the outside is opened directly after the
# container started, while the code itself is not ready yet
run: docker compose -f docker-compose.prod.yml exec -T backend-presenter scripts/wait.sh backend-presenter 9003
- name: Fire a test request to actions component
run: curl localhost:9002/system/action/health
- name: Fire a test request to presenter component
run: curl localhost:9003/system/presenter/health
build-and-test-dev-image:
name: Build and test development docker image with Docker Compose
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Run tests
run: dev/run-tests.sh
test-local-setup:
name: Build and test local dev setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: openslides-backend
- name: Set env vars
working-directory: openslides-backend/requirements
run: |
. export_service_commits.sh
echo "AUTH_COMMIT_HASH=$(echo $AUTH_COMMIT_HASH)" >> $GITHUB_ENV
- name: Clone auth service
uses: actions/checkout@v4
with:
repository: OpenSlides/openslides-auth-service
ref: ${{ env.AUTH_COMMIT_HASH }}
path: openslides-auth-service
- name: Clone vote service
uses: actions/checkout@v4
with:
repository: OpenSlides/openslides-vote-service
ref: main
path: openslides-vote-service
- name: Run local setup
working-directory: openslides-backend
run: dev/run-local.sh
check-coding-style:
name: Check coding style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install requirements
run: . requirements/export_service_commits.sh && pip install --requirement requirements/requirements_development.txt
- name: Check black
if: always()
run: make check-black
- name: Check isort
if: always()
run: make check-isort
- name: Check flake8
if: always()
run: make flake8
- name: Check mypy
if: always()
run: make mypy
- name: Check pyupgrade
if: always()
run: make pyupgrade
check-models-all:
name: Check from models.yml up to permissions and jsons
runs-on: ubuntu-latest
env:
PYTHONPATH: .
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install requirements
run: . requirements/export_service_commits.sh && pip install --requirement requirements/requirements_development.txt
- name: Check for up to date models.py
if: always()
run: make check-models
- name: Check for up to date permissions.py
if: always()
run: make check-permissions
- name: Check initial-data.json
if: always()
run: make check-initial-data-json
- name: Check example-data.json
if: always()
run: make check-example-data-json