.gitlab-ci.yml 2.07 KB
Newer Older
1
2
3
default:
  image: python:3.7-slim-buster

Luc Yriarte's avatar
Luc Yriarte committed
4
5
6
7
8

include:
  - project: "osdu/platform/domain-data-mgmt-services/wellbore/lib/lib-registry"
    file: "registry-setup.yml"

9
10
11
12
13
14
15
16
17
stages:
  - test
  - deploy

build:
  stage: test
  script:
    - echo ---- ---- ---- BUILD IMAGE ---- ---- ----
    - pip3 install -r requirements.txt
18
    - pip3 install -r requirements_opengroup.txt
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    - pip3 install -r requirements_dev.txt
    - echo ---- ---- ---- UNIT TESTS ---- ---- ----
    - pytest tests --junitxml=report.xml
  artifacts:
    when: always
    reports:
      junit: report.xml

# This job only runs on master, and it creates the lib and push it to the feed
deploylib:
  stage: deploy
  script:
    - echo ---- ---- ---- BUILD IMAGE ---- ---- ----
    - pip3 install -r requirements.txt
33
    - pip3 install -r requirements_opengroup.txt
34
35
    - pip3 install twine
    - python3 setup.py sdist bdist_wheel
Luc Yriarte's avatar
Luc Yriarte committed
36
    - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=${CI_REGISTRY_USER} python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${WDMS_LIB_REGISTRY}/packages/pypi dist/*
37
38
  rules:
    - if: $CI_COMMIT_BRANCH == 'master'
Luc Yriarte's avatar
Luc Yriarte committed
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

# Pushes merge request builds to the feed
deploydev:
  stage: deploy
  script:
    - echo ---- ---- ---- SET DEVELOPMENT VERSION ---- ---- ----
    - PACKAGE_VERSION_FILE='osdu_az/__init__.py'
    - PACKAGE_NAME=$(python setup.py --name)
    - PACKAGE_LIB_VERSION=$(python setup.py --version)
    - PACKAGE_DEV_VERSION=${PACKAGE_LIB_VERSION}.dev${CI_JOB_ID}
    - sed -i "s/${PACKAGE_LIB_VERSION}/${PACKAGE_DEV_VERSION}/g" ${PACKAGE_VERSION_FILE}
    - echo ---- ---- ---- BUILD IMAGE ---- ---- ----
    - pip3 install -r requirements.txt
    - pip3 install -r requirements_opengroup.txt
    - pip3 install twine
    - python3 setup.py sdist bdist_wheel
    - echo ---- ---- ---- PUSHING DEVELOPMENT PACKAGE ${PACKAGE_DEV_VERSION} TO PROJECT ${WDMS_LIB_REGISTRY} REGISTRY ---- ---- ----
    - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=${CI_REGISTRY_USER} python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${WDMS_LIB_REGISTRY}/packages/pypi dist/*
  only:
    - merge_requests