.gitlab-ci.yml 2.5 KB
Newer Older
inso's avatar
inso committed
1
stages:
2
  - format
3
  - tests
4
  - build
inso's avatar
inso committed
5 6 7 8 9
  - release

variables:
    PYENV_PYTHON_VERSION: 3.5.5

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

12
# SUB-TASKS
13
.push_to_github:
inso's avatar
inso committed
14 15
  tags:
    - github
16 17
  after_script:
    # remove all files in current repo
inso's avatar
inso committed
18
    - rm -rf ./*
19 20
    - rm -rf .git*
    # do a mirror clone in current repo
inso's avatar
inso committed
21
    - git clone --mirror $CI_REPOSITORY_URL .
22
    # do config for github push
inso's avatar
inso committed
23 24 25
    - git remote add github $GITHUB_URL_AND_KEY
    - git config --global user.email "contact@duniter.org"
    - git config --global user.name "Duniter"
26 27
    # remove refs about merge requests
    - bash -c "cat packed-refs | grep -v 'refs/merge-requests' > packed-refs-new; echo 'Removed merge-requests refs.'"
inso's avatar
inso committed
28
    - mv packed-refs-new packed-refs
29
    # github push
inso's avatar
inso committed
30 31
    - bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?"

32
.env:
inso's avatar
inso committed
33 34 35 36 37
  before_script:
    - export PYENV_ROOT="$HOME/.pyenv"
    - export PATH="$PYENV_ROOT/bin:$PATH"
    - eval "$(pyenv init -)"
    - pyenv shell $PYENV_PYTHON_VERSION
inso's avatar
inso committed
38 39
    - export PATH=/opt/qt/5.9/5.9.4/gcc_64/bin:$PATH
    - export DISPLAY=:99
inso's avatar
inso committed
40

41 42 43
.changes:
  only:
    changes:
44
      - src/sakia/*
45 46 47
      - .gitlab-ci.yml
      - Makefile
      - requirements_dev.txt
48
      - requirements_deploy.txt
49 50 51
      - requirements.txt
      - setup.py
      - tests/**/*.py
inso's avatar
inso committed
52

53
# TASKS
54 55 56 57 58 59 60 61 62 63
format:
  extends:
    - .env
    - .changes
  stage: format
  script:
    - pyenv shell 3.6.4  # black install and run needs python 3.6.x minimum
    - pip install -r requirements_dev.txt
    - make check-format

64 65 66 67 68 69 70 71 72 73 74
tests:
  extends:
    - .env
    - .changes
  stage: tests
  script:
    - pyenv shell 3.6.4  # black install needs python 3.6.x minimum
    - pip install -r requirements.txt
    - pip install -r requirements_dev.txt
    - make tests

75 76 77 78 79
build:
  extends:
    - .env
    - .changes
  stage: build
inso's avatar
inso committed
80 81
  script:
    - pip install -r requirements.txt
82 83
    - pip install -r requirements_deploy.txt
    - make build
inso's avatar
inso committed
84

85 86 87 88
release:
  extends:
    - .env
    - .push_to_github
inso's avatar
inso committed
89 90 91 92
  stage: release
  when: manual
  script:
    - pip install -r requirements.txt
93 94 95 96 97 98 99 100 101 102
    - pip install -r requirements_deploy.txt
    - make build
    - make deploy PYPI_LOGIN=${PYPI_LOGIN} PYPI_PASSWORD=${PYPI_PASSWORD}
  only:
    - master

release_test:
  extends: .env
  stage: release
  when: manual
103
  only: [tags, dev]
104 105 106 107 108
  script:
    - pip install -r requirements.txt
    - pip install -r requirements_deploy.txt
    - make build
    - make deploy_test PYPI_TEST_LOGIN=${PYPI_TEST_LOGIN} PYPI_TEST_PASSWORD=${PYPI_TEST_PASSWORD}