-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
100 lines (91 loc) · 3.17 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
# Copyright (c) 2022-2025 Centre National d'Etudes Spatiales (CNES).
#
# This file is part of Bulldozer
# (see https://github.com/CNES/bulldozer).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Bulldozer Gitlab-CI configuration file
# Workflow to avoid pipeline duplication between branch and MR: https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
- if: $CI_COMMIT_BRANCH
# Defines groups of steps
stages:
- init
- quality
# Default configuration for all jobs (CNES specificity)
default:
tags:
- Usine_Logicielle
timeout: 30 minutes
# Variable definition for all jobs
variables:
# Variable to show more logs
# Allows to have predefined variables for manual pipelines: https://docs.gitlab.com/ee/ci/pipelines/index.html#prefill-variables-in-manual-pipelines
DEBUG:
value: "false"
description: "Show more logs"
# Allow to minimize useless logs (example downloads logs)
CI: "true"
# Needed to download pip through CNES internal artifactory without internet connection
PIP_INDEX_URL: "https://${ARTIFACTORY_USER}:${ARTIFACTORY_TOKEN}@${ARTIFACTORY_HOST}/artifactory/api/pypi/pypi/simple"
PIP_CERT: "${CNES_CERTIFICATE}"
# TAGS for images if each stages: base python
TAG_IMAGE_PYTHON: "python:3.10.8"
# Can be used to move pip cache in local directory
PIP_CACHE_DIR: "${WORKSPACE}/.pip-cache/"
# Local artifactory Dockerhub URL containing copies of docker hub images
ARTIFACTORY_URL: "${ARTIFACTORY_HOST}/docker"
# Steps:
# - build (stage, init)
# - test (stage, quality)
build:
stage: init
image:
${ARTIFACTORY_URL}/${TAG_IMAGE_PYTHON}
# before_script:
# set up proxy (CNES specificity)
#- export HTTP_PROXY=http://${PROXY_USER}:${PROXY_PWD}@proxy-tech-web.cnes.fr:8060
#- export HTTPS_PROXY=http://${PROXY_USER}:${PROXY_PWD}@proxy-tech-web.cnes.fr:8060
script:
# Install bulldozer + requirements in virtual environment
- VENV="bulldozer_venv" make install
# Activate virtualenv
- source bulldozer_venv/bin/activate
# Test Bulldozer basic command
- bulldozer -h
- deactivate
artifacts:
# keeps the artifact for next steps (venv, etc.)
untracked: true
expire_in: 1 day
test:
stage: quality
image: ${ARTIFACTORY_URL}/${TAG_IMAGE_PYTHON}
needs:
- build
script:
# Load previous python virtual environment
- source bulldozer_venv/bin/activate
# Run test
# only with local python3
- make test
- deactivate
- make clean
artifacts:
untracked: false
expire_in: 1 day