.gitlab-ci.yml 2.43 KB
Newer Older
Luc Yriarte's avatar
Luc Yriarte committed
1
default:
2
  image: python:3.8-slim-bullseye
Luc Yriarte's avatar
Luc Yriarte committed
3

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"

Luc Yriarte's avatar
Luc Yriarte committed
9
10
11
12
13
14
stages:
  - test
  - deploy

build:
  stage: test
15
16
17
  variables:
    TESTING_GCP_DATA_PROJECT_ID: nice-etching-277309
    TESTING_GCP_BUCKET: nice-etching-277309-wddsm-gcp-lib-tests
Luc Yriarte's avatar
Luc Yriarte committed
18
  script:
19
20
    - echo $OSDU_GCP_INTEGRATION_TESTER | base64 -d > file.json
    - export TESTING_GCP_DATA_PROJECT_CREDENTIALS=file.json
Luc Yriarte's avatar
Luc Yriarte committed
21
22
23
24
    - echo ---- ---- ---- BUILD IMAGE ---- ---- ----
    - pip3 install -r requirements.txt
    - pip3 install -r requirements_opengroup.txt
    - pip3 install -r requirements_dev.txt
Luc Yriarte's avatar
Luc Yriarte committed
25
    - echo ---- ---- ---- UNIT TESTS ---- ---- ----
26
    - pytest --junit-xml=unit_tests_report.xml --cov=osdu_gcp --cov-report=html --cov-report=xml ./tests
Luc Yriarte's avatar
Luc Yriarte committed
27
28
29
30
  artifacts:
    when: always
    reports:
      junit: report.xml
31
32
33
  only:
    - merge_requests
    - branches
Luc Yriarte's avatar
Luc Yriarte committed
34
35
36
37
38
39
40
41
42
43

# 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
    - pip3 install -r requirements_opengroup.txt
    - pip3 install twine
    - python3 setup.py sdist bdist_wheel
Luc Yriarte's avatar
Luc Yriarte committed
44
    - 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/*
Luc Yriarte's avatar
Luc Yriarte committed
45
46
  rules:
    - if: $CI_COMMIT_BRANCH == 'master'
Luc Yriarte's avatar
Luc Yriarte committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

# Pushes merge request builds to the feed
deploydev:
  stage: deploy
  script:
    - echo ---- ---- ---- SET DEVELOPMENT VERSION ---- ---- ----
    - PACKAGE_VERSION_FILE='osdu_gcp/__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