.gitlab-ci.yml 2.37 KB
Newer Older
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
1
2
# For further explanations, please visit: https://gitlab.pasteur.fr/help/ci/yaml/README

Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
3
4
5
image: docker:latest

services:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
6
  - docker:dind
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
7

Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
8
stages:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
9
  - build
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
10
  - test
11
  - coverage
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
12
  - deploy
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
13
  - cleanup
14
  - deliver
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
15

Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
16
17
18
build:
  stage: build
  script:
19
    - docker login -u gitlab-ci-token -p "$CI_JOB_TOKEN" registry-gitlab.pasteur.fr
20
21
    - docker build --pull -t "$CI_REGISTRY_IMAGE:latest" .
    - docker push "$CI_REGISTRY_IMAGE:latest"
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
22
  only:
23
    changes:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
24
      - .gitlab-ci.yml
25
26
27
      - Dockerfile
      - package.json
      - setup.py
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
28

Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
29
pytest:
30
  image: $CI_REGISTRY_IMAGE:latest
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
31
32
  stage: test
  script:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
33
34
    - cd ${CI_PROJECT_DIR}
    - git describe --tags
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
35
36
    - pytest -sx --doctest-modules --doctest-ignore-import-errors

37
38
coverage:
  stage: coverage
39
  image: $CI_REGISTRY_IMAGE:latest
40
  script:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
41
    - pytest --cov=aria --cov-report html --cov-report term
42
43
44
45
  coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
  artifacts:
    paths:
      - htmlcov/
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
46
  only:
47
48
49
50
    refs:
      - master
    changes:
      - src/**/*
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
51
    
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
52
pages:
53
  image: $CI_REGISTRY_IMAGE:latest
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
54
  stage: deploy
55
56
  dependencies:
    - coverage
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
57
  script:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
58
59
60
    - cd ${CI_PROJECT_DIR}/docs/
    - make html
    - cd ${CI_PROJECT_DIR}
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
61
    - mv ${CI_PROJECT_DIR}/docs/_build/html/ public
62
    - mv htmlcov public/
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
63
64
  artifacts:
    paths:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
65
      - public
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
66
  only:
67
68
69
70
    refs:
      - master
    changes:
      - docs/**/*
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
71

Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
72
cleanup_pypirc:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
73
74
75
  stage: cleanup
  when: always   # this is important; run even if preceding stages failed.
  script:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
76
    - rm -vf ~/.pypirc  # we don't want to leave these around, but GitLab may clean up anyway.
77
78
79
80
81
82

deliver:
  image:
    name: registry.gitlab.com/hyper-expanse/open-source/semantic-delivery-gitlab:9.0.0
    entrypoint: [""]
  only:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
83
84
    refs:
      - merge_requests
85
  script:
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
86
    - semantic-delivery-gitlab --token $SEMANTIC_TOKEN
87
  stage: deliver
Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
88
89
  

Fabrice  ALLAIN's avatar
Fabrice ALLAIN committed
90
91
92
93
94
95
96
97
98
99
100
101
# deploy_pypi:
#     stage: deploy
#     script:   # Configure the PyPI credentials, then push the package, and cleanup the creds.
#         - echo "[server-login]" >> ~/.pypirc
#         - echo "username=" ${PYPI_USER} >> ~/.pypirc
#         - echo "password=" ${PYPI_PASSWORD} >> ~/.pypirc
#         - python setup.py check sdist bdist upload   # This will fail if your creds are bad.
#         - echo "" > ~/.pypirc && rm ~/.pypirc  # If the above fails, this won't run.
#     only:
#         - /^v\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
#     except:
#         - branches