ci: add a check workflow #1
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 | |
| on: | |
| push: | |
| branches: [master, main, develop] | |
| pull_request: | |
| branches: [master, main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-lint-${{ runner.os }}-3.12-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| venv-lint-${{ runner.os }}-3.12- | |
| - name: Install dependencies | |
| run: poetry install --with dev | |
| - name: Check formatting with Black | |
| run: poetry run black --check check_filter tests | |
| - name: Check import sorting with isort | |
| run: poetry run isort --check-only check_filter tests | |
| - name: Lint with Ruff | |
| run: poetry run ruff check check_filter tests | |
| - name: Lint with Pylint | |
| run: poetry run pylint check_filter | |
| type-check: | |
| name: Type Check | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-type-${{ runner.os }}-3.12-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| venv-type-${{ runner.os }}-3.12- | |
| - name: Install dependencies | |
| run: poetry install --with dev | |
| - name: Type check with mypy | |
| run: poetry run mypy check_filter | |
| test: | |
| name: Test (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| env: | |
| CI: "true" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| virtualenvs-create: true | |
| virtualenvs-in-project: true | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: .venv | |
| key: venv-test-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| venv-test-${{ runner.os }}-${{ matrix.python-version }}- | |
| - name: Install dependencies | |
| run: poetry install --with test | |
| - name: Run tests with coverage | |
| run: poetry run pytest --cov=check_filter --cov-report=xml --cov-report=term-missing | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: ./coverage.xml | |
| fail_ci_if_error: false | |
| verbose: true |