-
Notifications
You must be signed in to change notification settings - Fork 126
257 lines (234 loc) · 8.28 KB
/
workflow.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
name: CI
on:
push:
branches:
- dev
- auto/clang-tidy
pull_request:
release:
types:
- created
env:
REGION: eu-west-1
WORKSPACE: .
jobs:
credentials:
name: Init credentials
runs-on: [self-hosted, corefront, sandbox]
outputs:
aws_token: ${{ steps.ecr_token.outputs.token }}
steps:
- name: Get ECR Token
id: ecr_token
run: |
echo token=$(aws ecr get-login-password --region $REGION) >> $GITHUB_OUTPUT
checks:
runs-on: [self-hosted, corefront, sandbox]
needs: credentials
container:
image: 162230498103.dkr.ecr.eu-west-1.amazonaws.com/mutable-debian11_dev:latest
credentials:
username: AWS
password: ${{ needs.credentials.outputs.aws_token }}
steps:
- name: force chown to avoid errors
run: |
echo "****************************"
echo $USER
echo "****************************"
chown -R $USER:$USER $WORKSPACE
echo "****************************"
ls -lt
echo "****************************"
- name: Generate github private access token
id: ci-core-app-token
uses: getsentry/[email protected]
with:
app_id: ${{ secrets.CI_CORE_APP_ID }}
private_key: ${{ secrets.CI_CORE_APP_PEM }}
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ steps.ci-core-app-token.outputs.token }}
# 'check_submodules.sh' below needs entire history
fetch-depth: 0
- name: check submodules
run: ./source/scripts/check_submodules.sh
debug:
runs-on: [self-hosted, corefront, sandbox]
needs: [credentials, checks]
steps:
- name: force chown to avoid errors
run: |
echo "****************************"
echo $USER
echo "****************************"
chown -R $USER:$USER $WORKSPACE
echo "****************************"
ls -lt
echo "****************************"
- name: Generate github private access token
id: ci-core-app-token
uses: getsentry/[email protected]
with:
app_id: ${{ secrets.CI_CORE_APP_ID }}
private_key: ${{ secrets.CI_CORE_APP_PEM }}
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ steps.ci-core-app-token.outputs.token }}
# 'check_submodules.sh' below needs entire history
fetch-depth: 0
precommit:
runs-on: [self-hosted, corefront, sandbox]
needs: [credentials, debug, checks]
container:
image: 162230498103.dkr.ecr.eu-west-1.amazonaws.com/mutable-debian11_dev:latest
credentials:
username: AWS
password: ${{ needs.credentials.outputs.aws_token }}
steps:
- name: force chown to avoid errors
run: |
echo "****************************"
echo $USER
echo "****************************"
chown -R $USER:$USER $WORKSPACE
echo "****************************"
ls -lt
echo "****************************"
- name: Generate github private access token
id: ci-core-app-token
uses: getsentry/[email protected]
with:
app_id: ${{ secrets.CI_CORE_APP_ID }}
private_key: ${{ secrets.CI_CORE_APP_PEM }}
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ steps.ci-core-app-token.outputs.token }}
- name: Config Github global url for ssh cases (add access token)
run: |
git config --global url."https://x-access-token:${{ steps.ci-core-app-token.outputs.token }}@github.com/hove-io/".insteadOf "[email protected]:hove-io/"
- name: install dependencies
run: |
pip3 install -r requirements_pre-commit.txt --upgrade
- name: Build Protobuf
run: bash source/scripts/build_protobuf.sh
- name: Pre-commit run
env:
LC_ALL: C.UTF-8
LANG: C.UTF-8
run: |
git config --global --add safe.directory /__w/navitia/navitia
pre-commit install --install-hooks
pre-commit run --all --show-diff-on-failure
build:
runs-on: [self-hosted, corefront, sandbox]
needs: [credentials, checks,debug, precommit]
strategy:
fail-fast: false
matrix:
os: [{docker_image: mutable-debian8_dev , python_version: python3.6}, {docker_image: mutable-debian11_dev, python_version: python3.9}]
container:
image: 162230498103.dkr.ecr.eu-west-1.amazonaws.com/${{ matrix.os.docker_image }}:latest
credentials:
username: AWS
password: ${{ needs.credentials.outputs.aws_token }}
services:
rabbitmq:
image: rabbitmq:3-alpine
ports:
- 5672:5672
redis:
image: redis:6-alpine
ports:
- 6379:6379
steps:
- name: force chown to avoid errors
run: |
echo "****************************"
echo $USER
echo "****************************"
chown -R $USER:$USER $WORKSPACE
echo "****************************"
ls -lt
echo "****************************"
- name: Generate github private access token
id: ci-core-app-token
uses: getsentry/[email protected]
with:
app_id: ${{ secrets.CI_CORE_APP_ID }}
private_key: ${{ secrets.CI_CORE_APP_PEM }}
- uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ steps.ci-core-app-token.outputs.token }}
- name: Restore ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{matrix.os.docker_image}}-ci
max-size: 2000M
save: ${{ github.event_name == 'push' }}
- name: Ensure CMake version is recent enough
if: ${{ matrix.os.docker_image == 'mutable-debian8_dev'}}
run: |
apt remove --yes cmake
mkdir local_bin
cd local_bin
wget https://cmake.org/files/v3.18/cmake-3.18.6-Linux-x86_64.tar.gz
tar xf cmake-3.18.6-Linux-x86_64.tar.gz
echo "`pwd`/cmake-3.18.6-Linux-x86_64/bin" >> $GITHUB_PATH
cd ..
- name: configure for Release
run: mkdir build && cd ./build && cmake -DSTRIP_SYMBOLS=ON ../source
- name: run
working-directory: ./build
run: make -j $(nproc)
- name: Tests python3
working-directory: ./build
if: ${{ matrix.os.docker_image == 'mutable-debian11_dev'}}
run: |
virtualenv -p ${{matrix.os.python_version}} navitia_py3
. navitia_py3/bin/activate
pip install -r ../source/jormungandr/requirements_dev.txt
export JORMUNGANDR_BROKER_URL='amqp://guest:guest@rabbitmq:5672//'
export KRAKEN_RABBITMQ_HOST='rabbitmq'
# ctest --output-on-failure
deactivate
rm -rf navitia_py3
- name: docker_test python2
working-directory: ./build
run: |
pip install virtualenv==20.4.7 -U
virtualenv -p python2.7 navitia_py2
. navitia_py2/bin/activate
pip install -r ../source/tyr/requirements_dev.txt
pip install -r ../source/sql/requirements.txt
export NAVITIA_CHAOS_DUMP_PATH=$(echo $GITHUB_WORKSPACE/source/tests/chaos/chaos_loading.sql.gz | sed -e 's#__w#/opt/actions-runner/_work#')
# make docker_test
deactivate
rm -rf navitia_py2
env:
NAVITIA_DOCKER_NETWORK: ${{ job.container.network }}
TYR_CELERY_BROKER_URL: 'amqp://guest:guest@rabbitmq:5672//'
TYR_REDIS_HOST: 'redis'
- name: docker_test python3
working-directory: ./build
run: |
virtualenv -p ${{matrix.os.python_version}} navitia_py3
. navitia_py3/bin/activate
pip install -r ../source/tyr/requirements_dev.txt
pip install -r ../source/sql/requirements.txt
export NAVITIA_CHAOS_DUMP_PATH=$(echo $GITHUB_WORKSPACE/source/tests/chaos/chaos_loading.sql.gz | sed -e 's#__w#/opt/actions-runner/_work#')
# make docker_test
deactivate
rm -rf navitia_py3
- name: Clean build directory
working-directory: ./build
run: |
rm -rf ./build
env:
NAVITIA_DOCKER_NETWORK: ${{ job.container.network }}
TYR_CELERY_BROKER_URL: 'amqp://guest:guest@rabbitmq:5672//'
TYR_REDIS_HOST: 'redis'