.gitlab-ci.yml 1.92 KB
Newer Older
inso's avatar
inso committed
1 2
stages:
  - github-sync
inso's avatar
inso committed
3 4 5
  - prepare
  - build
  - test
inso's avatar
inso committed
6
  - release
inso's avatar
inso committed
7 8 9

variables:
    PYENV_PYTHON_VERSION: 3.5.5
inso's avatar
inso committed
10

inso's avatar
inso committed
11 12
image: registry.duniter.org/docker/python3/duniterpy-builder:0.0.4

inso's avatar
inso committed
13 14 15 16 17
push_to_github:
  stage: github-sync
  variables:
    GIT_STRATEGY: none
  tags:
inso's avatar
inso committed
18
    - github
inso's avatar
inso committed
19 20 21 22 23 24 25 26 27 28
  script:
    - rm -rf ./*
    - rm -rf .git
    - git clone --mirror $CI_REPOSITORY_URL .
    - git remote add github $GITHUB_URL_AND_KEY
    - git config --global user.email "contact@duniter.org"
    - git config --global user.name "Duniter"
    # Job would fail if we don't remove refs about pull requests
    - bash -c "cat packed-refs | grep -v 'refs/pull' > packed-refs-new; echo 'Removed pull refs.'"
    - mv packed-refs-new packed-refs
inso's avatar
inso committed
29
    - bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?"
inso's avatar
inso committed
30 31 32

.pyenv: &pyenv
  tags:
inso's avatar
inso committed
33
    - redshift-docker-python
inso's avatar
inso committed
34 35 36 37
  before_script:
    - export PYENV_ROOT="$HOME/.pyenv"
    - export PATH="$PYENV_ROOT/bin:$PATH"
    - eval "$(pyenv init -)"
inso's avatar
inso committed
38
    - pyenv shell $PYENV_PYTHON_VERSION
inso's avatar
inso committed
39

40
.changes: &changes
41
  only:
42
    changes:
43 44 45 46 47 48
      - duniterpy/**/*.py
      - .gitlab-ci.yml
      - requirements_dev.txt
      - requirements.txt
      - setup.py
      - tests/**/*.py
49

inso's avatar
inso committed
50
build: &build
inso's avatar
inso committed
51
  <<: *pyenv
52
  <<: *changes
inso's avatar
inso committed
53 54 55
  stage: build
  script:
    - pip install -r requirements.txt
inso's avatar
inso committed
56 57
    - pip install wheel
    - python setup.py sdist bdist_wheel
inso's avatar
inso committed
58 59 60

test:
  <<: *pyenv
61
  <<: *changes
inso's avatar
inso committed
62 63
  stage: test
  script:
inso's avatar
inso committed
64 65
    - pip install coveralls
    - pip install -r requirements.txt
inso's avatar
inso committed
66
    - coverage run --source=duniterpy setup.py test
inso's avatar
inso committed
67

68 69
mypy:
  <<: *pyenv
70
  <<: *changes
Vincent Texier's avatar
Vincent Texier committed
71
  stage: test
72 73 74 75
  script:
    - pip install -r requirements_dev.txt
    - mypy duniterpy --ignore-missing-imports

inso's avatar
inso committed
76
releases:
inso's avatar
inso committed
77
  <<: *pyenv
inso's avatar
inso committed
78
  stage: release
inso's avatar
inso committed
79
  when: manual
inso's avatar
inso committed
80 81 82 83 84 85
  script:
    - pip install -r requirements.txt
    - pip install wheel
    - pip install twine
    - python setup.py sdist bdist_wheel
    - twine upload dist/* --username duniter --password $PYPI_PASSWORD
inso's avatar
inso committed
86