Skip to content

tests

tests #713

Workflow file for this run

name: tests
on:
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@v4
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 --non-interactive --session tests-${{ matrix.python-version }}
pypi-publish:
name: Publish pipx to PyPI on release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v4
- name: Set up Python ${{ env.default-python }}
uses: actions/setup-python@v4
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/[email protected]
with:
user: __token__
password: ${{ secrets.pypi_password }}
build-zipapp:
name: Build zipapp
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
needs: [tests]
runs-on: ubuntu-latest
steps:
- name: Checkout ${{ github.ref }}
uses: actions/checkout@v4
- name: Set up Python ${{ env.default-python }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.default-python }}
cache: "pip"
- name: Install shiv
run: pip install shiv
- name: Build zipapp
run: shiv -c pipx -o ./pipx.pyz git+https://github.com/pypa/pipx@${{ github.ref_name }}
- name: Show zipapp version
run: python ./pipx.pyz --version
- name: Test zipapp by installing black
run: python ./pipx.pyz install black
- name: Upload to releases
uses: softprops/action-gh-release@v1
with:
files: pipx.pyz