.gitlab-ci.yml 2.04 KB
Newer Older
Alan O'Cais's avatar
Alan O'Cais committed
1
image: cloudcompass/docker-rtdsphinx
2

Alan O'Cais's avatar
Alan O'Cais committed
3 4
spelling:
  script:
Alan O'Cais's avatar
Alan O'Cais committed
5
  - pip3 install codespell
6
  - codespell --skip=".git,_static,_build,Diff*,*.patch,*.f90" --quiet-level=2 --ignore-words-list="adress,catalogue,noe,soler"
Alan O'Cais's avatar
Alan O'Cais committed
7 8 9 10
  only:
  - master
  - merge_requests

11 12 13 14
lint:
  script:
  - pip3 install doc8
  - git diff-tree --no-commit-id --name-only -r $CI_COMMIT_SHA
Sander Roet's avatar
Sander Roet committed
15
  # Run linter over files in last commit exclude deleted files
16
  - ( set -e; for file in $(git diff-tree --no-commit-id --name-only --diff-filter=d -r $CI_COMMIT_SHA); do doc8 --max-line-length 120 --ignore D002 $file; done )
17 18 19
  only:
  - master

Sander Roet's avatar
Sander Roet committed
20 21 22 23 24 25 26 27 28 29 30 31 32 33
lint_MR:
  # Explicit cloning to prevent git remote pollution from previous jobs
  variables:
    GIT_STRATEGY: clone  
  script:
  - pip3 install doc8
  # Add the target project as a remote
  - git remote add upstream $CI_MERGE_REQUEST_PROJECT_URL
  # fetch upstream branches
  - git fetch upstream
  - echo upstream/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
  - git diff --no-commit-id --name-only upstream/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
  # Run linter over files that diff between branch and target upstream branch 
  # excluding deleted files
34
  - ( set -e; for file in $(git diff --no-commit-id --name-only --diff-filter=d upstream/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME); do doc8 --max-line-length 120 --ignore D002 $file; done )
Sander Roet's avatar
Sander Roet committed
35 36 37
  only:
  - merge_requests

Alan O'Cais's avatar
Alan O'Cais committed
38 39
orphans:
  script:
40 41 42
  # Report all the orphans but ignore the exit code
  - find ./ -name "*.rst"|xargs -i grep -H orphan {} || true
  # Now handle the error code
Alan O'Cais's avatar
Alan O'Cais committed
43
  - if [ $(find ./ -name "*.rst"|xargs -i grep -H orphan {}|wc -l) -gt "2" ]; then $(exit 1); else $(exit 0); fi
Alan O'Cais's avatar
Alan O'Cais committed
44 45 46
  only:
  - master

47 48
pages:
  script:
Alan O'Cais's avatar
Alan O'Cais committed
49
  - apt-get -y install dvipng
Alan O'Cais's avatar
Alan O'Cais committed
50 51
  - pip3 install pygments --upgrade
  - pip3 install Sphinx --upgrade
52
  - pip3 install sphinx-rtd-theme --upgrade
53
  - READTHEDOCS=True sphinx-build -nWT -b html . _build/html
54
  - mv _build/html/ public/
55
  - echo -e "\n\n\e[1mYou can find your build of this documentation at \n\t\e[32m${CI_PAGES_URL}\e[0m\n\n"
56 57 58 59 60
  artifacts:
    paths:
    - public
  only:
  - master
Alan O'Cais's avatar
Alan O'Cais committed
61
  - merge_requests