.gitlab-ci.yml 2.12 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
  - make -e login
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
21
22
  except:
    - tags # Avoid unnecessary double testing
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
23
    
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
24
25
test-3.5:
  <<: *test_definition
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
26
27
  variables:
    PYTHON_VERSION: "3.5"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
28
29
30

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

.image: &image_definition
35
  stage: push
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
36
  script:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
37
    - make -e push-$PYTHON_VERSION
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
38
  only:
39
40
    - tags
    - triggers
41
    - fix-makefiles
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
    - triggers
60
    - fix-makefiles
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
61

62
push-github:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
63
64
  stage: deploy
  script:
65
    - make -e push-github
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
66
67
  only:
    - master
68
    - triggers
69
    - fix-makefiles
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
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
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
75
    - echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc
76
    - echo "username=" ${PYPI_USER} >> ~/.pypirc
77
78
79
80
    - echo "password=" ${PYPI_PASSWORD} >> ~/.pypirc
    - make pip_upload
    - echo "" > ~/.pypirc && rm ~/.pypirc  # If the above fails, this won't run.
  only:
81
    - /^v?\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
82
83
84
85
  except:
    - branches

deploy:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
86
  stage: deploy
87
  environment: test
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
88
  script:
89
    - make -e deploy
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
90
91
  only:
    - master
92
    - fix-makefiles
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
93

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
94
95
96
97
98
99
100
101
push-github:
  stage: deploy
  script:
    - make -e push-github
  only:
    - master
    - triggers

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
102
103
104
clean :
  stage: clean
  script:
105
    - make -e clean
106
107
  when: manual

108
cleanup_py:
109
110
111
112
   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
113
    - docker logout