.gitlab-ci.yml 2.91 KB
Newer Older
1
# CI / CD for the fsl/conda/installer project.
2
#
3
# Unit tests are run every time commits are
4
5
6
7
8
9
10
11
# pushed to any branch.
#
# Release jobs are run every time a new tag
# is added. Release jobs assume that they
# are running in an environment with a
# directory $FSLINSTALLER_DEPLOY_DIRECTORY
# into which the fslinstaller.py script can
# be copied.
12
13
stages:
  - test
14
  - check-version
15
16
  - release

17
# Don't run pipeline on MRs
18
19
workflow:
  rules:
20
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
21
      when: never
22
    - when: always
23

24
25
26
27
28
29
30

# These variables should be set as CI/CD variables in
# the fsl/conda/installer project via the GitLab UI.
variables:

  # Directory in which new versions of the
  # installer script should be copied into.
Paul McCarthy's avatar
Paul McCarthy committed
31
  FSLINSTALLER_DEPLOY_DIRECTORY: "/exports/fsldownloads/fslconda/releases/"
32
33
34
35
36
37
38
39

  # GitLab API token with enough privileges to push a
  # branch to the fsl/conda/manifest repository, and open
  # a merge request.  Used by the update_manifest.py
  # script to update the FSL release manifest file when a
  # new fslinstaller version is tagged.
  FSL_CI_API_TOKEN: ""

40

41
.test-template:
42
43
44
45
46
  stage: test
  tags:
    - fsl-ci
    - docker
  rules:
Paul McCarthy's avatar
Paul McCarthy committed
47
    - if: '$CI_COMMIT_TAG == null'
48
  script:
49
    - bash ./.ci/unit_tests.sh
50

51
52
53
test:py27:
  extends: .test-template
  image:    python:2.7
54

55
56
57
test:py33:
  extends: .test-template
  image:    python:3.3
58

59
60
61
test:py34:
  extends: .test-template
  image:    python:3.4
62

63
64
65
test:py35:
  extends: .test-template
  image:    python:3.5
66

67
68
69
test:py36:
  extends: .test-template
  image:    python:3.6
70

71
72
73
test:py37:
  extends: .test-template
  image:    python:3.7
74

75
76
77
test:py38:
  extends: .test-template
  image:    python:3.8
78

79
80
test:py39:
  extends: .test-template
81
82
  image:    python:3.9

83
84
85
86
87
88
89
check-version:
  stage: check-version
  image: python:3.9
  tags:
    - fsl-ci
    - docker
  rules:
90
    - if: '$CI_COMMIT_TAG == null && $CI_COMMIT_BRANCH != "master"'
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
  script:
    - git fetch origin master
    - thisver=$(  cat fslinstaller.py                    | grep "__version__ = " | cut -d " " -f 3 | tr -d "'")
    - masterver=$(git show origin/master:fslinstaller.py | grep "__version__ = " | cut -d " " -f 3 | tr -d "'")
    - |
      if [ "$thisver" = "$masterver" ]; then
        echo "Version has not been updated!"
        echo "Version on master branch: $masterver"
        echo "Version in this MR:       $thisver"
        echo "The version number must be updated before this MR can be merged."
        exit 1
      else
        echo "Version on master branch: $masterver"
        echo "Version in this MR:       $thisver"
      fi

107

108
109
release-new-version:
  stage: release
110
111
112
113
  tags:
    - fslconda-channel-host
  rules:
    - if: '$CI_COMMIT_TAG != null'
Paul McCarthy's avatar
Paul McCarthy committed
114
      when: manual
115
116
  script:
    - bash ./.ci/new_release.sh
117
118
119
120
121
122
123
124
125
126
127
128
129


update-fsl-manifest:
  stage: release
  image: python:3.9
  tags:
    - fsl-ci
    - docker
  rules:
    - if: '$CI_COMMIT_TAG != null'
      when: manual
  script:
    - bash ./.ci/update_manifest.sh