Skip to content

Commit

Permalink
ci: implement comprehensive GitHub Actions workflows
Browse files Browse the repository at this point in the history
- Add main CI workflow for multi-platform testing
  - Test on Ubuntu, Windows, and macOS
  - Support Python 3.8-3.11
  - Include coverage reporting via codecov

- Add code quality workflow
  - Black for code formatting
  - isort for import sorting
  - flake8 for linting
  - mypy for type checking

- Add documentation workflow
  - Automated Sphinx docs building
  - Deploy to GitHub Pages
  - RTD theme integration

- Configure concurrency settings
  - Group by git ref
  - Cancel in-progress for non-master branches

- Add dependency management
  - Automated pip updates
  - Dev dependencies installation
  - Test requirements handling

Resolves #12
#12
  • Loading branch information
e-florez committed Oct 24, 2024
1 parent 20db8d0 commit 5b09750
Showing 1 changed file with 70 additions and 27 deletions.
97 changes: 70 additions & 27 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,83 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python package
name: Python Cluster Compare (pyCC)

on:
push:
branches: [ "master" ]
branches:
# - "*" # matches every branch that doesn't contain a '/'
# - "*/*" # matches every branch containing a single '/'
- "**" # matches every branch
# - "!main" # excludes master
pull_request:
branches: [ "master" ]
branches: ["main"]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
- uses: actions/checkout@v4

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

- name: Display Python version
run: python -c "import sys; print(sys.version)"
shell: bash

# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# # pip install .[dev]
# pip install poetry
# poetry install
# shell: bash

# - name: Lint with ruff
# run: |
# poetry run ruff check .
# shell: bash

# # continue-on-error: true

# - name: Lint with mypy
# run: |
# poetry run mypy .
# shell: bash

# # continue-on-error: true

# - name: Build documentation
# run: |
# poetry run sphinx-build -b html docs/source docs/_build/html
# shell: bash

# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v3
# if: github.ref == 'refs/heads/main'
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./docs/_build/html

# - name: Test with pytest
# run: |
# python -m pip install pytest
# python -m pip install pytest-cov
# poetry run pytest -v -x
# shell: bash

# - name: Test Coverage
# run: |
# python -m pip install coverage
# poetry run coverage report
# poetry run coverage html
# shell: bash

0 comments on commit 5b09750

Please sign in to comment.