Skip to content

Commit cb9533a

Browse files
ci (#4)
ci
1 parent 0dc65a0 commit cb9533a

6 files changed

Lines changed: 126 additions & 125 deletions

File tree

.github/actions/generate/action.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,35 @@ runs:
2626
using: "composite"
2727
steps:
2828
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0 # Fetch the entire history to avoid shallow repository issues
2931

3032
- name: Download ETP file
3133
run : wget http://geosiris.com/wp-content/uploads/2022/09/etp/${{ inputs.etp-file-name }} -P ${{ github.workspace }}
3234
shell: bash
3335

34-
- name: Install dependencies
35-
uses: ./.github/actions/prepare-poetry
36+
- name: 🐍 Set up Python
37+
uses: actions/setup-python@v4
3638
with:
3739
python-version: ${{ inputs.python-version }}
3840

41+
- name: 📦 Install poetry
42+
uses: abatilo/actions-poetry@v4
43+
with:
44+
poetry-version: '2.1.1'
45+
46+
- name: 💾 Cache Poetry dependencies
47+
uses: actions/cache@v3
48+
with:
49+
path: ~/.cache/pypoetry
50+
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
51+
restore-keys: |
52+
poetry-${{ runner.os }}-
53+
3954
- name: Install avro-to-python-etp
4055
run: |
41-
poetry run python -m pip install avro-to-python-etp
56+
poetry self add avro-to-python-etp
57+
poetry install --no-interaction --no-root
4258
shell: bash
4359

4460
- name: Translate avpr to avsc

.github/workflows/ci-test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
name: Tests
66

77
on:
8-
pull_request:
8+
workflow_dispatch:
9+
910

1011
env:
1112
GENERATED_CODE_FOLDER: etptypes
@@ -40,7 +41,7 @@ jobs:
4041
- name: Run pytest
4142
run: |
4243
cd ${{ env.GENERATED_CODE_FOLDER }}
43-
poetry add pytest
44+
poetry add -D pytest
4445
poetry run pytest --cov=etptypes --cov-report=xml --junitxml=pytest.xml
4546
shell: bash
4647

.github/workflows/pypi-test.yml

Lines changed: 49 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ env:
1616

1717
jobs:
1818
build:
19-
name: Building generated code
19+
name: Building and push generated code
2020
runs-on: ubuntu-latest
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- name: 📥 Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0 # Fetch the entire history to avoid shallow repository issues
2427

2528
- name: Generate code from avro-to-python-etp
2629
uses: ./.github/actions/generate
@@ -29,66 +32,66 @@ jobs:
2932
dest-folder: ${{ env.GENERATED_CODE_FOLDER }}
3033
etp-file-name: ${{ secrets.ETP_FILE_NAME }}
3134

32-
- name: Install dependencies
33-
uses: ./.github/actions/prepare-poetry
35+
- name: 🐍 Set up Python
36+
uses: actions/setup-python@v4
3437
with:
3538
python-version: ${{ env.PYTHON_VERSION }}
36-
toml-path: ${{ env.GENERATED_CODE_FOLDER }}
39+
40+
- name: 💾 Cache Poetry dependencies
41+
uses: actions/cache@v3
42+
with:
43+
path: ~/.cache/pypoetry
44+
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
45+
restore-keys: |
46+
poetry-${{ runner.os }}-
47+
48+
- name: 📦 Install poetry
49+
uses: abatilo/actions-poetry@v4
50+
with:
51+
poetry-version: '2.1.1'
3752

3853
- name: Python Black
3954
run: |
4055
cd ${{ env.GENERATED_CODE_FOLDER }}
56+
poetry add -D black
4157
poetry run black etptypes
4258
43-
- name: Build Etptypes-python
59+
- name: 📦 Install poetry-dynamic-versioning
60+
run: poetry self add "poetry-dynamic-versioning[plugin]"
61+
62+
- name: 📥 Install dependencies
63+
run: poetry install --no-interaction --no-root
64+
65+
- name: Configure Poetry with PyPI repository and token
66+
run: |
67+
poetry config repositories.test-pypi https://test.pypi.org/legacy/
68+
poetry config pypi-token.test-pypi ${{ secrets.POETRY_PYPI_TEST_TOKEN_VALUE }}
69+
70+
- name: 🛠️ Build the package
4471
run: |
4572
cd ${{ env.GENERATED_CODE_FOLDER }}
73+
rm -rf dist
4674
rm pyproject.toml
4775
cp ${{ github.workspace }}/pyproject.toml .
4876
cp ${{ github.workspace }}/LICENSE .
4977
cp ${{ github.workspace }}/README.md .
78+
if [ ! -f pyproject.toml ]; then echo "pyproject.toml not found"; exit 1; fi
79+
if [ ! -f LICENSE ]; then echo "LICENSE not found"; exit 1; fi
80+
if [ ! -f README.md ]; then echo "README.md not found"; exit 1; fi
81+
poetry version $(poetry version | awk '{print $2}')
5082
poetry build
5183
52-
- name: Archive production artifacts
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: dist-artifact
56-
retention-days: 1
57-
path: |
58-
${{ env.GENERATED_CODE_FOLDER }}/dist
59-
${{ env.GENERATED_CODE_FOLDER }}/pyproject.toml
60-
${{ env.GENERATED_CODE_FOLDER }}/LICENSE
61-
${{ env.GENERATED_CODE_FOLDER }}/README.md
62-
63-
publish:
64-
needs: build
65-
66-
name: Publish to PyPI-test
67-
runs-on: ubuntu-latest
68-
69-
steps:
70-
- uses: actions/checkout@v4
71-
72-
- name: Set up Python ${{ env.PYTHON_VERSION }}
73-
uses: actions/setup-python@v4
74-
with:
75-
python-version: ${{ env.PYTHON_VERSION }}
76-
77-
- name: Get build artifacts
78-
uses: actions/download-artifact@v4
79-
with:
80-
name: dist-artifact
81-
path: ${{ env.GENERATED_CODE_FOLDER }}
82-
83-
- name: Install dependencies
84-
uses: ./.github/actions/prepare-poetry
85-
with:
86-
python-version: ${{ matrix.python-version }}
87-
toml-path: ${{ env.GENERATED_CODE_FOLDER }}
84+
# - name: Debug Publish Step
85+
# run: |
86+
# cd ${{ env.GENERATED_CODE_FOLDER }}
87+
# pwd
88+
# ls dist
89+
# poetry version
90+
# poetry config --list
8891

89-
- name: Upload to PyPI TEST
92+
- name: 🚀 Publish to PyPI
9093
run: |
9194
cd ${{ env.GENERATED_CODE_FOLDER }}
92-
poetry config repositories.test https://test.pypi.org/legacy/
93-
poetry config http-basic.test ${{ secrets.POETRY_PYPI_TOKEN_USERNAME}} ${{ secrets.POETRY_TEST_PYPI_TOKEN_PASSWORD}}
94-
poetry publish --repository test
95+
# poetry version
96+
# poetry publish --build --repository test-pypi
97+
poetry publish --repository test-pypi

.github/workflows/release.yml

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ jobs:
2020
runs-on: ubuntu-latest
2121

2222
steps:
23-
- uses: actions/checkout@v4
23+
- name: 📥 Checkout repository
24+
uses: actions/checkout@v4
2425

2526
- name: Generate code from avro-to-python-etp
2627
uses: ./.github/actions/generate
@@ -29,18 +30,37 @@ jobs:
2930
dest-folder: ${{ env.GENERATED_CODE_FOLDER }}
3031
etp-file-name: ${{ secrets.ETP_FILE_NAME }}
3132

32-
- name: Install dependencies
33-
uses: ./.github/actions/prepare-poetry
33+
- name: 🐍 Set up Python
34+
uses: actions/setup-python@v4
3435
with:
3536
python-version: ${{ env.PYTHON_VERSION }}
36-
toml-path: ${{ env.GENERATED_CODE_FOLDER }}
37+
38+
- name: 💾 Cache Poetry dependencies
39+
uses: actions/cache@v3
40+
with:
41+
path: ~/.cache/pypoetry
42+
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
43+
restore-keys: |
44+
poetry-${{ runner.os }}-
45+
46+
- name: 📦 Install poetry
47+
uses: abatilo/actions-poetry@v4
48+
with:
49+
poetry-version: '2.1.1'
3750

3851
- name: Python Black
3952
run: |
4053
cd ${{ env.GENERATED_CODE_FOLDER }}
54+
poetry add -D black
4155
poetry run black etptypes
4256
43-
- name: Build Etptypes-python
57+
- name: 📦 Install poetry-dynamic-versioning
58+
run: poetry self add "poetry-dynamic-versioning[plugin]"
59+
60+
- name: 📥 Install dependencies
61+
run: poetry install --no-interaction --no-root
62+
63+
- name: 🛠️ Build the package
4464
run: |
4565
cd ${{ env.GENERATED_CODE_FOLDER }}
4666
rm pyproject.toml
@@ -49,44 +69,8 @@ jobs:
4969
cp ${{ github.workspace }}/README.md .
5070
poetry build
5171
52-
- name: Archive production artifacts
53-
uses: actions/upload-artifact@v4
54-
with:
55-
name: dist-artifact
56-
retention-days: 1
57-
path: |
58-
${{ env.GENERATED_CODE_FOLDER }}/dist
59-
${{ env.GENERATED_CODE_FOLDER }}/pyproject.toml
60-
${{ env.GENERATED_CODE_FOLDER }}/LICENSE
61-
${{ env.GENERATED_CODE_FOLDER }}/README.md
62-
63-
publish:
64-
needs: build
65-
66-
name: Publish to PyPI-test
67-
runs-on: ubuntu-latest
68-
69-
steps:
70-
- uses: actions/checkout@v4
71-
72-
- name: Set up Python ${{ env.PYTHON_VERSION }}
73-
uses: actions/setup-python@v4
74-
with:
75-
python-version: ${{ env.PYTHON_VERSION }}
76-
77-
- name: Get build artifacts
78-
uses: actions/download-artifact@v4
79-
with:
80-
name: dist-artifact
81-
path: ${{ env.GENERATED_CODE_FOLDER }}
82-
83-
- name: Install dependencies
84-
uses: ./.github/actions/prepare-poetry
85-
with:
86-
python-version: ${{ matrix.python-version }}
87-
toml-path: ${{ env.GENERATED_CODE_FOLDER }}
88-
89-
- name: Upload to PyPI TEST
72+
- name: 🚀 Publish to PyPI
9073
run: |
9174
cd ${{ env.GENERATED_CODE_FOLDER }}
92-
poetry publish --username ${{ secrets.POETRY_PYPI_TOKEN_USERNAME}} --password ${{ secrets.POETRY_PYPI_TOKEN_PASSWORD}}
75+
poetry config pypi-token.pypi ${{ secrets.POETRY_PYPI_TOKEN_PASSWORD }}
76+
poetry publish

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ dist/
44

55
output/
66
dist/
7-
tmp/
7+
tmp/
8+
*.txt

pyproject.toml

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,44 @@
1-
[tool.poetry]
1+
[project]
22
name = "etptypes"
3-
version = "0.0.0"
3+
dynamic = [ "version", "dependencies" ]
44
description = "ETP python dev kit"
55
authors = [
6-
"Lionel Untereiner <lionel.untereiner@geosiris.com>",
7-
"Valentin Gauthier <valentin.gauthier@geosiris.com>"
6+
{name = "Lionel Untereiner", email = "lionel.untereiner@geosiris.com"} ,
7+
{name = "Valentin Gauthier", email = "valentin.gauthier@geosiris.com"}
8+
]
9+
maintainers = [
10+
{name = "Valentin Gauthier", email = "valentin.gauthier@geosiris.com"}
811
]
912
license = "Apache-2.0"
1013
readme = "README.md"
1114
repository = "https://github.com/geosiris-technologies/etptypes-python"
1215
homepage = "http://www.geosiris.com"
13-
classifiers = [
14-
"Intended Audience :: Information Technology",
15-
"Intended Audience :: System Administrators",
16-
"Operating System :: OS Independent",
17-
"Programming Language :: Python :: 3",
18-
"Programming Language :: Python",
19-
"Topic :: Internet",
20-
"Topic :: Software Development :: Libraries :: Application Frameworks",
21-
"Topic :: Software Development :: Libraries :: Python Modules",
22-
"Topic :: Software Development :: Libraries",
23-
"Topic :: Software Development",
24-
"Typing :: Typed",
25-
"Development Status :: 4 - Beta",
26-
"Environment :: Web Environment",
27-
"Intended Audience :: Developers",
28-
"License :: OSI Approved :: Apache Software License",
29-
"Programming Language :: Python :: 3 :: Only",
30-
"Programming Language :: Python :: 3.8",
31-
"Programming Language :: Python :: 3.9",
32-
"Programming Language :: Python :: 3.10",
33-
"Programming Language :: Python :: 3.11",
34-
"Topic :: Internet :: WWW/HTTP",
35-
]
3616
keywords = ["ETP"]
17+
requires-python = ">=3.9, <4.0"
18+
19+
[tool.poetry]
20+
version = "0.0.0"
3721

3822
[tool.poetry.dependencies]
39-
python = "^3.9, <4.0"
4023
pydantic = "<2.0.0"
4124
typingx = "^0.6.0"
4225

26+
[tool.poetry.group.dev.dependencies]
27+
avro-to-python-etp = "^1.0.11"
28+
poetry-dynamic-versioning = {extras = ["plugin"], version = "^1.8.2"}
29+
4330
[build-system]
44-
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
31+
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.1"]
4532
build-backend = "poetry_dynamic_versioning.backend"
33+
# [build-system]
34+
# requires = ["poetry-core>=1.0.0"]
35+
# build-backend = "poetry.core.masonry.api"
36+
37+
[project.entry-points."poetry.plugin"]
38+
"dynamic-versioning" = "poetry_dynamic_versioning.plugin"
39+
40+
[tool.dunamai]
41+
version_strategy = "post-release"
4642

4743
[tool.poetry-dynamic-versioning]
4844
enable = true

0 commit comments

Comments
 (0)