.gitlab-ci.yml 2.28 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
    - pip3 install -r requirements_dev.txt
    - echo ---- ---- ---- UNIT TESTS ---- ---- ----
21
22
23
24
25
26
    - echo ---- ---- AZURITE SETUP
    - apt install nodejs npm
    - npm install azurite
    - mkdir azurite
    - azurite --silent --location azurite --debug azurite\debug.log &
    - sleep 1
Luc Yriarte's avatar
Luc Yriarte committed
27
    - echo ---- DISABLED ---- pytest tests --junitxml=report.xml
28
29
30
31
32
33
34
35
36
37
38
  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
39
    - pip3 install -r requirements_opengroup.txt
40
41
    - pip3 install twine
    - python3 setup.py sdist bdist_wheel
Luc Yriarte's avatar
Luc Yriarte committed
42
    - 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/*
43
44
  rules:
    - if: $CI_COMMIT_BRANCH == 'master'
Luc Yriarte's avatar
Luc Yriarte committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65

# 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