Fix pipeline (#10)
This MR fixed the pipeline so it can run on forgejo runner. Currently we have two pipelines set up: + One pipeline will run pytest to test the code and collect coverage data, this pipeline will run on all branches and PRs. + One pipeline will build the wheel file and publish it to the company's pypl repo, this pipeline will only run on the master branch and develop branch. This RP also made the following changes to make the pipeline working: + Remove `setup.py` and `requirements.txt`, now the project is fully embraced `pyproject.toml`, which according to ChatGPT, is the most modern way of managing a python project. + Move all test files to `tests` folder, so it won't be packed into the final wheel file and affect the coverage rate. + Change version to `X.Y.Z-dev`, before building the wheel file, the pipeline will automatically add a UTC timestamp after it, so it becomes `X.Y.Z-devYYYYMMDDHHmmSS`. This is added due to the limitation of the pypl repo, unlike maven snapshot versions, you can't push the same version twice with our pypl repository. Reviewed-on: #10 Reviewed-by: Stanislav Hejny <stanislav.hejny@cleverthis.com> Co-authored-by: Rui Hu <rui.hu@cleverthis.com> Co-committed-by: Rui Hu <rui.hu@cleverthis.com>
This commit was merged in pull request #10.
This commit is contained in:
@@ -15,42 +15,46 @@ for routing the traffic over the RabbitMQ to intended service and automated serv
|
||||
### Install dependencies
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
pip install -e .[dev]
|
||||
```
|
||||
|
||||
This will install dependencies for developing, but won't install this project as an library.
|
||||
|
||||
To build the wheel files:
|
||||
|
||||
```bash
|
||||
python -m build
|
||||
```
|
||||
|
||||
The wheel file should be located under `dist` folder.
|
||||
You can use `pip install /path/to/wheel.whl` to install this library.
|
||||
|
||||
### Use as a library
|
||||
|
||||
Use this URL to add this project as a dependency (NOTE - TODO: update instructions for ForgeJo repo after pulp repo is up & running for python artifacts)
|
||||
|
||||
|
||||
```
|
||||
git+https://git.cleverthis.com/cleverthis/clevermicro/amq-adapter-python.git@develop#egg=amq_adapter
|
||||
```
|
||||
|
||||
> Hint: use `git config --global credential.helper store` to enable Git credential manager
|
||||
> so you don't have to re-enter the gitlab credential everytime.
|
||||
|
||||
Then:
|
||||
The library has been published to pulp registry at `https://pkg.cleverthis.io/pypi/clevermicro/amq-adapter-python/`.
|
||||
Configure the dependency `amq_adapter` with the above registry using
|
||||
your build tools, then:
|
||||
|
||||
```python
|
||||
from amqp.service import amq_service
|
||||
|
||||
# start using the lib
|
||||
```
|
||||
|
||||
#### How to build distributable Wheel archive
|
||||
|
||||
install project requirements
|
||||
`pip install -r requirements.txt`
|
||||
|
||||
install distribution archive requirements
|
||||
`pip install setuptools wheel build`
|
||||
install project requirements and dev dependencies
|
||||
`pip install -e .[dev]`
|
||||
|
||||
update version in:
|
||||
`pyproject.toml`
|
||||
|
||||
> For dev versions, keep the `-dev` suffix. The pipeline will replace it with a unique timestamp,
|
||||
> act like maven SNAPSHOT versions.
|
||||
|
||||
build the distributable archive (will be located in `./dist` directory)
|
||||
`python -m build --wheel`
|
||||
|
||||
|
||||
# Integrating with actual CleverThis Service
|
||||
|
||||
The following steps are required to integrate with the CleverThis service. This example uses ClverSwarm as specific use case,
|
||||
|
||||
Reference in New Issue
Block a user