[pre-commit.ci] pre-commit autoupdate #839
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
name: tests | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
schedule: | |
- cron: "0 8 * * *" | |
concurrency: | |
group: tests-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
default-python: "3.12" | |
jobs: | |
tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.12", "3.11", "3.10", "3.9", "3.8"] | |
include: | |
- os: windows-latest | |
python-version: "3.12" | |
- os: macos-latest | |
python-version: "3.12" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: "pip" | |
- name: Persistent .pipx_tests/package_cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ github.workspace }}/.pipx_tests/package_cache/${{ matrix.python-version }} | |
key: pipx-tests-package-cache-${{ runner.os }}-${{ matrix.python-version }} | |
- name: Install nox | |
run: python -m pip install nox | |
- name: Execute Tests | |
run: nox --error-on-missing-interpreters --non-interactive --session tests-${{ matrix.python-version }} | |
man: | |
name: Build man page | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.default-python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.default-python }} | |
cache: "pip" | |
- name: Install nox | |
run: python -m pip install nox | |
- name: Build man page | |
run: nox --error-on-missing-interpreters --non-interactive --session build_man | |
- name: Show man page | |
run: man -l pipx.1 | |
zipapp: | |
name: Build zipapp | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout ${{ github.ref }} | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.default-python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.default-python }} | |
cache: "pip" | |
- name: Install nox | |
run: pip install nox | |
- name: Build zipapp | |
run: nox --error-on-missing-interpreters --non-interactive --session zipapp | |
- name: Test zipapp by installing black | |
run: python ./pipx.pyz install black | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pipx.pyz | |
path: pipx.pyz | |
retention-days: 3 | |
pypi-publish: | |
name: Publish pipx to PyPI on release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: [tests, man, zipapp] | |
runs-on: ubuntu-latest | |
environment: | |
name: release | |
url: https://pypi.org/p/pipx | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout ${{ github.ref }} | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.default-python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.default-python }} | |
cache: "pip" | |
- name: Install nox | |
run: pip install nox | |
- name: Build sdist and wheel | |
run: nox --error-on-missing-interpreters --non-interactive --session build | |
- name: Publish to PyPi | |
uses: pypa/gh-action-pypi-publish@v1.8.11 | |
upload-zipapp: | |
name: Upload zipapp to GitHub Release on release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: [tests, man, zipapp] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: pipx.pyz | |
- name: Upload to release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: pipx.pyz | |
bump-changelog: | |
name: Bump changelog on release | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
needs: [pypi-publish, upload-zipapp] | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout ${{ github.ref }} | |
uses: actions/checkout@v4 | |
- name: Extract release tag | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Update changelog | |
run: echo -e "## dev\n\n## $RELEASE_VERSION\n$(tail -n +2 CHANGELOG.md)" > CHANGELOG.md | |
- name: Commit and push change | |
run: | | |
git config --global user.name 'Github Actions' | |
git config --global user.email 'gh-action@users.noreply.github.com' | |
git commit -am "Bump changelog for $RELEASE_VERSION" | |
git push origin HEAD:main |