.gitlab-ci.yml 1.9 KB
Newer Older
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
1
2
3
4
# Uncomment if you want to use docker-in-docker
# image: gsiupm/dockermake:latest
# services:
# - docker:dind
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
5
6
# When using dind, it's wise to use the overlayfs driver for
# improved performance.
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
7

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
8
variables:
J. Fernando Sánchez's avatar
Fix 4    
J. Fernando Sánchez committed
9
  IMAGENAME: $CI_REGISTRY_IMAGE
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
10

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
11
12
stages:
  - test
13
  - push
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
14
  - deploy
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
15
  - clean
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
16

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
17
before_script:
18
  - docker login -u $HUB_USER -p $HUB_PASSWORD
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
19

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
20
.test: &test_definition
21
  stage: test
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
22
  script:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
23
    - make -e test-$PYTHON_VERSION
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
24
    
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
25
26
test-3.5:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
27
28
  variables:
    PYTHON_VERSION: "3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
29
30
31

test-2.7:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
32
33
  variables:
    PYTHON_VERSION: "2.7"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
34
35

.image: &image_definition
36
  stage: push
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
37
  script:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
38
    - make -e push-$PYTHON_VERSION
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
39
  only:
40
41
    - tags
    - triggers
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
42

43
push-3.5:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
44
45
  <<: *image_definition
  variables:
46
    PYTHON_VERSION: "3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
47

48
push-2.7:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
49
50
  <<: *image_definition
  variables:
51
    PYTHON_VERSION: "2.7"
52

53
push-latest:
54
  <<: *image_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
55
  variables:
56
    PYTHON_VERSION: latest
57
58
  only:
    - master
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
59
60
    - triggers

61
push-github:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
62
63
  stage: deploy
  script:
64
    - make -e push-github
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
65
66
  only:
    - master
67
    - triggers
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
68

69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
    - make pip_upload
    - 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

deploy:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
83
  stage: deploy
84
  environment: test
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
85
  script:
86
    - make -e deploy
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
87
88
89
  only:
    - master

90
clean_docker :
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
91
92
  stage: clean
  script:
93
    - make -e clean
94
95
96
97
98
99
100
101
  when: manual

cleanup_pypirc:
   stage: clean
   when: always   # this is important; run even if preceding stages failed.
   script:
    - rm -vf ~/.pypirc  # we don't want to leave these around, but GitLab may clean up anyway.
    - docker logout