Update pre-commit hooks #227
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 using venv | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [ "opened", "synchronize", "reopened", "labeled", "unlabeled" ] | |
| branches: [ "main" ] | |
| schedule: | |
| # Syntax: "[min] [hour] [day of the month] [month] [day of the week]" | |
| # Note: day of the week starts in Sunday (0), ends in Saturday (6) | |
| - cron: "0 0 * * 1" # runs at 00:00 UTC on Mondays | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tests: | |
| name: ${{ matrix.os }} -- Python ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| # Gives the action the necessary permissions for publishing new | |
| # comments in pull requests. Required for Coverage reports. | |
| pull-requests: write | |
| contents: write | |
| checks: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["windows-latest", "ubuntu-latest", "macOS-latest"] | |
| python-version: ["3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| architecture: x64 | |
| - name: Display Python version | |
| run: python -c "import sys; print(sys.version)" | |
| - name: Create virtualenv on Ubuntu/macOS | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| - name: Create virtualenv on Windows | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| python -m venv .venv | |
| .venv\Scripts\activate | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e ".[dev]" | |
| - name: Run tests with pytest | |
| run: | | |
| inv tests -n 2 --generate-cov-xml --check-coverage | |
| inv tests-ipynb --generate-cov-xml --check-coverage --cov-append | |
| - name: Upload Coverage PR comment | |
| if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }} | |
| uses: py-cov-action/python-coverage-comment-action@v3 | |
| with: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| ANNOTATE_MISSING_LINES: true | |
| ANNOTATION_TYPE: error | |
| - name: Check if diff code has 100% of coverage | |
| run: | | |
| inv diff-coverage |