-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
95 lines (88 loc) · 2.41 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
stages:
- pre_commit
- test
- docs
- publish
variables:
FLIT_ROOT_INSTALL: "1"
PYTHON_VERSION: "3.8.8"
ARTIFACTS_TEST_PATH: "junit/test-results.xml"
ARTIFACTS_DOCS_PATH: "docs-build"
ARTIFACTS_COV_PATH: "coverage/"
GITLAB_BELLE2_TOOLS_B2SETUP: "/cvmfs/belle.cern.ch/tools/b2setup"
FLIT_INDEX_URL: "https://upload.pypi.org/legacy/"
FLIT_USERNAME: __token__
BASF2_RELEASE_VERSION: "light-2409-toyger"
workflow:
rules:
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
- if: $CI_PIPELINE_SOURCE == 'push' && ($CI_COMMIT_BRANCH == 'main') && $CI_COMMIT_TITLE =~ /Merge branch.*/
- if: $CI_COMMIT_TAG
- if: $GITLAB_FORCE_RUNNING_PIPELINE == 'yes'
default:
image: belle2/belle2-base-el9:latest
tags:
- extagent48
before_script:
# Preliminary operations with Git
- git config user.email "[email protected]"
- git config user.name "someone"
- git config --global --add safe.directory $(dirname ${GITLAB_BELLE2_TOOLS_B2SETUP})
# Setup of basf2
- source ${GITLAB_BELLE2_TOOLS_B2SETUP}
- echo ${BASF2_RELEASE_VERSION}
- b2venv ${BASF2_RELEASE_VERSION}
- source venv/bin/activate
pre_commit:
stage: pre_commit
script:
- pip install pre-commit
- pre-commit run --all-files
test:
stage: test
script:
- pip install pytest pytest-cov python-coveralls flit
- flit install -s
- pytest -v --cov b2luigi --junitxml=$ARTIFACTS_TEST_PATH --cov-report=xml --cov-report=html --cov-report=term tests
- mv htmlcov $ARTIFACTS_COV_PATH
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
parallel:
matrix:
- BASF2_RELEASE_VERSION: [$BASF2_PYTHON38_RELEASE, $BASF2_PYTHON311_RELEASE]
artifacts:
reports:
junit: $ARTIFACTS_TEST_PATH
coverage_report:
coverage_format: cobertura
path: coverage.xml
paths:
- junit/test-results.xml
- coverage/
expose_as: 'test result and coverage'
docs:
stage: docs
needs:
- job: test
artifacts: false
script:
- pip install flit
- flit install -s
- sphinx-build docs/ $ARTIFACTS_DOCS_PATH
artifacts:
paths:
- docs-build/
expire_in: 1 week
expose_as: 'sphinx documentation'
when: on_success
publish:
stage: publish
needs:
- job: test
artifacts: false
- job: docs
artifacts: false
script:
- pip install setuptools wheel twine flit
- flit publish
only:
- tags