Skip to content

Commit e5d5b86

Browse files
RFC: fix CI, add PyPI publish action, poetry 1.6.1 (#9)
* pypi publish action * add testpypi * Update .github/workflows/publish.yml Co-authored-by: martín <MartinCura@users.noreply.github.com> * chore(lockfile): lock with poetry 1.6.1 * ci(publish): complete test publish * ci(publish): more specific python version * ci(publish): complete publishing jobs ...maybe missing API token for prod publish if not doing Trusted Publishing * ci(publish): typo * chore: use poetry 1.6.1 * chore: bump & changelog * ci: small fixes * docs(CHANGELOG): nit * rollback version bump * bump: 1.4.24 * ci(validate): fix check_version * ci: rename job per ✨ feedback ✨ * ci: has no pipx * ci(validate): fix check_version * ci(validate): fix check_version --------- Co-authored-by: martín <MartinCura@users.noreply.github.com> Co-authored-by: ten <martin.cura@muttdata.ai>
1 parent 753f2a1 commit e5d5b86

11 files changed

Lines changed: 146 additions & 238 deletions

File tree

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.4.23
2+
current_version = 1.4.24
33
commit = False
44
tag = False
55

.github/workflows/publish.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: publish
2+
on: push
3+
4+
env:
5+
PYTHON_VERSION: 3.10.10
6+
POETRY_VERSION: 1.6.1
7+
8+
jobs:
9+
pypi-publish:
10+
name: Publish Python 🐍 distribution 📦 to PyPI
11+
if: ${{ startsWith(github.ref, 'refs/tags') }}
12+
runs-on: ubuntu-latest
13+
environment:
14+
name: pypi
15+
url: https://pypi.org/p/muttlib
16+
permissions:
17+
id-token: write # Mandatory for trusted publishing
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ env.PYTHON_VERSION }}
25+
- name: Install Poetry
26+
run: pipx install poetry==${{ env.POETRY_VERSION }}
27+
28+
- name: Install dependencies
29+
run: poetry install
30+
- name: Build package
31+
run: poetry build
32+
33+
- name: Publish package distributions to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
36+
testpypi-publish:
37+
name: Test publish Python 🐍 distribution 📦 to TestPyPI
38+
if: ${{ ! startsWith(github.ref, 'refs/tags') }}
39+
runs-on: ubuntu-latest
40+
environment:
41+
name: testpypi
42+
url: https://test.pypi.org/p/muttlib
43+
permissions:
44+
id-token: write # Mandatory for trusted publishing
45+
steps:
46+
- uses: actions/checkout@v3
47+
48+
- name: Set up Python
49+
uses: actions/setup-python@v4
50+
with:
51+
python-version: ${{ env.PYTHON_VERSION }}
52+
- name: Install Poetry
53+
run: pipx install poetry==${{ env.POETRY_VERSION }}
54+
55+
- name: Install dependencies
56+
run: poetry install
57+
- name: Build package
58+
run: poetry build
59+
60+
- name: Publish distribution 📦 to TestPyPI
61+
uses: pypa/gh-action-pypi-publish@release/v1
62+
with:
63+
skip-existing: true
64+
repository-url: https://test.pypi.org/legacy/

.github/workflows/test.yml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: test
22
on: [push]
33

44
env:
5+
POETRY_VERSION: 1.6.1
56
MIN_LINE_RATE: 0.2
67

78
jobs:
@@ -14,8 +15,8 @@ jobs:
1415
run: |
1516
apt update
1617
apt install -qy libkrb5-dev libsasl2-dev
17-
pip install poetry==1.3.2
18-
- uses: actions/checkout@v2
18+
pip install poetry==$POETRY_VERSION
19+
- uses: actions/checkout@v3
1920
- name: Install packages and extras
2021
run: poetry install --extras "forecast gsheets gdrive" --with dev
2122
- name: Test base imports
@@ -29,7 +30,7 @@ jobs:
2930
- name: Test gdrive
3031
run: |
3132
poetry run python -c 'from muttlib import gdrive'
32-
- name: Run nox
33+
- name: Run tests with nox
3334
run: |
3435
poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions tests
3536
@@ -42,11 +43,11 @@ jobs:
4243
run: |
4344
apt update
4445
apt install -y libkrb5-dev libsasl2-dev
45-
pip install poetry==1.3.2
46-
- uses: actions/checkout@v2
46+
pip install poetry==$POETRY_VERSION
47+
- uses: actions/checkout@v3
4748
- name: Install package
4849
run: poetry install -vvv --with dev -E "gdrive gsheets forecast"
49-
- name: Run nox
50+
- name: Run pre-commit hooks with nox
5051
run: poetry run nox --envdir $GITHUB_WORKSPACE/.nox --sessions precommit_hooks
5152

5253
docstr-cov:
@@ -58,8 +59,8 @@ jobs:
5859
run: |
5960
apt update
6061
apt install -y libkrb5-dev libsasl2-dev
61-
pip install poetry==1.3.2
62-
- uses: actions/checkout@v2
62+
pip install poetry==$POETRY_VERSION
63+
- uses: actions/checkout@v3
6364
- name: Install package
6465
run: poetry install -vvv --with dev
6566
- name: Run interrogate
@@ -74,8 +75,8 @@ jobs:
7475
run: |
7576
apt update
7677
apt install -y libkrb5-dev libsasl2-dev
77-
pip install poetry==1.3.2
78-
- uses: actions/checkout@v2
78+
pip install poetry==$POETRY_VERSION
79+
- uses: actions/checkout@v3
7980
- name: Install package
8081
run: poetry install -vvv --with dev
8182
- name: Run nox
@@ -90,8 +91,8 @@ jobs:
9091
run: |
9192
apt update
9293
apt install -y libkrb5-dev libsasl2-dev
93-
pip install poetry==1.3.2
94-
- uses: actions/checkout@v2
94+
pip install poetry==$POETRY_VERSION
95+
- uses: actions/checkout@v3
9596
- name: Install package
9697
run: poetry install -vvv --with dev
9798
- name: Run mypy and check lines

.github/workflows/validate.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: validate
22
on: [pull_request]
33

4+
env:
5+
POETRY_VERSION: 1.6.1
6+
47
jobs:
58
check_version:
69
if: github.base_ref == 'master'
@@ -12,8 +15,8 @@ jobs:
1215
run: |
1316
apt update
1417
apt install -y libkrb5-dev libsasl2-dev
15-
pip install poetry==1.3.2
16-
- uses: actions/checkout@v2
18+
pip install poetry==$POETRY_VERSION
19+
- uses: actions/checkout@v3
1720
- name: Install dependencies
1821
run: pip install packaging
1922
- name: Fetch source ref
@@ -23,8 +26,10 @@ jobs:
2326
- name: Check version
2427
run: |
2528
lib_ver=$(git diff origin/$GITHUB_HEAD_REF origin/$GITHUB_BASE_REF -- .bumpversion.cfg | grep "current_version" | cut -d = -f 2 | xargs)
26-
echo "lib_ver=$lib_ver"
27-
python -c "import sys; from packaging import version; exit(not version.parse(sys.argv[1]) > version.parse(sys.argv[2]))" $lib_ver
29+
ver_new=$(echo $lib_ver | cut -f1 -d' ')
30+
ver_old=$(echo $lib_ver | cut -f2 -d' ')
31+
echo "new version: $ver_new (vs) old version: $ver_old"
32+
python -c "import sys; from packaging import version; exit(not version.parse(sys.argv[1]) > version.parse(sys.argv[2]))" $ver_new $ver_old
2833
exit_status=$?
2934
if [ $exit_status -eq 1 ]; then echo "Error comparing versions"; fi;
3035
exit $exit_status
@@ -39,13 +44,13 @@ jobs:
3944
run: |
4045
apt update
4146
apt install -y libkrb5-dev libsasl2-dev
42-
pip install poetry==1.3.2
43-
- uses: actions/checkout@v2
47+
pip install poetry==$POETRY_VERSION
48+
- uses: actions/checkout@v3
4449
- name: Fetch source ref
4550
run: git fetch origin $GITHUB_HEAD_REF
4651
- name: Fetch target ref
4752
run: git fetch origin $GITHUB_BASE_REF
4853
- name: Check changed lines
4954
run: |
5055
added_lines=$(git diff --numstat origin/$GITHUB_BASE_REF origin/$GITHUB_HEAD_REF -- CHANGELOG.md | awk '{print $1}')
51-
if [ -z $added_lines ] || [ $added_lines -eq 0 ]; then echo "Changelog has not been modified" && exit 1; else echo "Changelog has been modified" && exit 0; fi;
56+
if [ -z $added_lines ] || [ $added_lines -eq 0 ]; then echo "Changelog has NOT been modified" && exit 1; else echo "Changelog has been modified" && exit 0; fi;

.github/workflows/version.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ on:
55
- closed
66
branches: [master]
77

8+
env:
9+
POETRY_VERSION: 1.6.1
10+
811
jobs:
9-
bump_version:
12+
create_github_release:
1013
if: github.event.pull_request.merged == true
1114
runs-on: [self-hosted]
1215
container:
@@ -16,8 +19,8 @@ jobs:
1619
run: |
1720
apt update
1821
apt install -y libkrb5-dev libsasl2-dev
19-
pip install poetry==1.3.2
20-
- uses: actions/checkout@v2
22+
pip install poetry==$POETRY_VERSION
23+
- uses: actions/checkout@v3
2124
- name: Set tag output
2225
id: set-tag
2326
run: echo "::set-output name=tag_name::v$(grep current_version .bumpversion.cfg | cut -d= -f2 | xargs)"

.gitlab/issue_templates/.TODO_migrate_to_github

Whitespace-only changes.

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,17 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [1.4.23] - 2023-06-09
8+
## [1.4.24] - 2023-10-19
9+
10+
### CI
11+
12+
- Automatic publishing to PyPI through GitHub Actions when a tag is pushed.
13+
14+
### Chore
15+
16+
- Use poetry 1.6.1.
17+
18+
## [1.4.23] - 2023-10-10
919

1020
### Added
1121

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ On Fedora/CentOS:
7676

7777
#### Poetry
7878

79-
`muttlib` is packaged and developed using [poetry](https://python-poetry.org). Follow [these steps](https://python-poetry.org/docs/#installation) to install it and get familiar with the [quickstart](https://python-poetry.org/docs/basic-usage/). Make sure to install version `1.3.2` or higher.
79+
`muttlib` is packaged and developed using [poetry](https://python-poetry.org). Follow [these steps](https://python-poetry.org/docs/#installation) to install it and get familiar with the [quickstart](https://python-poetry.org/docs/basic-usage/). Make sure to install the version currently specified at the start of the lockfile (e.g. `1.6.1`).
8080

8181
### Installation
8282

@@ -188,7 +188,7 @@ Alternatively you can see the docs for the `master` branch [here.](https://mutt_
188188

189189
## Versioning
190190

191-
`muttlib` uses [SemVer](https://semver.org). To keep things easy, we've included [bump2version](https://github.com/c4urself/bump2version/) as a dev dependency. You can use `poetry run bump2version minor` to increase the minor number.
191+
`muttlib` uses [SemVer](https://semver.org). To keep things easy, we've included [bump2version](https://github.com/c4urself/bump2version/) as a dev dependency. For example, you can use `poetry run bump2version minor` to increase the minor number.
192192

193193
Please remember to bump the version when submitting your PR!
194194

README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# muttlib 🐶📚
22

3-
[![pypi version](https://img.shields.io/pypi/v/muttlib?color=blue)](https://pypi.org/project/muttlib/)[![pipeline status](https://gitlab.com/mutt_data/muttlib/badges/master/pipeline.svg)](https://gitlab.com/mutt_data/muttlib/-/commits/master)[![coverage report](https://gitlab.com/mutt_data/muttlib/badges/master/coverage.svg)](https://gitlab.com/mutt_data/muttlib/-/commits/master)[![docstring report](https://gitlab.com/mutt_data/muttlib/-/jobs/artifacts/master/raw/docs_coverage.svg?job=docstr-cov)](https://interrogate.readthedocs.io/en/latest/)[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
4-
3+
[![pypi version](https://img.shields.io/pypi/v/muttlib?color=blue)](https://pypi.org/project/muttlib/)
4+
[![pipeline status](https://gitlab.com/mutt_data/muttlib/badges/master/pipeline.svg)](https://gitlab.com/mutt_data/muttlib/-/commits/master)
5+
[![coverage report](https://gitlab.com/mutt_data/muttlib/badges/master/coverage.svg)](https://gitlab.com/mutt_data/muttlib/-/commits/master)
6+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
7+
[![Imports: isort](https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336)](https://pycqa.github.io/isort/)
8+
<!-- TODO: fix for github -->
9+
<!-- [![docstring report](https://gitlab.com/mutt_data/muttlib/-/jobs/artifacts/master/raw/docs_coverage.svg?job=docstr-cov)](https://interrogate.readthedocs.io/en/latest/) -->
510

611
## Description
712

@@ -30,28 +35,32 @@ Current modules:
3035
- [Contributing](#contributing)
3136
- [License](#license)
3237

33-
### Installing from PyPi
38+
### Installing from PyPI
3439

35-
_Note:_ `muttlib` is packaged and developed using [poetry](https://python-poetry.org) v1.3.2.
40+
_Note:_ `muttlib` is packaged and developed using [poetry](https://python-poetry.org).
3641

3742
Base lib:
43+
3844
```bash
3945
poetry add muttlib
4046
```
4147

4248
Check below for available extras.
4349

4450
Parquet and Feather support:
51+
4552
```bash
4653
poetry add muttlib -E pyarrow
4754
```
4855

4956
Forecast:
57+
5058
```bash
5159
poetry add muttlib -E forecast
5260
```
5361

5462
Misc DB support for dbconn:
63+
5564
```bash
5665
poetry add muttlib -E oracle
5766
poetry add muttlib -E hive
@@ -67,11 +76,13 @@ _Note:_ the `ibis` extra requires installing binary packages. Check [CONTRIBUTIN
6776
### Installing custom branches from the repos
6877

6978
From GitHub mirror:
79+
7080
```bash
7181
poetry add -e git+https://github.com/MuttData/muttlib.git@AWESOME_FEATURE_BRANCH#egg=muttlib
7282
```
7383

7484
From Gitlab main repo:
85+
7586
```bash
7687
poetry add -e git+https://gitlab.com/mutt_data/muttlib.git@AWESOME_FEATURE_BRANCH#egg=muttlib
7788
```
@@ -85,4 +96,5 @@ See the [documentation](https://mutt_data.gitlab.io/muttlib/) to get started wit
8596
We appreciate for considering to help out maintaining this project. If you'd like to contribute please read our [contributing guidelines](https://mutt_data.gitlab.io/muttlib/contributing.html).
8697

8798
## License
99+
88100
`muttlib` is licensed under the [Apache License 2.0](https://github.com/MuttData/muttlib/blob/master/LICENCE).

0 commit comments

Comments
 (0)