diff --git a/.github/workflows/python-lint.yml b/.github/workflows/python-lint.yml index 08fff8c..c5bc03e 100644 --- a/.github/workflows/python-lint.yml +++ b/.github/workflows/python-lint.yml @@ -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 diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index e998dc9..10e6bcd 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -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" @@ -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 # @@ -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/