Skip to content

refactor: ♻️ migrate_v1_to_v2.py — remove unused imports and clean up… #6185

refactor: ♻️ migrate_v1_to_v2.py — remove unused imports and clean up…

refactor: ♻️ migrate_v1_to_v2.py — remove unused imports and clean up… #6185

Workflow file for this run

name: 🐍 CI - Python Package
on:
push:
branches: [main, v2.0.0, feature/*, feat/*, release/*, hotfix/*, copilot/*]
pull_request:
branches: [main, develop, v2.0.0]
repository_dispatch:
types: [create-pull-request]
jobs:
pre-commit:
if: github.repository == 'Anselmoo/spectrafit'
name: 🧹 Pre-commit
runs-on: ubuntu-latest
steps:
- name: 🛎️ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: 🐍 Set up uv for pre-commit
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: 3.11
- name: 💾 Cache pre-commit
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: ✅ Pre-commit run
run: |
uv run pre-commit run --all-files --color=always
build:
if: github.repository == 'Anselmoo/spectrafit'
name: 🏗️ Build & Test Python ${{ matrix.python-version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
needs: pre-commit
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
os: [ubuntu-latest, windows-latest, macOS-latest]
arch: [x64]
defaults:
run:
shell: bash
steps:
- name: 🛎️ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: ${{ matrix.python-version }}
- name: 📦 Install the project
run: uv sync --all-extras --dev
- name: 🧪 Test SpectraFit
run: uv run --group dev --all-extras pytest tests/
- name: 📊 Codecov
if: ${{ success() && !cancelled() }}
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
with:
name: codecov-umbrella
flags: unittests
verbose: true
env_vars: OS,PYTHON
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
minimal-build:
if: github.repository == 'Anselmoo/spectrafit'
name: 🏗️ Minimal Build
runs-on: ubuntu-latest
needs: build
steps:
- name: 🛎️ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: 🐍 Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: 📦 Install the project
run: |
uv sync --all-extras
uv run pip install -e .
install-build:
if: github.repository == 'Anselmoo/spectrafit'
name: 🏗️ Install from Wheel
runs-on: ubuntu-latest
needs: build
steps:
- name: 🛎️ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: 🐍 Install uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: 🏗️ Setup the project
run: |
uv sync --all-extras
uv build
- name: 📦 Install the wheel
run: |
uv pip install dist/*.whl
uv run spectrafit -v
documentation:
if: github.repository == 'Anselmoo/spectrafit'
name: 📚 Build Documentation
runs-on: ubuntu-latest
needs: build
steps:
- name: 🛎️ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with:
fetch-depth: 0
- name: 🐍 Install uv and doc dependencies
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.10"
- name: 📦 Install the project
run: uv sync --all-extras --group docs
- name: 🛠️ Set git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: 🏗️ Build documentation
if: ${{ !contains(github.ref, 'refs/heads/main')}}
run: uv run --group docs --all-extras mkdocs build --clean
- name: 🚀 Deploy documentation develops
if: contains(github.ref, 'refs/heads/main')
run: uv run --group docs --all-extras mike deploy --push --update-aliases develop
validation:
if: github.repository == 'Anselmoo/spectrafit'
name: 🔬 Scientific Validation
needs: build
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: 🛎️ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: 🐍 Set up Python
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.11"
- name: 📦 Install the project
run: uv sync --all-extras --dev
- name: 🔬 Run validation tests
run: uv run --group dev --all-extras pytest tests/validation/ -m validation --json-report --json-report-file=validation-report.json -v
- name: 📤 Upload validation reports
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: scientific-validation-report
path: |
validation-report.json
validation-report.html
validation-plots:
if: github.repository == 'Anselmoo/spectrafit'
name: 📊 Fit Validation Plots
runs-on: ubuntu-latest
needs: [build]
steps:
- name: 🛎️ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: 🐍 Set up uv
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
with:
enable-cache: true
cache-dependency-glob: uv.lock
python-version: "3.12"
- name: 📦 Install the project
run: uv sync --all-extras --dev
- name: 📊 Generate fit-validation plots
run: uv run python scripts/generate_plots.py
- name: 📤 Upload fit-validation plots
uses: actions/upload-artifact@v4
with:
name: fit-validation-plots
path: examples/**/fit_validation.png
if-no-files-found: error
retention-days: 30
devcontainer:
if: github.repository == 'Anselmoo/spectrafit'
name: 🐳 Devcontainer
needs: build
runs-on: ubuntu-latest
steps:
- name: 🛎️ Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: 🏗️ Build devcontainer
uses: devcontainers/ci@8bf61b26e9c3a98f69cb6ce2f88d24ff59b785c6 # v0.3