-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop python 3.8 support and update CI (#5)
- Drop python3.8 support - Add additional pre-commit checks - Enable python 3.13 in CI - Enable windows and mac os versions in CI - Enable CI caching
- Loading branch information
Showing
39 changed files
with
1,670 additions
and
896 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
--- | ||
name: Setup Environment | ||
description: Install requested pipx dependencies, configure the system python, and install poetry and the package dependencies | ||
|
||
inputs: | ||
poetry-install-options: | ||
default: "" | ||
poetry-version: | ||
default: 1.8.2 | ||
python-version: | ||
required: true | ||
cache-pre-commit: | ||
default: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: "actions/setup-python@v5" | ||
id: setup-python | ||
with: | ||
python-version: "${{ inputs.python-version }}" | ||
allow-prereleases: true | ||
|
||
- name: Setup pipx environment Variables | ||
id: pipx-env-setup | ||
# pipx default home and bin dir are not writable by the cache action | ||
# so override them here and add the bin dir to PATH for later steps. | ||
# This also ensures the pipx cache only contains poetry | ||
run: | | ||
SEP="${{ !startsWith(runner.os, 'windows') && '/' || '\\' }}" | ||
PIPX_CACHE="${{ github.workspace }}${SEP}pipx_cache" | ||
echo "pipx-cache-path=${PIPX_CACHE}" >> $GITHUB_OUTPUT | ||
echo "pipx-version=$(pipx --version)" >> $GITHUB_OUTPUT | ||
echo "PIPX_HOME=${PIPX_CACHE}${SEP}home" >> $GITHUB_ENV | ||
echo "PIPX_BIN_DIR=${PIPX_CACHE}${SEP}bin" >> $GITHUB_ENV | ||
echo "PIPX_MAN_DIR=${PIPX_CACHE}${SEP}man" >> $GITHUB_ENV | ||
echo "${PIPX_CACHE}${SEP}bin" >> $GITHUB_PATH | ||
shell: bash | ||
|
||
- name: Pipx cache | ||
id: pipx-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.pipx-env-setup.outputs.pipx-cache-path }} | ||
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-pipx-${{ steps.pipx-env-setup.outputs.pipx-version }}-poetry-${{ inputs.poetry-version }} | ||
|
||
- name: Install poetry | ||
if: steps.pipx-cache.outputs.cache-hit != 'true' | ||
id: install-poetry | ||
shell: bash | ||
run: |- | ||
pipx install poetry==${{ inputs.poetry-version }} --python "${{ steps.setup-python.outputs.python-path }}" | ||
- name: Read poetry cache location | ||
id: poetry-cache-location | ||
shell: bash | ||
run: |- | ||
echo "poetry-venv-location=$(poetry config virtualenvs.path)" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v4 | ||
name: Poetry cache | ||
with: | ||
path: | | ||
${{ steps.poetry-cache-location.outputs.poetry-venv-location }} | ||
key: ${{ runner.os }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('poetry.lock') }}-options-${{ inputs.poetry-install-options }} | ||
|
||
- name: "Poetry install" | ||
shell: bash | ||
run: | | ||
poetry install ${{ inputs.poetry-install-options }} | ||
- name: Read pre-commit version | ||
if: inputs.cache-pre-commit == 'true' | ||
id: pre-commit-version | ||
shell: bash | ||
run: >- | ||
echo "pre-commit-version=$(poetry run pre-commit -V | awk '{print $2}')" >> $GITHUB_OUTPUT | ||
- uses: actions/cache@v4 | ||
if: inputs.cache-pre-commit == 'true' | ||
name: Pre-commit cache | ||
with: | ||
path: ~/.cache/pre-commit/ | ||
key: ${{ runner.os }}-pre-commit-${{ steps.pre-commit-version.outputs.pre-commit-version }}-python-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('.pre-commit-config.yaml') }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,7 @@ on: | |
branches: ["main"] | ||
|
||
env: | ||
POETRY_VERSION: 1.6.1 | ||
TOX_VERSION: 4.11.3 | ||
COVERALLS_VERSION: 3.3.1 | ||
POETRY_VERSION: 1.8.3 | ||
|
||
jobs: | ||
linting: | ||
|
@@ -19,22 +17,17 @@ jobs: | |
matrix: | ||
python-version: ["3.12"] | ||
steps: | ||
- uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
- uses: "actions/checkout@v4" | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
python-version: "${{ matrix.python-version }}" | ||
- name: "Install dependencies" | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install --user pipx | ||
python3 -m pipx ensurepath | ||
pipx install poetry==$POETRY_VERSION | ||
pipx install tox==$TOX_VERSION | ||
- name: Lint with tox | ||
python-version: ${{ matrix.python-version }} | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
poetry-install-options: "" | ||
cache-pre-commit: true | ||
- name: "Run pre-commit checks" | ||
run: | | ||
tox | ||
env: | ||
TOXENV: lint | ||
poetry run pre-commit run --all-files | ||
docs: | ||
name: "Build docs" | ||
|
@@ -44,73 +37,42 @@ jobs: | |
matrix: | ||
python-version: ["3.12"] | ||
steps: | ||
- uses: "actions/checkout@v2" | ||
- uses: "actions/setup-python@v2" | ||
- uses: "actions/checkout@v4" | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
python-version: "${{ matrix.python-version }}" | ||
- name: "Install dependencies" | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install --user pipx | ||
python3 -m pipx ensurepath | ||
pipx install poetry==$POETRY_VERSION | ||
pipx install tox==$TOX_VERSION | ||
- name: Make docs with tox | ||
python-version: ${{ matrix.python-version }} | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
poetry-install-options: "--extras docs --without dev" | ||
- name: Make docs poetry | ||
run: | | ||
tox | ||
env: | ||
TOXENV: docs | ||
poetry run make -C docs html | ||
tests: | ||
name: tests | ||
name: Tests - Python ${{ matrix.python-version}} on ${{ matrix.os }} | ||
needs: linting | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
- "3.12" | ||
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "pypy-3.9", "pypy-3.10"] | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
- uses: "actions/checkout@v4" | ||
- name: Setup environment | ||
uses: ./.github/actions/setup | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install --user pipx | ||
python3 -m pipx ensurepath | ||
pipx install poetry==$POETRY_VERSION | ||
pipx install tox==$TOX_VERSION | ||
pipx install coveralls==$COVERALLS_VERSION | ||
- name: Prepare toxenv | ||
id: toxenv | ||
run: | | ||
if [[ '${{ matrix.python-version }}' == '3.8' ]]; then | ||
echo "::set-output name=toxenv::py38" | ||
elif [[ '${{ matrix.python-version }}' == '3.9' ]]; then | ||
echo "::set-output name=toxenv::py39" | ||
elif [[ '${{ matrix.python-version }}' == '3.10' ]]; then | ||
echo "::set-output name=toxenv::py310" | ||
elif [[ '${{ matrix.python-version }}' == '3.11' ]]; then | ||
echo "::set-output name=toxenv::py311" | ||
else | ||
echo "::set-output name=toxenv::py312" | ||
fi | ||
- name: Test with tox | ||
run: | | ||
tox | ||
env: | ||
TOXENV: ${{ steps.toxenv.outputs.toxenv }} | ||
- name: Report to Coveralls | ||
run: | | ||
coveralls --service=github | ||
# Only report coverage on latest Python version and skip on prior failures | ||
poetry-version: ${{ env.POETRY_VERSION }} | ||
- name: Run tests | ||
run: > | ||
poetry run pytest tests/ | ||
--cov=firebase_messaging --cov-report=xml | ||
--cov-report=term-missing --import-mode importlib | ||
- name: Coveralls GitHub Action | ||
uses: coverallsapp/[email protected] | ||
with: | ||
file: coverage.xml | ||
debug: true | ||
if: ${{ success() && matrix.python-version == '3.12' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ __pycache__/ | |
.tox | ||
htmlcov/ | ||
docs/build | ||
dist | ||
dist |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,46 @@ | ||
repos: | ||
- repo: https://github.com/python-poetry/poetry | ||
rev: 1.6.0 | ||
|
||
- repo: https://github.com/python-poetry/poetry | ||
rev: "1.8" | ||
hooks: | ||
- id: poetry-check | ||
|
||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: poetry-check | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-docstring-first | ||
- id: check-yaml | ||
- id: debug-statements | ||
- id: check-ast | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.1.3 | ||
rev: v0.6.1 | ||
hooks: | ||
- id: ruff | ||
args: [--fix, --exit-non-zero-on-fix] | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: v1.9.0 | ||
hooks: | ||
- id: mypy | ||
args: ["--install-types", "--non-interactive", "--ignore-missing-imports"] | ||
additional_dependencies: [types-protobuf] | ||
# Exclude the proto/*.py so when files are passed as parameters | ||
# they do not cause duplicate module errors | ||
exclude: | | ||
(?x)^( | ||
tests/.*| | ||
docs/.*| | ||
firebase_messaging/proto/.*py$ | ||
)$ | ||
- id: ruff-format | ||
|
||
- repo: https://github.com/PyCQA/doc8 | ||
rev: 'v1.1.1' | ||
hooks: | ||
- id: doc8 | ||
additional_dependencies: [tomli] | ||
|
||
- repo: local | ||
hooks: | ||
# Run mypy in the virtual environment so it uses the installed dependencies | ||
# for more accurate checking than using the pre-commit mypy mirror | ||
- id: mypy | ||
name: mypy | ||
entry: ./run-in-env.sh mypy | ||
language: system | ||
types_or: [python, pyi] | ||
require_serial: true | ||
exclude: | # exclude required because --all-files passes py and pyi | ||
(?x)^( | ||
docs/.*| | ||
tests/.*| | ||
firebase_messaging/proto/.*py$ | ||
)$ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,4 @@ python: | |
- method: pip | ||
path: . | ||
extra_requirements: | ||
- docs | ||
- docs |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ API Documentation | |
|
||
.. autoclass:: FcmPushClient | ||
:members: | ||
:undoc-members: | ||
:undoc-members: |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
.. include:: ../../CHANGELOG.rst | ||
.. include:: ../../CHANGELOG.rst |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,8 +12,7 @@ Welcome to python-ring-doorbell's documentation! | |
:hidden: | ||
:titlesonly: | ||
:maxdepth: 0 | ||
|
||
Home <self> | ||
api | ||
changelog | ||
|
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
Oops, something went wrong.