CI #379
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: [ main, master ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| schedule: | |
| # Every Monday at 06:00 UTC. | |
| - cron: "0 6 * * 1" | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| name: Test (${{ 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", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up conda | |
| uses: conda-incubator/setup-miniconda@v3 | |
| with: | |
| activate-environment: test-env | |
| python-version: ${{ matrix.python-version }} | |
| auto-update-conda: true | |
| channels: conda-forge | |
| channel-priority: strict | |
| # MKL Pardiso is not available on macOS. | |
| - name: Install MKL Pardiso | |
| if: matrix.os != 'macos-latest' | |
| shell: bash -l {0} | |
| run: pip install py-mkl-pardiso | |
| # Petsc4py is not available on Windows | |
| - name: Install POSIX-only dependencies | |
| if: matrix.os != 'windows-latest' | |
| shell: bash -l {0} | |
| run: conda install -y -c conda-forge petsc4py | |
| # macldlt (Apple Accelerate) is macOS only | |
| - name: Install macldlt (macOS only) | |
| if: matrix.os == 'macos-latest' | |
| shell: bash -l {0} | |
| run: python -m pip install macldlt | |
| - name: Install dependencies | |
| shell: bash -l {0} | |
| run: | | |
| conda install -y -c conda-forge suitesparse scikit-umfpack nanoeigenpy | |
| python -m pip install 'scikit-sparse>=0.5' | |
| python -m pip install -U pip | |
| python -m pip install qdldl pytest | |
| python -m pip install -e .[test] || python -m pip install -e . | |
| - name: Run tests | |
| shell: bash -l {0} | |
| run: | | |
| pytest | |
| build-and-publish: | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: [test] | |
| name: Build & Publish to PyPI | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.11" | |
| cache: pip | |
| - name: Build sdist and wheel | |
| run: | | |
| python -m pip install -U pip build | |
| python -m build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: dist | |
| path: dist/* | |
| - name: Publish to PyPI (Trusted Publishing) | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| print-hash: true | |
| # repository-url: https://test.pypi.org/legacy/ | |
| # skip-existing: true |