2019-09-04 10:16:30 +03:00
|
|
|
name: Python package
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
- develop
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2021-10-09 15:13:30 +03:00
|
|
|
runs-on: ubuntu-latest
|
2019-09-04 10:16:30 +03:00
|
|
|
strategy:
|
2020-02-01 13:22:02 +03:00
|
|
|
max-parallel: 4
|
2019-09-04 10:16:30 +03:00
|
|
|
matrix:
|
2024-03-20 22:53:31 +03:00
|
|
|
python-version: ['3.9', '3.10', '3.11', '3.12']
|
2019-09-04 10:16:30 +03:00
|
|
|
|
|
|
|
steps:
|
2022-04-05 12:38:17 +03:00
|
|
|
- uses: actions/checkout@v3
|
2019-09-04 10:16:30 +03:00
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
2021-10-09 15:13:30 +03:00
|
|
|
uses: actions/setup-python@v2
|
2019-09-04 10:16:30 +03:00
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2021-10-09 15:13:30 +03:00
|
|
|
- name: Upgrade pip
|
|
|
|
run: python -m pip install --upgrade pip
|
|
|
|
- name: Install Poetry
|
|
|
|
uses: snok/install-poetry@v1
|
|
|
|
- name: Install deps
|
2023-08-20 23:03:27 +03:00
|
|
|
run: poetry install --with dev
|
2019-09-04 10:16:30 +03:00
|
|
|
- name: Lint with flake8
|
|
|
|
run: |
|
|
|
|
# stop the build if there are Python syntax errors or undefined names
|
2021-10-09 15:13:30 +03:00
|
|
|
poetry run flake8 sync_ics2gcal --count --select=E9,F63,F7,F82 --show-source --statistics
|
2019-09-04 10:16:30 +03:00
|
|
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
2021-10-09 15:13:30 +03:00
|
|
|
poetry run flake8 sync_ics2gcal --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
2019-09-04 10:16:30 +03:00
|
|
|
- name: Test with pytest
|
2021-10-09 15:13:30 +03:00
|
|
|
run: poetry run pytest -v
|
2022-06-04 15:44:01 +03:00
|
|
|
|
|
|
|
- name: Check type annotations with mypy
|
|
|
|
run: |
|
|
|
|
mkdir mypy_report
|
2022-06-04 15:48:25 +03:00
|
|
|
poetry run mypy --pretty --html-report mypy_report/ .
|
2022-06-04 15:44:01 +03:00
|
|
|
|
2022-06-04 20:12:38 +03:00
|
|
|
- name: Check type annotations with mypy strict mode (not failing)
|
|
|
|
run: |
|
|
|
|
poetry run mypy --strict --pretty . || true
|
|
|
|
|
2022-06-04 23:43:13 +03:00
|
|
|
- name: Check formatting with black
|
|
|
|
run: poetry run black --check --diff --color .
|
|
|
|
|
2022-06-04 15:44:01 +03:00
|
|
|
- name: Upload mypy report
|
2024-10-01 09:09:20 +03:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-06-04 15:44:01 +03:00
|
|
|
with:
|
2024-10-01 09:13:46 +03:00
|
|
|
name: mypy_report-${{ matrix.python-version }}
|
2022-06-04 15:44:01 +03:00
|
|
|
path: mypy_report/
|