.gitlab-ci.yml 2.96 KB
Newer Older
Benoit Martin's avatar
Benoit Martin committed
1 2
# Continuous Integration Script
# Deformetrica - ARAMIS
3

Benoit Martin's avatar
Benoit Martin committed
4
stages:
5
  - prepare_env   # prepare conda environment defined in environment.yml
Benoit Martin's avatar
Benoit Martin committed
6
  - test    # run unit tests
Benoit Martin's avatar
Benoit Martin committed
7
  - package_and_deploy # package for deployment
8
  - cleanup
Benoit Martin's avatar
Benoit Martin committed
9

Benoit Martin's avatar
Benoit Martin committed
10 11 12
############
# TEMPLATES
############
13 14
.prepare_env_template: &prepare_env
  stage: prepare_env
15
  retry: 2
Benoit Martin's avatar
Benoit Martin committed
16
  script:
17
    - id
Benoit Martin's avatar
Benoit Martin committed
18 19
    - pwd
    - ls -al
Benoit Martin's avatar
Benoit Martin committed
20
    - if [ -f "~/.profile" ]; then . ~/.profile; fi
21 22
    - conda env create --force --file environment.yml

Benoit Martin's avatar
Benoit Martin committed
23
.unit_test_template: &unit-test
24 25
  stage: test
  script:
Benoit Martin's avatar
Benoit Martin committed
26
    - if [ -f "~/.profile" ]; then . ~/.profile; fi
27
    - source activate deformetrica
Benoit Martin's avatar
Benoit Martin committed
28
    - echo $PYTHONPATH
29
    - PYTHONPATH=$PYTHONPATH:src/:tests/ ./tests/unit_tests/run_unit_tests.py
Benoit Martin's avatar
Benoit Martin committed
30 31
    - source deactivate

Benoit Martin's avatar
Benoit Martin committed
32
.functional_test_template: &functional-test
33 34 35 36 37
  stage: test
  script:
    - if [ -f "~/.profile" ]; then . ~/.profile; fi
    - source activate deformetrica
    - echo $PYTHONPATH
Benoit Martin's avatar
Benoit Martin committed
38
    - PYTHONPATH=$PYTHONPATH:src/:tests/ ./tests/functional_tests/run_functional_tests.py
39
    - source deactivate
Benoit Martin's avatar
Benoit Martin committed
40

Benoit Martin's avatar
Benoit Martin committed
41 42
.package_and_deploy_template: &package_and_deploy
  stage: package_and_deploy
43
  retry: 2
44
  only:
Benoit Martin's avatar
Benoit Martin committed
45
    - tags
46 47 48
  environment:
    name: anaconda
    url: https://anaconda.org/aramislab/deformetrica
49
  script:
Benoit Martin's avatar
Benoit Martin committed
50
    - id && pwd && ls -alh
51
    - mkdir deformetrica-build && cd deformetrica-build
52
    - conda install conda-build==3.16.3 anaconda-client pip && conda update conda anaconda-client
Benoit Martin's avatar
Benoit Martin committed
53
#    - export GIT_SSL_NO_VERIFY=1
Benoit Martin's avatar
Benoit Martin committed
54
    - BUILD_GUI=TRUE PACKAGE_NAME=deformetrica conda-build -c pytorch -c anaconda -c conda-forge --output-folder . ../conda
55
#    - BUILD_GUI=FALSE PACKAGE_NAME=deformetrica-nox conda-build --py 3.5 --py 3.6 --py 3.7 -c pytorch -c anaconda -c conda-forge --output-folder . ../conda/meta.yaml # TODO
56
    - anaconda --token=$ANACONDA_TOKEN --verbose upload --user Aramislab --force --no-progress **/*.tar.bz2
57

58

Benoit Martin's avatar
Benoit Martin committed
59 60 61
#########
# LINUX
#########
62 63
prepare_env:linux:
  <<: *prepare_env
Benoit Martin's avatar
Benoit Martin committed
64
  tags:
Benoit Martin's avatar
Benoit Martin committed
65
    - linux
Benoit Martin's avatar
Benoit Martin committed
66

67 68 69
unit-test:linux:
  <<: *unit-test
  tags:
Benoit Martin's avatar
Benoit Martin committed
70 71
    - linux
    - cuda-cc52
72 73 74 75

functional-test:linux:
  <<: *functional-test
  tags:
Benoit Martin's avatar
Benoit Martin committed
76 77
    - linux
    - cuda-cc52
Benoit Martin's avatar
Benoit Martin committed
78

Benoit Martin's avatar
Benoit Martin committed
79 80
package_and_deploy:linux:
  <<: *package_and_deploy
81
  tags:
Benoit Martin's avatar
Benoit Martin committed
82 83
    - linux
    - package
84

Benoit Martin's avatar
Benoit Martin committed
85 86 87
#########
# MACOS
#########
88 89
prepare_env:macos:
  <<: *prepare_env
Benoit Martin's avatar
Benoit Martin committed
90 91 92
  tags:
    - macos

93 94 95 96 97 98 99 100 101
unit-test:macos:
  <<: *unit-test
  tags:
    - macos

functional-test:macos:
  <<: *functional-test
  tags:
    - macos
Benoit Martin's avatar
Benoit Martin committed
102

Benoit Martin's avatar
Benoit Martin committed
103 104
package_and_deploy:macos:
  <<: *package_and_deploy
105 106
  tags:
    - macos
Benoit Martin's avatar
Benoit Martin committed
107
    - package
108 109


Benoit Martin's avatar
Benoit Martin committed
110 111 112
###################
# EXAMPLE DATASET
###################
113
package_and_deploy:examples:
Benoit Martin's avatar
Benoit Martin committed
114
  stage: package_and_deploy
115 116
  tags:
    - linux
Benoit Martin's avatar
Benoit Martin committed
117
    - package
118 119
  only:
    - tags
Benoit Martin's avatar
Benoit Martin committed
120
  script:
121 122 123 124
    - zip -r examples.zip examples
    - tar -zcvf examples.tar.gz examples
  artifacts:
    name: examples
125
    paths:
Benoit Martin's avatar
Benoit Martin committed
126 127
      - examples.zip
      - examples.tar.gz
128 129 130 131 132 133 134

###########
# CLEANUP
###########
cleanup:
  stage: cleanup
  when: always
Benoit Martin's avatar
Benoit Martin committed
135 136
  tags:
    - package
137 138
  script:
    - conda-build purge
139 140
    - rm -rf deformetrica-build
    - conda clean -y -a