Skip to content
Merged

ci #4

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions .github/actions/generate/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,35 @@ runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the entire history to avoid shallow repository issues

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

- name: Install dependencies
uses: ./.github/actions/prepare-poetry
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: 📦 Install poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: '2.1.1'

- name: 💾 Cache Poetry dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ runner.os }}-

- name: Install avro-to-python-etp
run: |
poetry run python -m pip install avro-to-python-etp
poetry self add avro-to-python-etp
poetry install --no-interaction --no-root
shell: bash

- name: Translate avpr to avsc
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
name: Tests

on:
pull_request:
workflow_dispatch:


env:
GENERATED_CODE_FOLDER: etptypes
Expand Down Expand Up @@ -40,7 +41,7 @@ jobs:
- name: Run pytest
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
poetry add pytest
poetry add -D pytest
poetry run pytest --cov=etptypes --cov-report=xml --junitxml=pytest.xml
shell: bash

Expand Down
95 changes: 49 additions & 46 deletions .github/workflows/pypi-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ env:

jobs:
build:
name: Building generated code
name: Building and push generated code
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch the entire history to avoid shallow repository issues

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

- name: Install dependencies
uses: ./.github/actions/prepare-poetry
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
toml-path: ${{ env.GENERATED_CODE_FOLDER }}

- name: 💾 Cache Poetry dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ runner.os }}-

- name: 📦 Install poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: '2.1.1'

- name: Python Black
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
poetry add -D black
poetry run black etptypes

- name: Build Etptypes-python
- name: 📦 Install poetry-dynamic-versioning
run: poetry self add "poetry-dynamic-versioning[plugin]"

- name: 📥 Install dependencies
run: poetry install --no-interaction --no-root

- name: Configure Poetry with PyPI repository and token
run: |
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.POETRY_PYPI_TEST_TOKEN_VALUE }}

- name: 🛠️ Build the package
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
rm -rf dist
rm pyproject.toml
cp ${{ github.workspace }}/pyproject.toml .
cp ${{ github.workspace }}/LICENSE .
cp ${{ github.workspace }}/README.md .
if [ ! -f pyproject.toml ]; then echo "pyproject.toml not found"; exit 1; fi
if [ ! -f LICENSE ]; then echo "LICENSE not found"; exit 1; fi
if [ ! -f README.md ]; then echo "README.md not found"; exit 1; fi
poetry version $(poetry version | awk '{print $2}')
poetry build

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifact
retention-days: 1
path: |
${{ env.GENERATED_CODE_FOLDER }}/dist
${{ env.GENERATED_CODE_FOLDER }}/pyproject.toml
${{ env.GENERATED_CODE_FOLDER }}/LICENSE
${{ env.GENERATED_CODE_FOLDER }}/README.md

publish:
needs: build

name: Publish to PyPI-test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: ${{ env.GENERATED_CODE_FOLDER }}

- name: Install dependencies
uses: ./.github/actions/prepare-poetry
with:
python-version: ${{ matrix.python-version }}
toml-path: ${{ env.GENERATED_CODE_FOLDER }}
# - name: Debug Publish Step
# run: |
# cd ${{ env.GENERATED_CODE_FOLDER }}
# pwd
# ls dist
# poetry version
# poetry config --list

- name: Upload to PyPI TEST
- name: 🚀 Publish to PyPI
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
poetry config repositories.test https://test.pypi.org/legacy/
poetry config http-basic.test ${{ secrets.POETRY_PYPI_TOKEN_USERNAME}} ${{ secrets.POETRY_TEST_PYPI_TOKEN_PASSWORD}}
poetry publish --repository test
# poetry version
# poetry publish --build --repository test-pypi
poetry publish --repository test-pypi
72 changes: 28 additions & 44 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: 📥 Checkout repository
uses: actions/checkout@v4

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

- name: Install dependencies
uses: ./.github/actions/prepare-poetry
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
toml-path: ${{ env.GENERATED_CODE_FOLDER }}

- name: 💾 Cache Poetry dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pypoetry
key: poetry-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ runner.os }}-

- name: 📦 Install poetry
uses: abatilo/actions-poetry@v4
with:
poetry-version: '2.1.1'

- name: Python Black
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
poetry add -D black
poetry run black etptypes

- name: Build Etptypes-python
- name: 📦 Install poetry-dynamic-versioning
run: poetry self add "poetry-dynamic-versioning[plugin]"

- name: 📥 Install dependencies
run: poetry install --no-interaction --no-root

- name: 🛠️ Build the package
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
rm pyproject.toml
Expand All @@ -49,44 +69,8 @@ jobs:
cp ${{ github.workspace }}/README.md .
poetry build

- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifact
retention-days: 1
path: |
${{ env.GENERATED_CODE_FOLDER }}/dist
${{ env.GENERATED_CODE_FOLDER }}/pyproject.toml
${{ env.GENERATED_CODE_FOLDER }}/LICENSE
${{ env.GENERATED_CODE_FOLDER }}/README.md

publish:
needs: build

name: Publish to PyPI-test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: ${{ env.GENERATED_CODE_FOLDER }}

- name: Install dependencies
uses: ./.github/actions/prepare-poetry
with:
python-version: ${{ matrix.python-version }}
toml-path: ${{ env.GENERATED_CODE_FOLDER }}

- name: Upload to PyPI TEST
- name: 🚀 Publish to PyPI
run: |
cd ${{ env.GENERATED_CODE_FOLDER }}
poetry publish --username ${{ secrets.POETRY_PYPI_TOKEN_USERNAME}} --password ${{ secrets.POETRY_PYPI_TOKEN_PASSWORD}}
poetry config pypi-token.pypi ${{ secrets.POETRY_PYPI_TOKEN_PASSWORD }}
poetry publish
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ dist/

output/
dist/
tmp/
tmp/
*.txt
54 changes: 25 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,48 +1,44 @@
[tool.poetry]
[project]
name = "etptypes"
version = "0.0.0"
dynamic = [ "version", "dependencies" ]
description = "ETP python dev kit"
authors = [
"Lionel Untereiner <lionel.untereiner@geosiris.com>",
"Valentin Gauthier <valentin.gauthier@geosiris.com>"
{name = "Lionel Untereiner", email = "lionel.untereiner@geosiris.com"} ,
{name = "Valentin Gauthier", email = "valentin.gauthier@geosiris.com"}
]
maintainers = [
{name = "Valentin Gauthier", email = "valentin.gauthier@geosiris.com"}
]
license = "Apache-2.0"
readme = "README.md"
repository = "https://github.com/geosiris-technologies/etptypes-python"
homepage = "http://www.geosiris.com"
classifiers = [
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python",
"Topic :: Internet",
"Topic :: Software Development :: Libraries :: Application Frameworks",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development",
"Typing :: Typed",
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Internet :: WWW/HTTP",
]
keywords = ["ETP"]
requires-python = ">=3.9, <4.0"

[tool.poetry]
version = "0.0.0"

[tool.poetry.dependencies]
python = "^3.9, <4.0"
pydantic = "<2.0.0"
typingx = "^0.6.0"

[tool.poetry.group.dev.dependencies]
avro-to-python-etp = "^1.0.11"
poetry-dynamic-versioning = {extras = ["plugin"], version = "^1.8.2"}

[build-system]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.0,<2.0.0"]
requires = ["poetry-core>=1.0.0", "poetry-dynamic-versioning>=1.0.1"]
build-backend = "poetry_dynamic_versioning.backend"
# [build-system]
# requires = ["poetry-core>=1.0.0"]
# build-backend = "poetry.core.masonry.api"

[project.entry-points."poetry.plugin"]
"dynamic-versioning" = "poetry_dynamic_versioning.plugin"

[tool.dunamai]
version_strategy = "post-release"

[tool.poetry-dynamic-versioning]
enable = true
Expand Down