.gitlab-ci.yml 1.95 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
9
stages:
  - test
10
  - push
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
11
  - deploy
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
12
  - clean
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
13

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
14
before_script:
15
  - docker login -u $HUB_USER -p $HUB_PASSWORD
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
16

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

test-2.7:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
29
30
  variables:
    PYTHON_VERSION: "2.7"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
31
32

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

40
push-3.5:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
41
42
  <<: *image_definition
  variables:
43
    PYTHON_VERSION: "3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
44

45
push-2.7:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
46
47
  <<: *image_definition
  variables:
48
    PYTHON_VERSION: "2.7"
49

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

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

66
67
68
69
70
71
72
73
74
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:
75
    - /^v?\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
76
77
78
79
  except:
    - branches

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

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
87
88
89
90
91
92
93
94
push-github:
  stage: deploy
  script:
    - make -e push-github
  only:
    - master
    - triggers

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
95
96
97
clean :
  stage: clean
  script:
98
    - make -e clean
99
100
101
102
103
104
105
  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.
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
106
    - docker logout