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
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ jobs:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
persist-credentials: false

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

- name: Cache pip dependencies
uses: actions/cache@v3
uses: actions/cache@v6
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml', '**/setup.py') }}
Expand Down Expand Up @@ -65,9 +67,9 @@ jobs:
pytest --cov=nui_shared_utils --cov-report=xml --cov-report=term-missing -v

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
file: ./coverage.xml
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
Expand All @@ -78,10 +80,12 @@ jobs:
needs: test

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
persist-credentials: false

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

Expand Down
34 changes: 18 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: Build and Publish to PyPI
on:
push:
tags:
- '[0-9]*' # Trigger on version tags like 1.3.0
release:
types: [published]
- '[0-9]*' # Trigger on version tags like 1.3.0 (a published GitHub Release also creates the tag)
workflow_dispatch: # Allow manual triggering

jobs:
Expand All @@ -17,10 +15,12 @@ jobs:
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- uses: actions/checkout@v5
with:
persist-credentials: false

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

Expand All @@ -41,9 +41,9 @@ jobs:
pytest --cov=nui_shared_utils --cov-report=xml --cov-report=term-missing

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
file: ./coverage.xml
files: ./coverage.xml
fail_ci_if_error: false

build:
Expand All @@ -52,12 +52,13 @@ jobs:
needs: test

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
persist-credentials: false
fetch-depth: 0 # Full history for version calculation

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

Expand All @@ -75,7 +76,7 @@ jobs:
python -m tarfile -l dist/*.tar.gz

- name: Upload artifacts
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: dist
path: dist/
Expand All @@ -85,7 +86,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test, build]
# Only publish on tagged releases
if: github.event_name == 'release' || startsWith(github.ref, 'refs/tags/')
if: startsWith(github.ref, 'refs/tags/')
environment:
name: pypi
url: https://pypi.org/project/nui-python-shared-utils/
Expand All @@ -96,7 +97,7 @@ jobs:

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7
with:
name: dist
path: dist/
Expand All @@ -106,13 +107,14 @@ jobs:
with:
verbose: true
print-hash: true
skip-existing: true # No-op instead of failing if the version is already on PyPI (safe re-runs)

publish-test:
name: Publish to TestPyPI
runs-on: ubuntu-latest
needs: [test, build]
# Publish to TestPyPI on manual trigger or development branches
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/'))
# Publish to TestPyPI on manual (non-tag) dispatch only; tag pushes go to PyPI above
if: github.event_name == 'workflow_dispatch' && !startsWith(github.ref, 'refs/tags/')
environment:
name: testpypi
url: https://test.pypi.org/project/nui-python-shared-utils/
Expand All @@ -123,7 +125,7 @@ jobs:

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7
with:
name: dist
path: dist/
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ jobs:
python-version: ['3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
with:
persist-credentials: false

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

Expand Down
Loading