Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.17 KiB
Newer Older
Erwan Rouchet's avatar
Erwan Rouchet committed
image: python:3.6
Erwan Rouchet's avatar
Erwan Rouchet committed
stages:
  - test
Erwan Rouchet's avatar
Erwan Rouchet committed
  - test-deploy
Erwan Rouchet's avatar
Erwan Rouchet committed

.test-job:
Erwan Rouchet's avatar
Erwan Rouchet committed
  stage: test

  before_script:
    - pip install tox

client-tests:
  extends: .test-job
  script: tox

client-tests-fork:
  extends: .test-job
Erwan Rouchet's avatar
Erwan Rouchet committed
  script:
    - pip install -U git+https://gitlab.com/teklia/apistar.git
    - tox

client-lint:
  image: python:3

  before_script:
    - pip install pre-commit

  script:
    - pre-commit run -a
Erwan Rouchet's avatar
Erwan Rouchet committed
client-deploy-testpypi:
  stage: test-deploy
Erwan Rouchet's avatar
Erwan Rouchet committed
    - tags@arkindex/api-client
Erwan Rouchet's avatar
Erwan Rouchet committed
    name: testpypi
    url: https://test.pypi.org/project/arkindex-client

  before_script:
    - pip install twine setuptools wheel
    - echo "[distutils]" > ~/.pypirc
    - echo "index-servers =" >> ~/.pypirc
Erwan Rouchet's avatar
Erwan Rouchet committed
    - echo "  testpypi" >> ~/.pypirc
    - echo "[testpypi]" >> ~/.pypirc
    - echo "repository=https://test.pypi.org/legacy/" >> ~/.pypirc
    - echo "username=$PYPI_DEPLOY_USERNAME" >> ~/.pypirc
    - echo "password=$PYPI_DEPLOY_PASSWORD" >> ~/.pypirc
  script:
    - python setup.py sdist bdist_wheel
Erwan Rouchet's avatar
Erwan Rouchet committed
    - twine upload dist/* -r testpypi
Erwan Rouchet's avatar
Erwan Rouchet committed
client-deploy-pypi:
  stage: deploy
  when: manual
  only:
Erwan Rouchet's avatar
Erwan Rouchet committed
    - tags@arkindex/api-client
Erwan Rouchet's avatar
Erwan Rouchet committed
    name: pypi
    url: https://pypi.org/project/arkindex-client

  before_script:
    - pip install twine setuptools wheel
    - echo "[distutils]" > ~/.pypirc
    - echo "index-servers =" >> ~/.pypirc
Erwan Rouchet's avatar
Erwan Rouchet committed
    - echo "  pypi" >> ~/.pypirc
    - echo "[pypi]" >> ~/.pypirc
    - echo "repository=https://upload.pypi.org/legacy/" >> ~/.pypirc
    - echo "username=$PYPI_DEPLOY_USERNAME" >> ~/.pypirc
    - echo "password=$PYPI_DEPLOY_PASSWORD" >> ~/.pypirc
  script:
    - python setup.py sdist bdist_wheel
Erwan Rouchet's avatar
Erwan Rouchet committed
    - twine upload dist/* -r pypi

pages:
  stage: deploy
  only:
    - tags@arkindex/api-client

  # Nothing to do!
  script: /bin/true

  artifacts:
    paths:
      - public

release-notes:
  stage: release
  image: registry.gitlab.com/teklia/devops:latest

  only:
    - tags

  script:
    - devops release-notes

bump-python-deps:
  stage: release
  image: registry.gitlab.com/teklia/devops:latest

  only:
    - schedules

  script:
    - devops python-deps requirements.txt