This repository has been archived by the owner on Feb 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
207 lines (170 loc) Β· 4.77 KB
/
push.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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Commit
on: push
jobs:
container:
name: Container image
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: GitHub Package Registry
uses: aevea/action-kaniko@master
with:
registry: docker.pkg.github.com
password: ${{ secrets.GITHUB_TOKEN }}
image: server
cache: true
cache_registry: cache
tag: ${{ github.sha }}
- name: Dockerhub
uses: aevea/action-kaniko@master
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
image: kiwicom/the-zoo
cache: true
cache_registry: kiwicom/cache
tag: ${{ github.sha }}
black:
name: Code style
runs-on: ubuntu-20.04
container:
image: kiwicom/black:20.8b1
options: -u root
steps:
- uses: actions/checkout@v2
- name: Run black
run: black --check . --diff
commitsar:
name: Commit message style
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run commitsar
uses: docker://aevea/commitsar
pre-commit:
name: Static checks
runs-on: ubuntu-20.04
container: kiwicom/pre-commit:2.9.3
steps:
- uses: actions/checkout@v2
- name: Cache
uses: actions/cache@v2
with:
path: .pre-commit-cache
key: static-checks-${{ hashFiles('.pre-commit-config.yaml') }}
- run: mkdir -p .pre-commit-cache
- run: pre-commit install --install-hooks
- run: pip install --no-cache-dir poetry
- run: pre-commit run -a
env:
SKIP: no-commit-to-branch
pylint:
name: Pylint
runs-on: ubuntu-20.04
container:
image: kiwicom/tox:3.21.2
options: -u root
steps:
- uses: actions/checkout@v2
- run: apk add --no-cache cargo tar
- name: Cache
uses: actions/cache@v2
with:
path: .tox
key: pylint-${{ hashFiles('poetry.lock', 'tox.ini') }}
- run: tox -e pylint
pytest:
name: Pytest
runs-on: ubuntu-20.04
container:
image: kiwicom/tox:3.21.2
options: -u root
env:
TEST_DATABASE_URL: postgres://postgres:postgres@postgres/postgres
TOX_TESTENV_PASSENV: TEST_DATABASE_URL
MEILI_HOST: http://meilisearch:7700
MEILI_MASTER_KEY: meili
services:
meilisearch:
image: getmeili/meilisearch
env:
MEILI_MASTER_KEY: meili
MEILI_NO_ANALYTICS: true
postgres:
image: postgres:12-alpine
env:
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- run: apk add --no-cache cargo tar
- name: Cache
uses: actions/cache@v2
with:
path: .tox
key: pytest-${{ hashFiles('poetry.lock', 'tox.ini') }}
- run: adduser -D postgres
- run: su -l postgres
- run: mkdir -p reports
- run: >
tox -e tests
--
--cov-branch
--junitxml=reports/xunit.xml
--cov-report xml:reports/coverage.xml
- uses: actions/upload-artifact@v2
with:
name: reports
path: reports
migrations:
name: Migrations
runs-on: ubuntu-20.04
needs: container
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--hostname postgres
steps:
- uses: docker/login-action@v1
with:
registry: docker.pkg.github.com
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: >
docker run
--network ${{ job.services.postgres.network }}
docker.pkg.github.com/kiwicom/the-zoo/server:$GITHUB_SHA
django-admin makemigrations --check
sonarcloud:
name: SonarCloud
runs-on: ubuntu-20.04
needs: pytest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: reports
path: reports
- name: Fix code coverage paths
run: sed -i "s|/__w/the-zoo/the-zoo|/github/workspace|g" reports/coverage.xml
- run: cat reports/coverage.xml
- name: Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}