.gitlab-ci.yml 1.93 KB
Newer Older
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.
7

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
8 9
stages:
  - test
10
  - push
11
  - deploy
12
  - clean
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
13

14
before_script:
15
  - make -e login
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:
20
    - make -e test-$PYTHON_VERSION
21 22
  except:
    - tags # Avoid unnecessary double testing
23
    
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
24 25
test-3.5:
  <<: *test_definition
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
31 32
  variables:
    PYTHON_VERSION: "2.7"
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
33

34
push:
35
  stage: push
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
36
  script:
37
    - make -e push
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-latest:
44 45 46
  stage: push
  script:
    - make -e push-latest
47 48
  only:
    - master
49
    - triggers
50
    - fix-makefiles
51

52
push-github:
53 54
  stage: deploy
  script:
55
    - make -e push-github
56 57
  only:
    - master
58
    - triggers
59
    - fix-makefiles
60

61 62 63 64
deploy_pypi:
  stage: deploy
  script:   # Configure the PyPI credentials, then push the package, and cleanup the creds.
    - echo "[server-login]" >> ~/.pypirc
65
    - echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc
66
    - echo "username=" ${PYPI_USER} >> ~/.pypirc
67 68 69 70
    - echo "password=" ${PYPI_PASSWORD} >> ~/.pypirc
    - make pip_upload
    - echo "" > ~/.pypirc && rm ~/.pypirc  # If the above fails, this won't run.
  only:
71
    - /^v?\d+\.\d+\.\d+([abc]\d*)?$/  # PEP-440 compliant version (tags)
72 73 74 75
  except:
    - branches

deploy:
76
  stage: deploy
77
  environment: test
78
  script:
79
    - make -e deploy
80 81
  only:
    - master
82
    - fix-makefiles
83

84 85 86 87 88 89 90 91
push-github:
  stage: deploy
  script:
    - make -e push-github
  only:
    - master
    - triggers

92 93 94
clean :
  stage: clean
  script:
95
    - make -e clean
96 97
  when: manual

98
cleanup_py:
99 100 101 102
   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
103
    - docker logout