-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy path.gitlab-ci.yml
169 lines (157 loc) · 5.02 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
169
# [1] GitLab page: https://docs.gitlab.com/ee/ci/yaml/#pages
# [2] CI stages: https://docs.gitlab.com/ee/ci/yaml/#stages
# [3] Tags: https://docs.gitlab.com/ee/ci/yaml/#tags
.run_tests_rules: &run_tests_rules
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- when: never
# ===== CHECK FORMATTING =====
test_topfarm_precommit: # name the job what we like
image: ghcr.io/prefix-dev/pixi:latest
variables:
PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
stage: # build, test, deploy defined by default [2]
test
script:
- pixi run -e default pre-commit run --all-files
cache:
key: pre-commit-cache # Retains cache across all branches
paths:
- ${PRE_COMMIT_HOME}
tags: # only runners with this tag can do the job [3]
- linux
<<: *run_tests_rules
# ===== TEST TOPFARM =====
test_topfarm:
image: ghcr.io/prefix-dev/pixi:latest
needs:
- test_topfarm_precommit
stage: # build, test, deploy defined by default [2]
test
script:
- apt update && apt install -y git
- pixi run test-latest
artifacts:
paths:
- ./htmlcov
when: always
tags: # only runners with this tag can do the job [3]
- linux
<<: *run_tests_rules
# ===== TEST TOPFARM ALL PYTHON VERSIONS =====
test_topfarm_all_py_versions:
image: ghcr.io/prefix-dev/pixi:latest
stage: # build, test, deploy defined by default [2]
test
script:
- apt update && apt install -y git
- pixi run test-all
tags: # only runners with this tag can do the job [3]
- linux
when: manual
allow_failure: true
.windows_test_script:
script:
- setx PIXI_CACHE_DIR D:\.pixi_cache
# update PIXI_CACHE_DIR in current shell
- $env:PIXI_CACHE_DIR = [System.Environment]::GetEnvironmentVariable("PIXI_CACHE_DIR","User")
- C:\Users\ernim\.pixi\bin\pixi.exe clean
- C:\Users\ernim\.pixi\bin\pixi.exe run pip install -e .
- C:\Users\ernim\.pixi\bin\pixi.exe run $PIXI_TASK
# ===== TEST TOPFARM ON WINDOWS =====
test_topfarm_windows: # name the job what we like
extends: .windows_test_script
needs:
- test_topfarm_precommit
variables:
GIT_SUBMODULE_STRATEGY: normal
GIT_CLEAN_FLAGS: -ffdx -e .pixi/
PIXI_TASK: test-latest
stage: # build, test, deploy defined by default [2]
test
coverage: '/(?i)total.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
tags: # tag for shared runner on windows machine
- ANMH_old
<<: *run_tests_rules
# ===== TEST TOPFARM ON WINDOWS ALL PYTHON VERSIONS =====
test_topfarm_windows_all_py_versions: # name the job what we like
extends: .windows_test_script
variables:
GIT_SUBMODULE_STRATEGY: normal
GIT_CLEAN_FLAGS: -ffdx -e .pixi/
PIXI_TASK: test-all
stage: # build, test, deploy defined by default [2]
test
tags: # tag for shared runner on windows machine
- ANMH_old
when: manual
allow_failure: true
# ===== TRIGGER TRIGGERHUB PIPELINE =====
trigger_hub_test:
stage: test
variables:
TRIGGER_BRANCH: $CI_COMMIT_REF_NAME
trigger:
project: TOPFARMPrivate/triggerhub/topfarmtriggers
strategy: depend
only:
- master
# ===== TEST TOPFARM DEPLOY =====
test_topfarm_deploy:
image: ghcr.io/prefix-dev/pixi:latest
stage: # build, test, deploy defined by default [2]
deploy
script:
- rm -rf topfarm/examples/input_ts.csv # reduce upload size 75%
- pixi run -e default hatch build
- pixi run -e default hatch publish -r test -u $HATCH_INDEX_USER -a $HATCH_INDEX_AUTH
tags: # only runners with this tag can do the job [3]
- linux
only:
- master
# ===== BUILD WHEELS AND UPLOAD TO PYPI =====
pypi_deploy:
image: ghcr.io/prefix-dev/pixi:latest
stage: deploy
script:
- eval "$(pixi shell-hook -e default)"
- export SETUPTOOLS_SCM_PRETEND_VERSION=$(hatch version | sed 's/\.post0$//') # remove post for pypi
- echo $SETUPTOOLS_SCM_PRETEND_VERSION # pypi version
- hatch build
- hatch publish -u $TWINE_USERNAME -a $TWINE_PASSWORD
tags:
- linux
only:
- tags
# ===== TEST BUILD DOCS =====
test_docs_build: # "pages" is a job specifically for GitLab pages [1]
image: ghcr.io/prefix-dev/pixi:latest
stage: # build, test, deploy defined by default [2]
deploy
script: # use sphinx to build docs
- pixi run -e default "cd docs; sphinx-build -j auto . build/html"
tags: # only runners with this tag can do the job [3]
- linux
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- when: never
artifacts:
paths:
- docs/build/html
# ===== BUILD DOCS AND PUSH TO PUBLIC WEBSITE =====
pages: # "pages" is a job specifically for GitLab pages [1]
image: ghcr.io/prefix-dev/pixi:latest
stage: # build, test, deploy defined by default [2]
deploy
script: # use sphinx to build docs, move to public page
- pixi run -e default "cd docs; sphinx-build -j auto . build/html"
- mv docs/build/html public/
artifacts: # required for GitLab pages [1]
paths:
- public
only:
- master
- /^test_doc.*/
tags: # only runners with this tag can do the job [3]
- linux