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
109 changes: 86 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,112 @@ name: CI

on:
push:
branches: [ main, master ]
branches: [ main, master, develop ]
pull_request:
branches: [ main, master ]
branches: [ main, master, develop ]
workflow_dispatch:

jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3

- name: Checkout code
uses: actions/checkout@v4

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

cache: 'pip'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run ruff (linting)

- name: Run tests with pytest
run: |
ruff check src/

- name: Run black (formatting check)
pytest tests/ -v --cov=python_introspect --cov-report=xml --cov-report=term

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
with:
file: ./coverage.xml
flags: unittests
fail_ci_if_error: false

lint:
name: Lint and Format Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'

- name: Install dependencies
run: |
black --check src/

- name: Run mypy (type checking)
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run ruff linter
run: |
mypy src/ --ignore-missing-imports

- name: Run tests
ruff check src/ tests/
continue-on-error: true

- name: Run black format check
run: |
pytest tests/ -v --cov=python_introspect --cov-report=xml

- name: Upload coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
uses: codecov/codecov-action@v3
black --check src/ tests/
continue-on-error: true

- name: Run mypy type check
run: |
mypy src/python_introspect/ --ignore-missing-imports
continue-on-error: true

build:
name: Build and verify package
runs-on: ubuntu-latest
needs: test

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
file: ./coverage.xml
python-version: '3.11'
cache: 'pip'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: |
python -m build

- name: Check package with twine
run: |
twine check dist/*

- name: Test package installation
run: |
pip install dist/*.whl
python -c "import python_introspect; print('Version:', python_introspect.__version__)"
python -c "from python_introspect import SignatureAnalyzer; print('Import successful!')"
30 changes: 19 additions & 11 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,39 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
publish:
name: Build and publish to PyPI
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v3

- name: Checkout code
uses: actions/checkout@v4

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

- name: Install dependencies
cache: 'pip'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build


- name: Verify package
run: twine check dist/*

- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine check dist/*
twine upload dist/*
run: twine upload dist/*
Loading
Loading