.gitlab-ci.yml 3.44 KB
Newer Older
1
image: dtuwindenergy/topfarm2:latest
Mads M. Pedersen's avatar
Mads M. Pedersen committed
2

Mads M. Pedersen's avatar
Mads M. Pedersen committed
3 4 5 6 7
stages:
  - test
  - test_plugins
  - deploy

Mads M. Pedersen's avatar
Mads M. Pedersen committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# ===== TEST PyWake debian=====
test_PyWake:  # name the job what we like
  stage:  # build, test, deploy defined by default [2]
    test
  script:
  - pip install -e .
  - py.test
  tags:  # only runners with this tag can do the job [3]
  - python

  
# ===== Check code style =====
check_code_style:  # name the job what we like
  stage:  # build, test, deploy defined by default [2]
    test
  script:
  - pip install -e .
25
  - pycodestyle --ignore=E501,W504,E741 py_wake
Mads M. Pedersen's avatar
Mads M. Pedersen committed
26 27 28 29 30 31 32 33
  tags:  # only runners with this tag can do the job [3]
  - python

# ===== TEST PyWake on Windows =====
test_PyWake_windows:  # name the job what we like
  stage:  # build, test, deploy defined by default [2]
    test
  script:  # runs on windows machine due to tag below
Mads M. Pedersen's avatar
Mads M. Pedersen committed
34 35
  - source activate pyTopfarm
  - pytest --cov-report term-missing:skip-covered --cov=py_wake --cov-config .coveragerc
Mads M. Pedersen's avatar
Mads M. Pedersen committed
36
  tags:  # tag for shared runner on windows machine
Mads M. Pedersen's avatar
Mads M. Pedersen committed
37
  - ANMH_old
Jenni Rinker's avatar
Jenni Rinker committed
38

Mads M. Pedersen's avatar
Mads M. Pedersen committed
39 40
# ===== Trigger PyWakePark pipeline =====
trigger_pywake_park_test:
Mads M. Pedersen's avatar
Mads M. Pedersen committed
41
  stage: test_plugins
Mads M. Pedersen's avatar
Mads M. Pedersen committed
42 43 44 45 46 47 48
  variables:
    TRIGGER_BRANCH: $CI_COMMIT_REF_NAME
  trigger:
    project: TOPFARM/cuttingedge/pywake/pywake_park
    strategy: depend
  only:
    - schedules
Mads M. Pedersen's avatar
Mads M. Pedersen committed
49 50


Mads M. Pedersen's avatar
Mads M. Pedersen committed
51 52

# ===== Trigger PyWakeEllipSys pipeline =====
Mads M. Pedersen's avatar
Mads M. Pedersen committed
53
trigger_pywake_ellipsys_test:
Mads M. Pedersen's avatar
Mads M. Pedersen committed
54
  stage: test_plugins
Mads M. Pedersen's avatar
Mads M. Pedersen committed
55 56 57 58 59 60 61 62 63 64
  variables:
    TRIGGER_BRANCH: $CI_COMMIT_REF_NAME
  trigger:
    project: TOPFARM/cuttingedge/pywake/pywake_ellipsys
    strategy: depend
  only:
    - schedules



Mads M. Pedersen's avatar
Mads M. Pedersen committed
65

Jenni Rinker's avatar
Jenni Rinker committed
66 67 68 69 70
# ===== build documentation =====
pages:  # "pages" is a job specifically for GitLab pages [1]
  stage:  # build, test, deploy defined by default [2]
    deploy
  script:  # use sphinx to build docs, move to public page
Mads M. Pedersen's avatar
Mads M. Pedersen committed
71
  - pip install sphinx --upgrade
Mads M. Pedersen's avatar
Mads M. Pedersen committed
72
  - pip install nbsphinx --upgrade
Paul van der Laan's avatar
Paul van der Laan committed
73
  - pip install -e .
Mads M. Pedersen's avatar
Mads M. Pedersen committed
74 75
  - cd docs/validation_report
  - python generate_validation_figures.py
Paul van der Laan's avatar
Paul van der Laan committed
76 77 78 79 80 81
  - cd report
  - apt-get install -y texlive-latex-extra
  - pdflatex validation_report.tex
  - bibtex validation_report.aux
  - pdflatex validation_report.tex
  - pdflatex validation_report.tex
Mads M. Pedersen's avatar
Mads M. Pedersen committed
82 83 84 85
  - cd ../../
  - pwd
  - make html
  #- make latexpdf
Jenni Rinker's avatar
Jenni Rinker committed
86 87 88 89
  - cd ../; mv docs/build/html public/
  artifacts:  # required for GitLab pages [1]
    paths:
    - public
Mads M. Pedersen's avatar
Mads M. Pedersen committed
90
    #- docs/build/latex/PyWake.pdf
Jenni Rinker's avatar
Jenni Rinker committed
91
  only:  # only run for these branches
92
  - master
Mads M. Pedersen's avatar
Mads M. Pedersen committed
93
  - /^test_doc.*/ 
Jenni Rinker's avatar
Jenni Rinker committed
94 95
  tags:  # only runners with this tag can do the job [3]
  - python
mikf's avatar
mikf committed
96 97 98 99 100 101 102 103 104

pypi_linux:
  stage:  
    deploy
  only:
    - tags
    - test_pypi
  script:
    - apt-get update
Mads M. Pedersen's avatar
Mads M. Pedersen committed
105
    - pip install pypandoc
mikf's avatar
mikf committed
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
    - pip install -e . --upgrade
    - python3 -c 'from git_utils import get_tag; get_tag(verbose=True)'
    - python3 -m pip install -U setuptools wheel
    - python3 setup.py sdist bdist_wheel
    - python3 -m pip install -U twine
    - python3 -c 'from git_utils import rename_dist_file; rename_dist_file()'
    - twine upload dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD
    #- twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u $TWINE_USERNAME -p $TWINE_PASSWORD # for testing purposes
  tags:  
    - python

# current
# pypi_windows:
#   stage:  
#     deploy
#   only:
#     - tags
#     - test_pypi
#   script:
#     - c:/Anaconda3/envs/pyTopfarm/python.exe setup.py bdist_wheel
#     - twine upload dist/* -u %TWINE_USERNAME% -p %TWINE_PASSWORD%
#     #- twine upload --repository-url https://test.pypi.org/legacy/ dist/* -u %TWINE_USERNAME% -p %TWINE_PASSWORD% # for testing purposes
#   tags:  
#     - CPAV_old_PC