Run stubtest to check stubs are complete (#1141)
#6
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: Check type stubs | |
| env: | |
| version: 10.0.0 | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| pull_request: | |
| types: [opened, synchronize, reopened, ready_for_review] | |
| branches: | |
| - "master" | |
| workflow_dispatch: | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| stubtest: | |
| if: (github.event_name != 'pull_request') || (github.event.pull_request.draft == false) | |
| runs-on: ubuntu-24.04 | |
| env: | |
| PYTHON_VERSION: "3.14" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install dependencies (SCIPOptSuite) | |
| run: | | |
| wget --quiet --no-check-certificate "https://github.com/scipopt/scip/releases/download/v${{ env.version }}/scipoptsuite_${{ env.version }}-1+jammy_amd64.deb" | |
| sudo apt-get update && sudo apt install -y ./scipoptsuite_${{ env.version }}-1+jammy_amd64.deb | |
| - name: Setup python ${{ env.PYTHON_VERSION }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Install mypy | |
| run: | | |
| python -m pip install mypy | |
| - name: Install PySCIPOpt | |
| run: | | |
| export CFLAGS="-O0 -ggdb -Wall -Wextra -Werror -Wno-error=deprecated-declarations" # Debug mode. More warnings. Warnings as errors, but allow deprecated declarations. | |
| python -m pip install . -v 2>&1 | tee build.log | |
| - name: Run MyPy | |
| run: python -m mypy --package pyscipopt | |
| - name: Run stubtest | |
| run: stubs/test.sh | |
| lint: | |
| runs-on: ubuntu-latest | |
| env: | |
| FILES: src/pyscipopt/scip.pyi | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install Ruff | |
| uses: astral-sh/ruff-action@v3 | |
| with: | |
| args: "--version" | |
| - name: Lint type stubs | |
| run: ruff check ${{ env.FILES }} --extend-select PYI | |
| - name: Format type stubs | |
| run: ruff format ${{ env.FILES }} |