.gitlab-ci.yml 1.69 KB
Newer Older
inso's avatar
inso committed
1 2
stages:
  - github-sync
inso's avatar
inso committed
3
  - build_and_test
inso's avatar
inso committed
4 5 6 7 8
  - release

variables:
    PYENV_PYTHON_VERSION: 3.5.5

inso's avatar
inso committed
9
image: registry.duniter.org/docker/python3/duniterpy-builder:0.0.7
inso's avatar
inso committed
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

push_to_github:
  stage: github-sync
  variables:
    GIT_STRATEGY: none
  tags:
    - github
  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
    - bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?"

inso's avatar
inso committed
29
.env: &env
inso's avatar
inso committed
30 31 32 33 34 35 36
  tags:
    - redshift-docker-python
  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
37 38
    - export PATH=/opt/qt/5.9/5.9.4/gcc_64/bin:$PATH
    - export DISPLAY=:99
inso's avatar
inso committed
39 40


inso's avatar
inso committed
41 42 43
build_and_test: &build_and_test
  <<: *env
  stage: build_and_test
inso's avatar
inso committed
44
  script:
inso's avatar
inso committed
45 46
    - pip install wheel
    - pip install pytest-cov
inso's avatar
inso committed
47 48 49
    - pip install -r requirements.txt
    - python gen_resources.py
    - python gen_translations.py --lrelease
inso's avatar
inso committed
50
    - python setup.py bdist_wheel
inso's avatar
inso committed
51 52 53
    - py.test --cov=sakia tests/

releases:
inso's avatar
inso committed
54
  <<: *env
inso's avatar
inso committed
55 56 57 58 59 60
  stage: release
  when: manual
  script:
    - pip install -r requirements.txt
    - pip install wheel
    - pip install twine
inso's avatar
inso committed
61 62
    - python gen_resources.py
    - python gen_translations.py --lrelease
inso's avatar
inso committed
63
    - python setup.py bdist_wheel
inso's avatar
inso committed
64
    - twine upload dist/* --username duniter --password $PYPI_PASSWORD