-
Notifications
You must be signed in to change notification settings - Fork 126
227 lines (205 loc) · 7.31 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
name: CI
on:
push:
branches:
- dev
- auto/clang-tidy
pull_request:
release:
types:
- created
env:
REGION: eu-west-1
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: chown -R $USER:$USER .
- name: Git config
run: git config --global --add safe.directory /__w/navitia/navitia
- name: Generate github private access token
id: ci-core-app-token
uses: getsentry/action-github-app-token@v2.0.0
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
- name: clean up workspace
if: ${{ always() }}
run: |
rm -rf ./*
rm -rf ./.??*
precommit:
runs-on: [self-hosted, corefront, sandbox]
needs: [credentials, 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: chown -R $USER:$USER .
- name: Git config
run: git config --global --add safe.directory /__w/navitia/navitia
- name: Generate github private access token
id: ci-core-app-token
uses: getsentry/action-github-app-token@v2.0.0
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 "git@github.com: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: |
pre-commit install --install-hooks
pre-commit run --all --show-diff-on-failure
- name: clean up workspace
if: ${{ always() }}
run: |
rm -rf ./*
rm -rf ./.??*
build:
runs-on: [self-hosted, corefront, sandbox]
needs: [credentials, checks, precommit]
env:
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true # see https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
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: chown -R $USER:$USER .
- name: Git config
run: git config --global --add safe.directory /__w/navitia/navitia
- name: Generate github private access token
id: ci-core-app-token
uses: getsentry/action-github-app-token@v2.0.0
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/ccache-action@v1.2.11
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
env:
NAVITIA_DOCKER_NETWORK: ${{ job.container.network }}
TYR_CELERY_BROKER_URL: 'amqp://guest:guest@rabbitmq:5672//'
TYR_REDIS_HOST: 'redis'
- name: clean up workspace
if: ${{ always() }}
run: |
rm -rf ./*
rm -rf ./.??*