.gitlab-ci.yml 2.64 KB
Newer Older
William Clarke's avatar
William Clarke committed
1
2
3
4
5
6
7
8
9
10
11
12
###########################################################################
# This file defines the build process for fsl-mrs, as hosted at:
#
#    https://git.fmrib.ox.ac.uk/fsl/fsl_mrs
#
# The build pipeline currently comprises the following stages:
#
#    1. style:     Check coding style - allowed to fail
#
#    2. test:      Unit tests
#
#    3. doc:       Building user documentation which appears at:
13
#                  https://open.win.ox.ac.uk/pages/fsl/fsl_mrs/
William Clarke's avatar
William Clarke committed
14
#
15
16
17
18
19
#    4. build
#       & deploy:  Build conda package in three stages fsl-ci-pre,
#                  fsl-ci-build, fsl-ci-deploy (fsl-ci-test is not
#                  used in this repository).
#
William Clarke's avatar
William Clarke committed
20
21
22
23
24
25
26
27
28
29
#
# A custom docker image is used for the test job - images are
# available at:
#
#    https://hub.docker.com/u/wtclarke/
#
# Stage run conditions:
# Style is run in all cases, but allowed to fail.
# Test is run in all cases.
# Doc is only run on master branches.
30
31
# Build stages are run according to the rules associated 
#   with https://git.fmrib.ox.ac.uk/fsl/fsl-ci-rules
William Clarke's avatar
William Clarke committed
32
33
#
###########################################################################
34
35
36
include:
 - project: fsl/fsl-ci-rules
   file:    .gitlab-ci.yml
William Clarke's avatar
William Clarke committed
37

William Clarke's avatar
William Clarke committed
38
stages:
William Clarke's avatar
William Clarke committed
39
40
41
  - style
  - test
  - doc
42
43
  - fsl-ci-pre
  - fsl-ci-build
44
  - fsl-ci-test
45
  - fsl-ci-deploy
William Clarke's avatar
William Clarke committed
46
47
48
49
50
51
52
53
54

####################################
# These anchors are used to restrict
# when and where jobs are executed.
####################################

.except_releases: &except_releases
  except:
    - tags
55

William Clarke's avatar
William Clarke committed
56
57
58
# ############
# # 1. style 
# ############
William Clarke's avatar
William Clarke committed
59
flake8:
60
  <<: *except_releases
William Clarke's avatar
William Clarke committed
61
62
63
64
65
66
67
  image: python:3.7-slim-buster
  stage: style
  before_script:
  - python --version
  - pip install flake8  
  script:
  - flake8 fsl_mrs
William Clarke's avatar
William Clarke committed
68
  - flake8 fsl_mrs/scripts/*
William Clarke's avatar
William Clarke committed
69
  allow_failure: true
William Clarke's avatar
William Clarke committed
70

William Clarke's avatar
William Clarke committed
71
72
73
############
# 2. test 
############
William Clarke's avatar
William Clarke committed
74

William Clarke's avatar
William Clarke committed
75
pytest:
76
  <<: *except_releases
William Clarke's avatar
William Clarke committed
77
78
79
80
81
82
83
84
85
86
87
88
89
90
  image: wtclarke/fsl_mrs_tests:1.0
  stage: test
  variables:
    GIT_SUBMODULE_STRATEGY: normal
  before_script:
  - conda init bash
  - source ~/.bashrc 
  - conda create -n fsl_mrs -y python=3.7
  - conda activate fsl_mrs
  - conda install -y -c conda-forge -c https://fsl.fmrib.ox.ac.uk/fsldownloads/fslconda/channel/ --file requirements.txt
  - conda install -y -c conda-forge pytest
  - pip install .
  script:
  - pytest fsl_mrs/tests
91
  - pytest fsl_mrs/denmatsim/tests
William Clarke's avatar
William Clarke committed
92

William Clarke's avatar
William Clarke committed
93
94
95
############
# 3. doc 
############
William Clarke's avatar
William Clarke committed
96

William Clarke's avatar
William Clarke committed
97
pages:
98
99
100
  variables:
    GIT_LFS_SKIP_SMUDGE: "1"
    GIT_STRATEGY: clone
William Clarke's avatar
William Clarke committed
101
102
103
  only:
    - master@wclarke/fsl_mrs
    - tags@fsl/fsl_mrs
William Clarke's avatar
William Clarke committed
104
105
106
  image: python:3.7
  stage: doc
  script:
107
  - git describe --tag --dirty
108
  - pip install -U sphinx sphinx_rtd_theme==0.5.2
109
  - pip install .
William Clarke's avatar
William Clarke committed
110
111
112
113
  - sphinx-build -b html ./docs/user_docs public
  artifacts:
    paths:
    - public