-
Notifications
You must be signed in to change notification settings - Fork 4
/
.gitlab-ci.yml
168 lines (147 loc) · 5.29 KB
/
.gitlab-ci.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
variables:
TEST_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
CPU_IMAGE_NAME: $CI_REGISTRY_IMAGE:cpu
GPU_IMAGE_NAME: $CI_REGISTRY_IMAGE:gpu
DOCKER_BUILDKIT: 1
DOCKER_DRIVER: overlay2
CPU_BASE_IMAGE: registry.forgemia.inra.fr/orfeo-toolbox/otbtf:4.3.1-cpu-dev
GPU_BASE_IMAGE: registry.forgemia.inra.fr/orfeo-toolbox/otbtf:4.3.1-gpu-dev
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID || $CI_COMMIT_REF_NAME =~ /master/ # Execute jobs in merge request context, or commit in master branch
stages:
- Docker build
- Static Analysis
- Tests
- Ship
.dind_base:
tags: [godzilla]
image: docker:latest
services:
- name: docker:dind
before_script:
- echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY
Build the docker image:
stage: Docker build
allow_failure: false
extends: .dind_base
script:
- docker info
- >
docker build
--pull
--cache-from $CI_REGISTRY_IMAGE:cpu
--cache-from $TEST_IMAGE_NAME
--tag $TEST_IMAGE_NAME
--build-arg "BASE_IMAGE=$CPU_BASE_IMAGE"
--build-arg BUILDKIT_INLINE_CACHE=1
.
- docker push $TEST_IMAGE_NAME
.static_analysis_base:
image: $TEST_IMAGE_NAME
stage: Static Analysis
allow_failure: true
flake8:
extends: .static_analysis_base
script:
- pip install flake8 && flake8 --ignore=E402 --max-line-length=120 $PWD/decloud
pylint:
extends: .static_analysis_base
script:
- pip install pylint && pylint --disable=too-many-nested-blocks,too-many-locals,too-many-statements,too-few-public-methods,too-many-instance-attributes,too-many-arguments,invalid-name,cell-var-from-loop,too-many-branches,too-many-ancestors --ignored-modules=tensorflow,git,rtree,scipy,tensorboard,libamalthee,pandas --max-line-length=120 $PWD/decloud
codespell:
extends: .static_analysis_base
script:
- pip install codespell && codespell --skip="*.png,*.template,*.pbs,*.jpg,*git/lfs*"
.applications_test_base:
image: $TEST_IMAGE_NAME
stage: Tests
before_script:
- export PYTHONPATH=$PYTHONPATH:$PWD
- wget https://nextcloud.inrae.fr/s/aNTWLcH28zNomqk/download -O archive.zip && unzip archive.zip
- export DECLOUD_DATA_DIR="$PWD/decloud_data"
- mkdir tests_artifacts
artifacts:
when: on_failure
paths:
- "*.xml"
- "tests_artifacts/*.*"
expire_in: 1 week
after_script:
- cp -r /tmp/* tests_artifacts/
display_apps_helps:
extends: .applications_test_base
script:
- python decloud/models/train_from_tfrecords.py --help
- python decloud/models/create_tfrecords.py --help
- python decloud/preprocessing/sentinel1_prepare.py --help
- python decloud/preprocessing/sentinel2_prepare.py --help
- python decloud/preprocessing/dem_prepare.py --help
- python decloud/analysis/tile_coverage.py --help
- python decloud/analysis/images_stats.py --help
- python decloud/analysis/patches_coverage.py --help
- python decloud/production/crga_processor.py --help
inference:
extends: .applications_test_base
script:
- pytest -o log_cli=true --log-cli-level=INFO --junitxml=report_inference.xml tests/inference_unittest.py
s1_prepare:
extends: .applications_test_base
script:
- pytest -o log_cli=true --log-cli-level=INFO --junitxml=report_sentinel1_prepare.xml tests/sentinel1_prepare_unittest.py
s2_prepare:
extends: .applications_test_base
script:
- pytest -o log_cli=true --log-cli-level=INFO --junitxml=report_sentinel2_prepare.xml tests/sentinel2_prepare_unittest.py
DEM_prepare:
extends: .applications_test_base
script:
- pytest -o log_cli=true --log-cli-level=INFO --junitxml=report_dem_prepare.xml tests/dem_unittest.py
create_tfrecords:
extends: .applications_test_base
script:
- pytest -o log_cli=true --log-cli-level=INFO --junitxml=report_create_tfrecords.xml tests/create_tfrecords_unittest.py
train_from_tfrecords:
extends: .applications_test_base
script:
- pytest -o log_cli=true --log-cli-level=INFO --junitxml=report_train_from_tfrecords.xml tests/train_from_tfrecords_unittest.py
.ship_base:
stage: Ship
only:
- master
extends: .dind_base
cpu_deploy:
extends: .ship_base
script:
- >
docker build
--pull
--cache-from $CPU_IMAGE_NAME
--cache-from $TEST_IMAGE_NAME
--label "org.opencontainers.image.title=$CI_PROJECT_TITLE"
--label "org.opencontainers.image.url=$CI_PROJECT_URL"
--label "org.opencontainers.image.created=$CI_JOB_STARTED_AT"
--label "org.opencontainers.image.revision=$CI_COMMIT_SHA"
--label "org.opencontainers.image.version=$CI_COMMIT_REF_NAME"
--tag $CPU_IMAGE_NAME
--build-arg "BASE_IMAGE=$CPU_BASE_IMAGE"
--build-arg BUILDKIT_INLINE_CACHE=1
.
- docker push $CPU_IMAGE_NAME
gpu_deploy:
extends: .ship_base
script:
- >
docker build
--pull
--cache-from $GPU_IMAGE_NAME
--label "org.opencontainers.image.title=$CI_PROJECT_TITLE"
--label "org.opencontainers.image.url=$CI_PROJECT_URL"
--label "org.opencontainers.image.created=$CI_JOB_STARTED_AT"
--label "org.opencontainers.image.revision=$CI_COMMIT_SHA"
--label "org.opencontainers.image.version=$CI_COMMIT_REF_NAME"
--tag $GPU_IMAGE_NAME
--build-arg "BASE_IMAGE=$GPU_BASE_IMAGE"
--build-arg BUILDKIT_INLINE_CACHE=1
.
- docker push $GPU_IMAGE_NAME