.gitlab-ci.yml 2.05 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
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
39
    - fix-makefiles
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
40

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

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

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

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

68
69
70
71
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
72
    - echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc
73
    - echo "username=" ${PYPI_USER} >> ~/.pypirc
74
75
76
77
    - echo "password=" ${PYPI_PASSWORD} >> ~/.pypirc
    - make pip_upload
    - echo "" > ~/.pypirc && rm ~/.pypirc  # If the above fails, this won't run.
  only:
78
    - /^v?\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
79
80
81
82
  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
  only:
    - master
89
    - fix-makefiles
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
90

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

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
99
100
101
clean :
  stage: clean
  script:
102
    - make -e clean
103
104
  when: manual

105
cleanup_py:
106
107
108
109
   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
110
    - docker logout