Skip to content

[pre-commit.ci] pre-commit autoupdate #76

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #76

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# Windows first (primary development platform), then Linux, then macOS
os: [windows-latest, ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
exclude:
# Reduce the matrix size by excluding some combinations
- os: macos-latest
python-version: '3.9'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Setup environment (macOS)
if: runner.os == 'macOS'
run: |
# Setup UTF-8 locale for macOS
echo "LC_ALL=en_US.UTF-8" >> $GITHUB_ENV
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
# Check locale
locale
# Check Python version and encoding
python --version
python -c "import sys; print('Default encoding:', sys.getdefaultencoding())"
python -c "import locale; print('Locale:', locale.getdefaultlocale())"
- name: Cache pip packages
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Lint and format with ruff
run: |
# Check for linting errors
ruff check ipecmd_wrapper
# Check formatting
ruff format --check ipecmd_wrapper
- name: Type checking with mypy
run: |
mypy ipecmd_wrapper --ignore-missing-imports --no-strict-optional --disable-error-code=assignment
- name: Security scanning with bandit
run: |
bandit -r ipecmd_wrapper
- name: Test with pytest
run: |
pytest tests/ --cov=ipecmd_wrapper --cov-report=xml --cov-report=term-missing --cov-fail-under=75
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Check code formatting and linting with ruff
run: |
ruff format --check ipecmd_wrapper tests
ruff check ipecmd_wrapper tests
- name: Run pre-commit hooks
run: |
pre-commit run --all-files
build:
runs-on: ubuntu-latest
needs: [test, quality]
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- 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
run: |
twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
test-install:
runs-on: ${{ matrix.os }}
needs: build
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.9', '3.12']
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Install from wheel
shell: bash
run: |
python -m pip install --upgrade pip
pip install dist/*.whl
- name: Test installation
shell: bash
run: |
python -c "import ipecmd_wrapper; print('Package imported successfully')"
ipecmd-wrapper --help