Skip to content

Add pytest tests, ARCHITECTURE.md, and PyPI publish workflow #1

Add pytest tests, ARCHITECTURE.md, and PyPI publish workflow

Add pytest tests, ARCHITECTURE.md, and PyPI publish workflow #1

Workflow file for this run

# Publish to PyPI on push to main
name: Publish to PyPI
on:
push:
branches:
- main
paths-ignore:
- '*.md'
- 'docs/**'
- '.gitignore'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-cov
pip install -e .
- name: Run tests
run: pytest tests/ -v --cov=eeg --cov-report=xml
- name: Upload coverage
if: matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
files: coverage.xml
fail_ci_if_error: false
publish:
needs: test
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # Required for trusted publishing
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# Uses trusted publishing (OIDC) - no API token needed
# Configure at: https://pypi.org/manage/project/eeg-security/settings/publishing/
skip-existing: true