Merge pull request #165 from IIT-EnergySystemModels/feature/apply-inv… #423
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Fast tier: lint + tests that do NOT solve a model. Cheap, so it runs on | |
| # every operating system and every supported Python version. This is where | |
| # cross-platform and cross-Python problems (imports, packaging, syntax that | |
| # needs a newer Python) are caught. | |
| fast: | |
| name: fast (lint + unit) - ${{ matrix.os }} / py${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Conda (Miniforge) + Python ${{ matrix.python-version }} | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| auto-update-conda: true | |
| activate-environment: ci | |
| python-version: ${{ matrix.python-version }} | |
| channels: conda-forge,defaults | |
| channel-priority: strict | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: requirements.lock | |
| - name: Install dependencies | |
| shell: bash -l {0} | |
| run: | | |
| conda install -y -c conda-forge flake8 pytest | |
| uv pip install --system -r requirements.lock | |
| pip install -e . | |
| - name: Lint with flake8 (syntax errors only) | |
| shell: bash -l {0} | |
| run: | | |
| flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
| - name: Run unit tests (no solve) | |
| shell: bash -l {0} | |
| run: | | |
| pytest -vv -m "not solve" tests/ | |
| # Solve tier: the full model suite (every case, multi-stage, Benders). The | |
| # model maths is the same on every platform, so re-solving on all 9 combos | |
| # adds little. We solve once per operating system on a single Python version. | |
| # Cross-Python coverage is already provided by the fast tier above. | |
| solve: | |
| name: solve (full model suite) - ${{ matrix.os }} / py${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| python-version: ["3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Conda (Miniforge) + Python ${{ matrix.python-version }} | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| auto-update-conda: true | |
| activate-environment: ci | |
| python-version: ${{ matrix.python-version }} | |
| channels: conda-forge,defaults | |
| channel-priority: strict | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: requirements.lock | |
| - name: Install dependencies | |
| shell: bash -l {0} | |
| run: | | |
| conda install -y -c conda-forge flake8 pytest pytest-timeout | |
| uv pip install --system -r requirements.lock | |
| uv pip install --system "highspy==1.15.1" | |
| pip install -e . | |
| - name: Run solve tests (per-test timeout guards a stuck solver) | |
| shell: bash -l {0} | |
| run: | | |
| pytest -vv -m solve --timeout=1800 tests/ | |
| # Pandas 2 floor: the lock pins pandas 3, but pyproject still supports pandas 2 | |
| # (>=2.2.2,<4), so nothing would exercise the older end of the range. This job | |
| # installs the lock, pins pandas back to the 2.x floor, and runs the unit and | |
| # solve tests. One combo is enough: the variable is the pandas version, not the | |
| # platform. | |
| pandas2: | |
| name: pandas 2 floor (unit + solve) - ubuntu-latest / py3.12 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Conda (Miniforge) + Python 3.12 | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| miniforge-variant: Miniforge3 | |
| miniforge-version: latest | |
| auto-update-conda: true | |
| activate-environment: ci | |
| python-version: "3.12" | |
| channels: conda-forge,defaults | |
| channel-priority: strict | |
| - name: Set up uv | |
| uses: astral-sh/setup-uv@v3 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: requirements.lock | |
| - name: Install dependencies, then pin pandas to the 2.x floor | |
| shell: bash -l {0} | |
| run: | | |
| conda install -y -c conda-forge flake8 pytest pytest-timeout | |
| uv pip install --system -r requirements.lock | |
| uv pip install --system "highspy==1.15.1" | |
| pip install -e . | |
| uv pip install --system "pandas>=2.2.2,<3" | |
| - name: Run unit and solve tests | |
| shell: bash -l {0} | |
| run: | | |
| pytest -vv -m "not solve" tests/ | |
| pytest -vv -m solve --timeout=1800 tests/ | |
| # Docs tier: build the Read the Docs site with warnings treated as errors, so | |
| # a broken cross-reference, a missing toctree entry, or a bad directive fails | |
| # the PR. No solver or model dependency, so it runs once on Linux. | |
| docs: | |
| name: docs (sphinx build) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install doc dependencies | |
| run: pip install -r doc/md/requirements.txt | |
| - name: Build docs (warnings are errors) | |
| run: sphinx-build -b html -W --keep-going doc/md doc/_build/html |