Skip to content

feat: extend testing CI, drop Python 3.8 *& PyPy 3.9, separate build and publish jobs in publish workflow #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 27, 2025
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
69 changes: 41 additions & 28 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,76 @@ name: Upload Python Package

on:
release:
types: [created]
types: [published]

jobs:
pypi-publish:
release-build:
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/project/tldr/

permissions:
contents: read
id-token: write # Required for accessing OpenID Connect (OIDC) token for PyPI trusted publisher
attestations: write # to upload assets attestation of 'dists' for build provenance
id-token: write # grant additional permission to attestation action to mint the OIDC token permission

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Python
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
with:
python-version: '3.8'
python-version: '3.9'

- name: Install sphinx toolset
run: >-
python -m
pip install
sphinx
sphinx-argparse
--user
run:
python -m pip install sphinx sphinx-argparse --user

- name: Install tldr dependencies
run: >-
python -m
pip install
-r
requirements.txt
--user
run:
python -m pip install -r requirements.txt --user

- name: Generate the manpage
working-directory: docs
run: make man

- name: Install pep517
run: >-
python -m
pip install
pep517
--user
run:
python -m pip install pep517 --user

- name: Build a binary wheel and a source tarball
run: >-
python -m
pep517.build
python -m pep517.build
--source
--binary
--out-dir dist/
.

- name: Attest generated files
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
with:
subject-path: dist/

- name: Upload release distributions
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs: ['release-build']

environment:
name: pypi
url: https://pypi.org/project/tldr/

permissions:
id-token: write # Required for accessing OpenID Connect (OIDC) token for PyPI trusted publisher

steps:
- name: Retrieve release distributions
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
with:
name: release-dists
path: dist/

- name: Publish package
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4
112 changes: 97 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: Test
on: ['push', 'pull_request']

jobs:
build:
build-linux:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: ['ubuntu-latest', 'ubuntu-24.04-arm']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.10', 'pypy3.11']

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -25,20 +25,12 @@ jobs:
python3 -m pip install -U pytest pytest-runner flake8

- name: Install sphinx dependencies
run: >-
python3 -m
pip install
sphinx
sphinx-argparse
--user
run:
python3 -m pip install sphinx sphinx-argparse --user

- name: Install tldr dependencies
run: >-
python3 -m
pip install
-r
requirements.txt
--user
run:
python3 -m pip install -r requirements.txt --user

- name: Generate the manpage
working-directory: docs
Expand All @@ -54,10 +46,100 @@ jobs:
run: |
python3 -m pip install .
tldr --version
tldr tldr --markdown

build-macos:
runs-on: macos-latest

strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.10', 'pypy3.11']

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
with:
python-version: ${{ matrix.python-version }}

- name: Install developer dependencies
run: |
python3 -m pip install -U pip setuptools
python3 -m pip install -U pytest pytest-runner flake8

- name: Install sphinx dependencies
run: |
python3 -m pip install sphinx sphinx-argparse
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Install tldr dependencies
run:
python3 -m pip install -r requirements.txt --user

- name: Generate the manpage
working-directory: docs
run: make man

- name: Lint codebase
run: python3 -m flake8

- name: Run test suite
run: python3 -m pytest tests/

- name: Test tldr cli
run: |
python3 -m pip install .
tldr --version
tldr tldr --markdown

build-windows:
runs-on: windows-latest

strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
with:
python-version: ${{ matrix.python-version }}

- name: Install developer dependencies
run: |
python3 -m pip install -U pip setuptools
python3 -m pip install -U pytest pytest-runner flake8

- name: Install sphinx dependencies
run: |
python -m pip install sphinx sphinx-argparse --user

- name: Install tldr dependencies
run:
python3 -m pip install -r requirements.txt --user

- name: Generate the manpage
working-directory: docs
run: make man

- name: Lint codebase
run: python3 -m flake8

- name: Run test suite
run: python3 -m pytest tests/

- name: Test tldr cli
run: |
python3 -m pip install .
tldr --version
tldr tldr --markdown

build-snap:
runs-on: ${{ matrix.os }}
needs: ['build']
needs: ['build-linux']

strategy:
matrix:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
'pytest-runner',
],
version=version,
python_requires='~=3.8',
python_requires='~=3.9',
classifiers=[
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: MIT License",
Expand Down