-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
146 lines (135 loc) · 4.03 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
variables:
APP_DIRECTORY: .
DOCS_DIRECTORY: ${APP_DIRECTORY}/docs
DOCS_LATEX_NAME: fenicsr13
stages:
- prepare
- build
- test
- deploy
# **************************************************************************** #
# prepare
# **************************************************************************** #
prepare:docker:
stage: prepare
image: docker:26.1.4
services:
- docker:26.1.4-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker pull $CI_REGISTRY_IMAGE:latest || true
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA || true
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME || true
- docker build
--cache-from $CI_REGISTRY_IMAGE:latest
--tag $CI_REGISTRY_IMAGE:latest
--tag $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME .
- docker push $CI_REGISTRY_IMAGE:latest
tags:
- dockerindocker
# **************************************************************************** #
# build
# **************************************************************************** #
build:docs:
stage: build
dependencies:
- prepare:docker
image:
name: $CI_REGISTRY_IMAGE:latest
entrypoint: [""]
script:
- cd ${DOCS_DIRECTORY}
- sphinx-apidoc -f -o source/fenicsR13 ../fenicsR13
- sphinx-apidoc -f -o source/tests/2d_heat ../tests/2d_heat
- sphinx-apidoc -f -o source/tests/2d_stress ../tests/2d_stress
- sphinx-apidoc -f -o source/tests/2d_r13 ../tests/2d_r13
- sphinx-apidoc -f -o source/tests/3d_heat ../tests/3d_heat
- sphinx-apidoc -f -o source/tests/3d_stress ../tests/3d_stress
- sphinx-apidoc -f -o source/tests/3d_r13 ../tests/3d_r13
- sphinx-apidoc -f -o source/examples ../examples
- make html
- make latex
artifacts:
paths:
- ${DOCS_DIRECTORY}/_build/html/
- ${DOCS_DIRECTORY}/_build/latex/
expire_in: 6 month
tags:
- docker
# **************************************************************************** #
# test
# **************************************************************************** #
.test: # dot means "hidden", acts as base class
stage: test
dependencies:
- prepare:docker
before_script:
- pip install -e . # local install to have right coverage
image:
name: $CI_REGISTRY_IMAGE:latest
entrypoint: [""]
tags:
- docker
test:flake8:
extends: .test
script:
- cd ${APP_DIRECTORY}
- flake8 fenicsR13 examples tests
test:pytest:
extends: .test
script:
- cd ${APP_DIRECTORY}
- pytest -v --durations=10
after_script:
- mkdir convergence_plots
- cp tests/*/*/convergence_plot* convergence_plots/
- mkdir errors
- for file in tests/*/*/errors.csv; do foldername=${file%/errors.csv}; casename=$(basename $foldername); cp ${file} errors/errors_${casename}.csv; done
# - for file in tests/*/*/errors.csv; do foldername=${file%/errors.csv}; casename=$(basename $foldername); echo $foldername; mkdir -p errors/$foldername; cp $file errors/$foldername; done # to update referrors
coverage: '/TOTAL.*? (100(?:\.0+)?\%|[1-9]?\d(?:\.\d+)?\%)$/'
artifacts:
when: always
paths:
- ${APP_DIRECTORY}/convergence_plots
- ${APP_DIRECTORY}/errors
- ${APP_DIRECTORY}/htmlcov
expire_in: 6 month
# **************************************************************************** #
# deploy
# **************************************************************************** #
deploy:latex:
stage: deploy
image:
# name: blang/latex:ctanfull # only TexLive 2017
name: aergus/latex:latest
dependencies:
- build:docs
script:
- cd ${DOCS_DIRECTORY}/_build/latex/
- make
artifacts:
paths:
- ${DOCS_DIRECTORY}/_build/latex/${DOCS_LATEX_NAME}.pdf
expire_in: 6 month
only:
- master
- tags
tags:
- docker
pages:
stage: deploy
dependencies:
- build:docs
script:
- mv ${DOCS_DIRECTORY}/_build/html/ ${CI_PROJECT_DIR}/public/
artifacts:
paths:
- public
only:
- master
- tags
tags:
- shell