diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4ec2c96cd..b2c115b82 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,23 +14,34 @@ include: - templates/global/full.yaml - templates/python/full.yaml -variables: - BASE_CONTAINER_VERSION: "1.4.0" - PRE_COMMIT_DOCKER_IMAGE: docker.osdc.io/ncigdc/python3.7-builder:2.2.0 - DOCKER_BUILDKIT: 1 - PIP_EXTRA_INDEX_URL: https://nexus.osdc.io/repository/pypi-all/simple - DOCKER_BUILD_OPTS: "--build-arg PIP_EXTRA_INDEX_URL=https://nexus.osdc.io/repository/pypi-all/simple" - DOCKER_PUSH_OPTS: "--all-tags" - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-snapshots/" +tox: + stage: test + image: ${BASE_CONTAINER_REGISTRY}/python${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION} + parallel: + matrix: + - REPO_PY_VERSION: ["3.7", "3.8", "3.9"] + script: + - pip install tox + - tox -e ${REPO_PY_VERSION} + +tox legacy: + stage: test + image: ${BASE_CONTAINER_REGISTRY}/python36-builder:${LEGACY_BASE_CONTAINER_VERSION} + script: + - pip install tox + - tox -e py36 +# These rules determine when the plaster steps execute. .override_gdcdictionary_version: rules: - if: $GDCDICTIONARY_TARGET_VERSION_OVERRIDE != null variables: GDCDICTIONARY_TARGET_VERSION: $GDCDICTIONARY_TARGET_VERSION_OVERRIDE - - when: always + - if: $CI_COMMIT_TAG != null variables: - GDCDICTIONARY_TARGET_VERSION: $CI_COMMIT_REF_NAME + GDCDICTIONARY_TARGET_VERSION: $CI_COMMIT_TAG + - if: $CI_COMMIT_REF_NAME =~ /^(master|main|release)/ + when: never update_reqs_for_gdcdatamodel2: image: docker.osdc.io/ncigdc/python36-builder:1.4.0 @@ -54,8 +65,6 @@ update_reqs_for_gdcdatamodel2: rules: - !reference [.override_gdcdictionary_version, rules] - - execute_plaster: image: docker.osdc.io/ncigdc/python3.8-builder:2.1.0 stage: build @@ -79,6 +88,35 @@ execute_plaster: rules: - !reference [.override_gdcdictionary_version, rules] +release_datamodels_to_nexus: + image: docker.osdc.io/ncigdc/python36-builder:1.4.0 + stage: release_gdcdatamodel2 + script: + - cd gdcdatamodel2 + - ls -R . + - cat setup.cfg + - cat dev-requirements.txt + - whoami + - apt-get update + - apt-get install -y python3-venv + - pip3 install -U setuptools_scm build twine setuptools + - python3 -m setuptools_scm + - python3 -m build + - twine check dist/* + - twine upload dist/* + variables: + TWINE_USERNAME: ${TWINE_USER} + TWINE_PASSWORD: ${TWINE_PASSWORD} + artifacts: + paths: + - dist/*.whl + reports: + dotenv: vars.env + rules: + - !reference [.override_gdcdictionary_version, rules] + dependencies: + - update_reqs_for_gdcdatamodel2 + - execute_plaster push_datamodels_to_github: image: docker.osdc.io/ncigdc/python36-builder:1.4.0 @@ -95,4 +133,6 @@ push_datamodels_to_github: allow_failure: true # failure when no changes of models rules: - !reference [.override_gdcdictionary_version, rules] - needs: ['update_reqs_for_gdcdatamodel2', 'execute_plaster'] + dependencies: + - update_reqs_for_gdcdatamodel2 + - execute_plaster