Fix CI quality gate failures and apply Black formatting #7
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: Tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: [ master, main ] | |
| pull_request: | |
| branches: [ master, main ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| quality: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set Up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Install | |
| run: python -m pip install -e ".[dev]" | |
| - name: Formatting (Black) | |
| run: black --check . | |
| - name: Lint (Ruff) | |
| run: ruff check . | |
| - name: Type Check (Mypy) | |
| run: mypy | |
| - name: Build Package | |
| run: python -m build | |
| - name: Validate Package Metadata | |
| run: twine check dist/* | |
| pytest: | |
| needs: quality | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set Up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Upgrade pip | |
| run: python -m pip install --upgrade pip | |
| - name: Ensure Clean Environment (No Preinstalled hypergraphx) | |
| run: | | |
| python -m pip uninstall -y hypergraphx || true | |
| if python -m pip show hypergraphx >/dev/null 2>&1; then | |
| echo "hypergraphx is unexpectedly installed before test setup." | |
| python -m pip show hypergraphx | |
| exit 1 | |
| fi | |
| - name: Install | |
| run: | | |
| python -m pip install -e ".[dev]" | |
| python -m pip install matplotlib tqdm | |
| - name: Pytest | |
| run: pytest |