Skip to content
Merged
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
57 changes: 0 additions & 57 deletions .github/actions/prepare-poetry/action.yml

This file was deleted.

114 changes: 30 additions & 84 deletions .github/workflows/ci-publish-test-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,111 +4,57 @@
##
---

name: Publish test-pypi

on:
push:
branches:
- main
pull_request:

jobs:
build:
name: Build distribution
build-and-publish:
name: Build and Publish to TestPyPI
runs-on: ubuntu-latest
steps:

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

- name: Set up Python
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
pip install poetry-dynamic-versioning

- name: Build
run: |
poetry build
python-version: "3.9"

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

test:
name: Test
needs: build
runs-on: ubuntu-latest
steps:

- name: Set up Python
uses: actions/setup-python@v4
- name: 📦 Install poetry
uses: abatilo/actions-poetry@v4
with:
python-version: '3.9'
poetry-version: '2.1.1'

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: dist/
- name: 📦 Install poetry-dynamic-versioning
run: poetry self add "poetry-dynamic-versioning[plugin]"

- name: Install from build
run: |
python -m pip install --upgrade pip
pip install pytest-mock
pip install etpproto --pre --target=dist --find-links=dist/
- name: 📥 Install dependencies
run: poetry install --no-interaction --no-root

- name: Copy tests and example data to dist folder for testing against artifacts
- name: Configure Poetry with PyPI repository and token
run: |
cp -R tests dist/
# cp -R example_data dist/

- name: Run tests
run: pytest dist/tests

publish:
name: Publish to PyPI
needs: [build, test]
runs-on: ubuntu-latest
steps:
poetry config repositories.test-pypi https://test.pypi.org/legacy/
poetry config pypi-token.test-pypi ${{ secrets.POETRY_PYPI_TEST_TOKEN_VALUE }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: 🛠️ Build the package
run: poetry build

# Retrieve the code and GIT history so that poetry-dynamic-versioning knows which version to upload
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: dist/

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
pip install poetry-dynamic-versioning

- name: Upload to PyPI TEST
run: |
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
- name: 🚀 Publish to PyPI
run:
poetry publish --repository test-pypi
109 changes: 24 additions & 85 deletions .github/workflows/ci-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,103 +11,42 @@ on:
types: [published]

jobs:
build:
name: Build distribution
build-and-publish:
name: Build and Publish
runs-on: ubuntu-latest
steps:

- name: Checkout code
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
pip install poetry-dynamic-versioning

- name: Build
run: |
poetry build

- name: Save build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: dist/

test:
name: Test
needs: build
runs-on: ubuntu-latest
steps:
python-version: "3.9"

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

- name: Checkout code
uses: actions/checkout@v4
- name: 📦 Install poetry
uses: abatilo/actions-poetry@v4
with:
fetch-depth: 0
poetry-version: '2.1.1'

- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: dist/
- name: 📦 Install poetry-dynamic-versioning
run: poetry self add "poetry-dynamic-versioning[plugin]"

- name: Install from build
run: |
python -m pip install --upgrade pip
pip install pytest-mock
pip install etpproto --pre --target=dist --find-links=dist/
- name: 📥 Install dependencies
run: poetry install --no-interaction --no-root

- name: Copy tests and example data to dist folder for testing against artifacts
run: |
cp -R tests dist/
# cp -R example_data dist/

- name: Run tests
run: pytest dist/tests

publish:
name: Publish to PyPI
needs: [build, test]
runs-on: ubuntu-latest
steps:

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

# Retrieve the code and GIT history so that poetry-dynamic-versioning knows which version to upload
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get build artifacts
uses: actions/download-artifact@v4
with:
name: dist-artifact
path: dist/

- name: Install Poetry
run: |
python -m pip install --upgrade pip
pip install poetry
pip install poetry-dynamic-versioning
- name: 🛠️ Build the package
run: poetry build

- name: Upload to PyPI
- name: 🚀 Publish to PyPI
run: |
poetry config repositories.test https://test.pypi.org/legacy/
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
Loading