forked from multiphenics/multiphenics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
133 lines (124 loc) · 3.76 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
stages:
- build
- import
- test
- release
variables:
TESTING_IMAGE: $CI_REGISTRY_IMAGE:testing-$CI_COMMIT_SHA
RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
build:
image: docker:latest
services:
- docker:dind
stage: build
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker build --pull -t $TESTING_IMAGE -f docker/Dockerfile .
- docker push $TESTING_IMAGE
import:
image:
name: $TESTING_IMAGE
entrypoint: ["/sbin/my_init","--quiet","--","/sbin/setuser","fenics"]
stage: import
before_script:
- source $FENICS_HOME/fenics.env.conf
- export DIJITSO_CACHE_DIR=$CI_PROJECT_DIR/.dijitso
script:
- python3 -c "import multiphenics"
artifacts:
paths:
- jitfailure*
when: on_failure
flake8:
image:
name: $TESTING_IMAGE
entrypoint: ["/sbin/my_init","--quiet","--","/sbin/setuser","fenics"]
stage: test
before_script:
- source $FENICS_HOME/fenics.env.conf
- export DIJITSO_CACHE_DIR=$CI_PROJECT_DIR/.dijitso
- python3 -c "import multiphenics"
script:
- find . -type f -name "__init__.py" -exec bash -c 'mv "$0" "`echo \"$0\" | sed s/__init__/___init___/`"' {} \;
- sed -i "s|__init__.py|___init___.py|g" setup.cfg
- pytest --flake8 -m flake8 -vv --html=pytest_flake8.html --self-contained-html
- find . -type f -name "___init___.py" -exec bash -c 'mv "$0" "`echo \"$0\" | sed s/___init___/__init__/`"' {} \;
- sed -i "s|___init___.py|__init__.py|g" setup.cfg
artifacts:
paths:
- pytest_flake8.html
when: on_failure
tutorials_serial:
image:
name: $TESTING_IMAGE
entrypoint: ["/sbin/my_init","--quiet","--","/sbin/setuser","fenics"]
stage: test
before_script:
- source $FENICS_HOME/fenics.env.conf
- export DIJITSO_CACHE_DIR=$CI_PROJECT_DIR/.dijitso
- python3 -c "import multiphenics"
script:
- pytest -n auto -vv --html=pytest_tutorials_serial.html --self-contained-html tutorials
artifacts:
paths:
- pytest_tutorials_serial.html
when: on_failure
tests_serial:
image:
name: $TESTING_IMAGE
entrypoint: ["/sbin/my_init","--quiet","--","/sbin/setuser","fenics"]
stage: test
before_script:
- source $FENICS_HOME/fenics.env.conf
- export DIJITSO_CACHE_DIR=$CI_PROJECT_DIR/.dijitso
- python3 -c "import multiphenics"
script:
- pytest -n auto -vv --html=pytest_tests_serial.html --self-contained-html tests
artifacts:
paths:
- pytest_tests_serial.html
when: on_failure
.tutorials_parallel:
image:
name: $TESTING_IMAGE
entrypoint: ["/sbin/my_init","--quiet","--","/sbin/setuser","fenics"]
stage: test
before_script:
- source $FENICS_HOME/fenics.env.conf
- export DIJITSO_CACHE_DIR=$CI_PROJECT_DIR/.dijitso
- python3 -c "import multiphenics"
script:
- mpirun -n 2 pytest -vv --html=pytest_tutorials_parallel.html --self-contained-html tutorials
artifacts:
paths:
- pytest_tutorials_parallel.html
when: on_failure
.tests_parallel:
image:
name: $TESTING_IMAGE
entrypoint: ["/sbin/my_init","--quiet","--","/sbin/setuser","fenics"]
stage: test
before_script:
- source $FENICS_HOME/fenics.env.conf
- export DIJITSO_CACHE_DIR=$CI_PROJECT_DIR/.dijitso
- python3 -c "import multiphenics"
script:
- mpirun -n 2 pytest -vv --html=pytest_tests_parallel.html --self-contained-html tests
artifacts:
paths:
- pytest_tests_parallel.html
when: on_failure
release:
image: docker:latest
services:
- docker:dind
stage: release
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker pull $TESTING_IMAGE
- docker tag $TESTING_IMAGE $RELEASE_IMAGE
- docker push $RELEASE_IMAGE
only:
- master