Skip to content
Snippets Groups Projects
Commit 28d90cca authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'add-package-stage' into 'master'

refactor: move package building to dedicated stage

See merge request to-be-continuous/python!20
parents 3f7db4ec 945fc8a8
No related branches found
No related tags found
No related merge requests found
...@@ -227,6 +227,18 @@ It is bound to the `test` stage, and uses the following variables: ...@@ -227,6 +227,18 @@ It is bound to the `test` stage, and uses the following variables:
This job outputs a **textual report** in the console, and in case of failure also exports a JSON report in the `reports/` This job outputs a **textual report** in the console, and in case of failure also exports a JSON report in the `reports/`
directory _(relative to project root dir)_. directory _(relative to project root dir)_.
### Package jobs
#### `py-package` job
This job is performs a packaging of your Python code.
It is bound to the `package-build` stage, applies only on git tags and uses the following variables:
| Name | description | default value |
| --------------- | ---------------------------------------------------- | ------------- |
| `PYTHON_FORCE_PACKAGE` | Force the packaging even if not on tag related event | _none_ |
### Publish jobs ### Publish jobs
#### `py-release` job #### `py-release` job
...@@ -251,7 +263,7 @@ It is bound to the `publish` stage, applies only on master branch and uses the f ...@@ -251,7 +263,7 @@ It is bound to the `publish` stage, applies only on master branch and uses the f
#### `py-publish` job #### `py-publish` job
This job is **disabled by default** and performs a packaging and publication of your Python code. This job is **disabled by default** and performs a publication of your Python code.
It is bound to the `publish` stage, applies only on git tags and uses the following variables: It is bound to the `publish` stage, applies only on git tags and uses the following variables:
......
...@@ -147,6 +147,18 @@ ...@@ -147,6 +147,18 @@
} }
] ]
}, },
{
"id": "package",
"name": "package",
"description": "Packaging of your Python code",
"variables": [
{
"name": "PYTHON_FORCE_PACKAGE",
"description": "Force the packaging even if not on tag related event",
"type": "boolean"
}
]
},
{ {
"id": "publish", "id": "publish",
"name": "Publish", "name": "Publish",
......
...@@ -337,6 +337,7 @@ variables: ...@@ -337,6 +337,7 @@ variables:
stages: stages:
- build - build
- test - test
- package-build
- publish - publish
############################################################################################### ###############################################################################################
...@@ -560,6 +561,25 @@ py-safety: ...@@ -560,6 +561,25 @@ py-safety:
allow_failure: true allow_failure: true
###############################################################################################
# pakage stage #
###############################################################################################
# (on tag creation): create packages as artifacts
py-package:
extends: .python-base
stage: package-build
script:
- python setup.py sdist bdist_wheel
artifacts:
paths:
- $PYTHON_PROJECT_DIR/dist/*.tar.gz
- $PYTHON_PROJECT_DIR/dist/*.whl
rules:
# on tags
- if: '$CI_COMMIT_TAG'
- if: '$PYTHON_FORCE_PACKAGE == "true"'
############################################################################################### ###############################################################################################
# publish stage # # publish stage #
############################################################################################### ###############################################################################################
...@@ -573,7 +593,6 @@ py-publish: ...@@ -573,7 +593,6 @@ py-publish:
- assert_defined "$TWINE_PASSWORD" 'Missing required env $TWINE_PASSWORD' - assert_defined "$TWINE_PASSWORD" 'Missing required env $TWINE_PASSWORD'
- pip install -U twine setuptools - pip install -U twine setuptools
- pip list - pip list
- python setup.py sdist bdist_wheel
- twine upload --verbose dist/*.tar.gz - twine upload --verbose dist/*.tar.gz
- twine upload --verbose dist/*.whl - twine upload --verbose dist/*.whl
rules: rules:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment