Skip to content

Dev 081

Dev 081 #183

name: Lint Build Test Codecov
permissions:
contents: read
pull-requests: write
on:
push:
branches: [ main ]
pull_request:
branches: [ main, pre-release ]
jobs:
# Main Build Job
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macos-latest ]
python-version: [ '3.10', '3.11', '3.12', '3.13' ] # Add multiple Python versions for testing
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Verify uv installation
run: |
uv --version || echo "uv installation failed"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
run: |
uv sync --all-extras --dev || echo "Dependency installation failed"
- name: Lint with flake8
run: |
uv run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Run tests and generate coverage report
run: |
uv run pytest --verbose --cov --cov-report=xml --cov-report=term-missing || echo "Tests failed"
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false # Don't fail CI if Codecov upload fails
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run examples
run: |
uv run raman_fitting run examples
- name: Upload raman_fitting examples as artifacts
uses: actions/upload-artifact@v4
with:
name: raman-fitting-examples
path: $HOME/raman_fitting/examples/
# Separate Windows Job
windows:
runs-on: windows-latest
continue-on-error: true # Allow this job to fail without failing the whole workflow
strategy:
fail-fast: true
matrix:
python-version: [ '3.13' ] # Add multiple Python versions for testing
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
- name: Verify uv installation
run: |
uv --version || echo "uv installation failed"
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install the project
run: |
uv sync --all-extras --dev || echo "Dependency installation failed"
- name: Run Windows-specific tests
run: |
uv pip install ansi2html # Ensure ansi2html is installed
echo "from ansi2html.parser import Ansi2HTMLParser; import sys; sys.stdout.write(Ansi2HTMLParser().parse(input()))" > strip_ansi.py
uv run pytest --capture=sys --tb=short | uv run strip_ansi.py # Use uv run to execute strip_ansi.py
- name: Run examples
run: |
uv run raman_fitting run examples