Skip to content
Snippets Groups Projects
Commit a332e8d1 authored by Lene Wasskog's avatar Lene Wasskog
Browse files

chore: Running deploy stage only for main branch, update doc

parent fb47830d
No related branches found
No related tags found
1 merge request!1Feature/mad 91 gitlab pipeline
Pipeline #699 passed
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
...@@ -36,7 +36,7 @@ test: ...@@ -36,7 +36,7 @@ test:
deploy: deploy:
stage: deploy stage: deploy
only: only:
- feature/mad-91-gitlab-pipeline - main
tags: tags:
- vips-runner - vips-runner
script: script:
......
...@@ -46,14 +46,17 @@ bumpver update --major ...@@ -46,14 +46,17 @@ bumpver update --major
### References ### References
We used this excellent guide for packaging: https://realpython.com/pypi-publish-python-package/ We used this excellent guide for packaging: https://realpython.com/pypi-publish-python-package/
### Manual deployment ### Deployment
Temporary notes of steps required for building and uploading package Whenever changes are pushed to the repository, the pipeline defined in `.gitlab-ci.yml` is triggered. Here, there are three jobs: build, test and deploy.
The final job will only be performed for the `main` branch. Please note that publishing a package to the package repository will fail (= red deploy job)
if the version of the package has not been bumped since the previous deploy.
Create [Personal access token](https://gitlab.nibio.no/-/profile/personal_access_tokens) with name=`gitlab-pypi` and scope=`Api`. Follow these steps for running build, test + deploy on your laptop:
Create file `~/.pypirc` with the following content: 1. Create [Personal access token](https://gitlab.nibio.no/-/profile/personal_access_tokens) with name=`gitlab-pypi` and scope=`Api`.
2. Create file `~/.pypirc` with the following content:
``` ```
[distutils] [distutils]
index-servers = index-servers =
...@@ -65,24 +68,21 @@ username = gitlab-pypi ...@@ -65,24 +68,21 @@ username = gitlab-pypi
password = <personal access token> password = <personal access token>
``` ```
Clone project, build and deploy package 3. Clone project, build, test and deploy package
``` ```
$ git clone git@gitlab.nibio.no:VIPS/vipscore-python-common.git $ git clone git@gitlab.nibio.no:VIPS/vipscore-python-common.git
$ cd vipscore-python-common $ cd vipscore-python-common
$ python3 -m venv venv $ python3 -m venv venv
$ . venv/bin/activate $ . venv/bin/activate
$ pip install -e . $ pip install -e .
$ pip install build pytest twine
$ python3 -m build $ python3 -m build
-> Successfully built vipscore_common-0.1.6.tar.gz and vipscore_common-0.1.6-py3-none-any.whl -> Successfully built vipscore_common-0.1.6.tar.gz and vipscore_common-0.1.6-py3-none-any.whl
$ pytest
-> [100%] ======================= 2 passed in 0.27s ==========================
$ python3 -m twine upload --repository gitlab dist/* --verbose $ python3 -m twine upload --repository gitlab dist/* --verbose
-> Uploading vipscore_common-0.1.6-py3-none-any.whl -> Uploading vipscore_common-0.1.6-py3-none-any.whl
-> 201 Created -> 201 Created
-> Uploading vipscore_common-0.1.6.tar.gz -> Uploading vipscore_common-0.1.6.tar.gz
-> 201 Created -> 201 Created
``` ```
### Pipeline deployment
See pipeline configuration in `.gitlab-ci.yml`.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment