Skip to content
Open
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
6 changes: 2 additions & 4 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,15 @@ jobs:
python-version: ["3.10", "3.11", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black pytest
python -m pip install ".[dev]"
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint
run: |
# stop the build if there are Python syntax errors or undefined names
Expand Down
57 changes: 12 additions & 45 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,21 @@
name: Python package

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_run:
workflows:
- "Python lint"
types:
- completed
branches:
- main

jobs:
lint_and_test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# PYTHON_VER
python-version: ["3.10", "3.11", "3.13", "3.14"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install black pytest
python -m pip install ".[dev]"
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint
run: |
# stop the build if there are Python syntax errors or undefined names
black --quiet --diff --config pyproject.toml --check pywebpush
bandit --quiet -c pyproject.toml pywebpush
- name: Test with pytest
run: |
pytest pywebpush

release-build:
runs-on: ubuntu-latest
needs: lint_and_test

if: ${{ github.event.workflow_run.conclusion == 'success'}} && !startsWith({{ github.event.ref_name }}, "doc/")
steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.x"

Expand All @@ -66,18 +37,14 @@ jobs:

pypi-publish:
# Remember, matching strings need to be in single quotes.
if: ${{ github.event_name == 'push' && ( github.ref_name == 'main' || startsWith(github.ref, 'refs/tags/') ) }}
runs-on: ubuntu-latest
needs:
- release-build
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write

# Dedicated environments with protections for publishing are strongly recommended.
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
environment:
name: pypi
name: pypi-publish
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
url: https://pypi.org/p/pywebpush
#
Expand All @@ -87,7 +54,7 @@ jobs:

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
uses: actions/download-artifact@v8
with:
name: release-dists
path: dist/
Expand Down