refactor: use mypy type checking #611
Workflow file for this run
This file contains 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: Test | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
types: [opened, edited, reopened, synchronize] | |
merge_group: | |
branches: [main] | |
env: | |
POETRY_VERSION: 1.7.1 | |
CONVCO_VERSION: v0.4.2 | |
jobs: | |
test-python: | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
# Test against all supported Python minor versions | |
# Specified only minor version: the latest patch is used | |
python-version: ['3.12', '3.11', '3.10', '3.9'] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
run: curl -sSL https://install.python-poetry.org | python3 - --version ${{ env.POETRY_VERSION }} | |
- id: cache | |
uses: actions/cache@v4 | |
with: | |
path: .venv/ | |
key: ${{ runner.os }}-python-${{ matrix.python-version }}-poetry-${{ hashFiles('pyproject.toml') }} | |
- name: Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: | | |
poetry config --local virtualenvs.in-project true | |
poetry env use ${{ matrix.python-version }} | |
poetry install -E all | |
- name: Test python | |
run: | | |
poetry run python -m pytest -n auto --disable-warnings --cov=edvart tests/ | |
- name: Lint | |
run: | | |
poetry run pylint --rcfile=.pylintrc edvart/ | |
poetry run black --check --line-length 100 edvart/ tests/ | |
poetry run isort --check --line-length 100 --profile black edvart/ tests/ | |
poetry run mypy edvart/ | |
dismiss-stale-reviews: | |
runs-on: ubuntu-22.04 | |
if: github.event_name == 'pull_request' && github.event.action == 'edited' | |
steps: | |
- name: Auth. Github-CLI | |
run: echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token | |
- name: Dismiss approvals | |
run: | | |
gh api repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews \ | |
--jq '.[] | select(.state == "APPROVED") | .id' \ | |
| xargs -I '{}' gh api --method=PUT -f message="Dismissed due to PR edit." \ | |
repos/${{ github.repository }}/pulls/${{ github.event.number }}/reviews/'{}'/dismissals | |
commit-check: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # actions/checkout checks out HEAD only by default | |
- name: Get convco | |
run: | | |
curl -sSfL https://github.com/convco/convco/releases/download/${{ env.CONVCO_VERSION }}/convco-ubuntu.zip | zcat > /usr/local/bin/convco | |
chmod +x /usr/local/bin/convco | |
- name: Check pull request title | |
if: github.event_name == 'pull_request' | |
run: echo "${{ github.event.pull_request.title }}" | convco check --from-stdin | |
- name: Check all commits | |
if: github.ref == 'refs/heads/main' | |
run: convco check |