.gitlab-ci.yml 1.93 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
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
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
49
    - triggers
50
    - fix-makefiles
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
51

52
push-github:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
53 54
  stage: deploy
  script:
55
    - make -e push-github
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
56 57
  only:
    - master
58
    - triggers
59
    - fix-makefiles
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
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:
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
76
  stage: deploy
77
  environment: test
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
78
  script:
79
    - make -e deploy
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
80 81
  only:
    - master
82
    - fix-makefiles
J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
83

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

J. Fernando Sánchez's avatar
J. Fernando Sánchez committed
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