.gitlab-ci.yml 3.24 KB
Newer Older
Paul Erhart's avatar
Paul Erhart committed
1 2 3 4 5 6 7
image: registry.gitlab.com/materials-modeling/hiphive/ci:latest


before_script:
  - INSTDIR=$PWD/opt/lib/python
  - export PYTHONPATH=$INSTDIR:$PYTHONPATH

Paul Erhart's avatar
Paul Erhart committed
8

Paul Erhart's avatar
Paul Erhart committed
9
build_linux:
Paul Erhart's avatar
Paul Erhart committed
10
  stage: build
Paul Erhart's avatar
Paul Erhart committed
11 12 13
  tags:
    - linux
  script:
Paul Erhart's avatar
Paul Erhart committed
14
    - mkdir -p $INSTDIR
Paul Erhart's avatar
Paul Erhart committed
15
    - python3 ./setup.py install --home=$PWD/opt
Paul Erhart's avatar
Paul Erhart committed
16
  artifacts:
Paul Erhart's avatar
Paul Erhart committed
17
    expire_in: 14 days
Paul Erhart's avatar
Paul Erhart committed
18
    paths:
Paul Erhart's avatar
Paul Erhart committed
19
      - opt/
Paul Erhart's avatar
Paul Erhart committed
20

Erik Fransson's avatar
Erik Fransson committed
21

Paul Erhart's avatar
Paul Erhart committed
22
basic_tests:
Paul Erhart's avatar
Paul Erhart committed
23 24 25
  stage: test
  tags:
    - linux
Paul Erhart's avatar
Paul Erhart committed
26 27
  dependencies:
    - build_linux
Paul Erhart's avatar
Paul Erhart committed
28
  script:
Paul Erhart's avatar
Paul Erhart committed
29
    - xdoctest hiphive
30
    - coverage run tests/main.py
31 32
    - coverage report -m --omit=hiphive/calculators/numba_calc.py
    - coverage html --omit=hiphive/calculators/numba_calc.py
Paul Erhart's avatar
Paul Erhart committed
33 34
  coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
  artifacts:
Paul Erhart's avatar
Paul Erhart committed
35
    expire_in: 14 days
Paul Erhart's avatar
Paul Erhart committed
36
    paths:
37
      - htmlcov
Paul Erhart's avatar
Paul Erhart committed
38

Erik Fransson's avatar
Erik Fransson committed
39

Paul Erhart's avatar
Paul Erhart committed
40
test_examples:
Erik Fransson's avatar
Erik Fransson committed
41 42 43 44 45 46 47 48 49 50 51
  stage: test
  only:
    - schedules
  tags:
    - linux
  dependencies:
    - build_linux
  script:
    - export PYTHONPATH=$INSTDIR:$PYTHONPATH
    - pwd=`pwd`
    - |
Paul Erhart's avatar
Paul Erhart committed
52
      for dir in $(find examples/ -name '*.py' | xargs dirname | sort -uk1 | grep -v compare_fcs_phono3py) ; do
Erik Fransson's avatar
Erik Fransson committed
53 54 55
        echo "dir= $dir"
        cd $pwd
        cd $dir
Paul Erhart's avatar
Paul Erhart committed
56
        for file in $(ls *.py | sort -gk1) ; do
57
          echo "Running $file -- `date`"
Erik Fransson's avatar
Erik Fransson committed
58
          python3 $file
59
          echo "Finished running $file -- `date`"
Erik Fransson's avatar
Erik Fransson committed
60 61
        done
        echo
Paul Erhart's avatar
Paul Erhart committed
62
      done
Erik Fransson's avatar
Erik Fransson committed
63 64


Paul Erhart's avatar
Paul Erhart committed
65
style_check:
Paul Erhart's avatar
Paul Erhart committed
66 67 68 69
  stage: test
  tags:
    - linux
  script:
70
    - flake8 doc/ examples/ hiphive/ tests/
Paul Erhart's avatar
Paul Erhart committed
71

Erik Fransson's avatar
Erik Fransson committed
72

Paul Erhart's avatar
Paul Erhart committed
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
test_documentation:
  stage: test
  dependencies:
    - build_linux
  script:
    - mkdir public
    - sphinx-build -b doctest -W doc/source/ public/
    - sphinx-build -W doc/source/ public/
  except:
   - master
  artifacts:
    expire_in: 1 days
    paths:
      - public


Paul Erhart's avatar
Paul Erhart committed
89 90 91
pages:
  stage: deploy
  dependencies:
Paul Erhart's avatar
Paul Erhart committed
92
    - build_linux
Paul Erhart's avatar
Paul Erhart committed
93
    - basic_tests
Paul Erhart's avatar
Paul Erhart committed
94
  script:
Paul Erhart's avatar
Paul Erhart committed
95
    # prepare homepage
Paul Erhart's avatar
Paul Erhart committed
96
    - mkdir -p public/dev
97
    - mv doc/google*.html public/
Paul Erhart's avatar
Paul Erhart committed
98 99 100 101 102
    # prepare
    - INSTDIR=$PWD/opt/lib/python
    - export PYTHONPATH=$INSTDIR:$PYTHONPATH
    # --------------------------
    # STABLE VERSION
Paul Erhart's avatar
Paul Erhart committed
103
    - tag=$(git tag | tail -1)
104
    - echo "tag= $tag"
Paul Erhart's avatar
Paul Erhart committed
105
    - git checkout $tag
Paul Erhart's avatar
Paul Erhart committed
106
    # code coverage report
107
    - cp -dr htmlcov/ public/coverage/
Paul Erhart's avatar
Paul Erhart committed
108
    # build user guide
Paul Erhart's avatar
Paul Erhart committed
109
    - sphinx-build -W doc/source/ public/
Paul Erhart's avatar
Paul Erhart committed
110 111 112 113 114 115
    # make tests and examples downloadable
    - cd examples
    - find tutorial/ -print | zip ../public/tutorial.zip [email protected]
    - find advanced_topics/ -print | zip ../public/advanced_topics.zip [email protected]
    - cd ..
    - find tests/ -print | zip public/tests.zip tests/structure_databases/*.db [email protected]
116 117
    # --------------------------
    # DEVELOPMENT VERSION
118
    - git checkout master
119
    - tag=$(git describe | tail -1)
120
    - echo "tag= $tag"
121 122 123
    # code coverage report
    - cp -dr htmlcov/ public/dev/coverage/
    # build user guide
124
    - sed -i "s/version = ''/version = '$tag'/" doc/source/conf.py
125
    - cat doc/source/conf.py
Paul Erhart's avatar
Paul Erhart committed
126
    - sphinx-build -W doc/source/ public/dev/
127 128 129 130 131 132 133
    # make tests and examples downloadable
    - cd examples
    - find tutorial/ -print | zip ../public/dev/tutorial.zip [email protected]
    - find advanced_topics/ -print | zip ../public/dev/advanced_topics.zip [email protected]
    - cd ..
    - find tests/ -print | zip public/dev/tests.zip tests/structure_databases/*.db [email protected]
    # --------------------------
134 135 136
    # clean up
    - ls -l public/
    - chmod go-rwX -R public/
Paul Erhart's avatar
Paul Erhart committed
137
  artifacts:
Paul Erhart's avatar
Paul Erhart committed
138 139
    paths:
      - public
Paul Erhart's avatar
Paul Erhart committed
140 141
  only:
    - master