Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 63 additions & 41 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
@@ -1,53 +1,75 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python application
name: CI and publish

on:
push:
branches:
- '**'
create:
branches:
- '**'
tags:
- '**'
- master
pull_request:
branches:
- master # Run on pull requests targeting the master branch
- master

permissions:
contents: read

jobs:
build:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.10"
cache: pip
- name: Install lint tools
run: python -m pip install black==24.4.2 flake8
- name: Lint
run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Check formatting
run: black --target-version py310 --check .

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package and test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[test]"
- name: Test
run: python -m pytest

publish:
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
needs:
- lint
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Check formatting
run: |
# stop the build if there are formatting is error in any python codes
# to check whether the codes are formatted or not before merge
pip install black==24.4.2
pip install click==8.1.7
python -m black -t py310 --check .
- name: Test with pytest
run: |
export GOOGLE_APPLICATION_CREDENTIALS=service-account.json
export FCM_TEST_PROJECT_ID=test
pip install . ".[test]"
python -m pytest .
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.12"
cache: pip
- name: Build package
run: |
python -m pip install --upgrade build
python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_PASSWORD }}
skip-existing: true
31 changes: 0 additions & 31 deletions .github/workflows/python-publish.yml

This file was deleted.

2 changes: 1 addition & 1 deletion pyfcm/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
__summary__ = "Python client for FCM - Firebase Cloud Messaging (Android, iOS and Web)"
__url__ = "https://github.com/olucurious/pyfcm"

__version__ = "2.1.0"
__version__ = "2.1.1"

__author__ = "Emmanuel Adegbite"
__email__ = "olucurious@gmail.com"
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
aiohttp>=3.8.6
cachetools==5.5.2
google-auth==2.24.0
pyasn1==0.6.1
pyasn1==0.6.4
pyasn1-modules==0.4.2
rsa==4.9.1
requests>=2.6.0
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def read(fname):
"google-auth>=2.22.0",
"aiohttp>=3.8.6",
]
tests_require = ["pytest"]
tests_require = ["pytest", "pytest-mock"]

# We can't get the values using `from pyfcm import __meta__`, because this would import
# the other modules too and raise an exception (dependencies are not installed at this point yet).
Expand Down