Skip to content

Commit c01fd45

Browse files
authored
feat: extend testing CI, drop Python 3.8 *& PyPy 3.9, separate build and publish jobs in publish workflow (#272)
Signed-off-by: K.B.Dharun Krishna <[email protected]>
1 parent d51239f commit c01fd45

File tree

3 files changed

+139
-44
lines changed

3 files changed

+139
-44
lines changed

.github/workflows/publish.yml

Lines changed: 41 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,63 +6,76 @@ name: Upload Python Package
66

77
on:
88
release:
9-
types: [created]
9+
types: [published]
1010

1111
jobs:
12-
pypi-publish:
12+
release-build:
1313
runs-on: ubuntu-latest
14-
15-
environment:
16-
name: pypi
17-
url: https://pypi.org/project/tldr/
18-
1914
permissions:
2015
contents: read
21-
id-token: write # Required for accessing OpenID Connect (OIDC) token for PyPI trusted publisher
16+
attestations: write # to upload assets attestation of 'dists' for build provenance
17+
id-token: write # grant additional permission to attestation action to mint the OIDC token permission
2218

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

2622
- name: Set up Python
2723
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
2824
with:
29-
python-version: '3.8'
25+
python-version: '3.9'
3026

3127
- name: Install sphinx toolset
32-
run: >-
33-
python -m
34-
pip install
35-
sphinx
36-
sphinx-argparse
37-
--user
28+
run:
29+
python -m pip install sphinx sphinx-argparse --user
3830

3931
- name: Install tldr dependencies
40-
run: >-
41-
python -m
42-
pip install
43-
-r
44-
requirements.txt
45-
--user
32+
run:
33+
python -m pip install -r requirements.txt --user
4634

4735
- name: Generate the manpage
4836
working-directory: docs
4937
run: make man
5038

5139
- name: Install pep517
52-
run: >-
53-
python -m
54-
pip install
55-
pep517
56-
--user
40+
run:
41+
python -m pip install pep517 --user
5742

5843
- name: Build a binary wheel and a source tarball
5944
run: >-
60-
python -m
61-
pep517.build
45+
python -m pep517.build
6246
--source
6347
--binary
6448
--out-dir dist/
6549
.
6650
51+
- name: Attest generated files
52+
uses: actions/attest-build-provenance@c074443f1aee8d4aeeae555aebba3282517141b2 # v2.2.3
53+
with:
54+
subject-path: dist/
55+
56+
- name: Upload release distributions
57+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
58+
with:
59+
name: release-dists
60+
path: dist/
61+
62+
pypi-publish:
63+
runs-on: ubuntu-latest
64+
needs: ['release-build']
65+
66+
environment:
67+
name: pypi
68+
url: https://pypi.org/project/tldr/
69+
70+
permissions:
71+
id-token: write # Required for accessing OpenID Connect (OIDC) token for PyPI trusted publisher
72+
73+
steps:
74+
- name: Retrieve release distributions
75+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
76+
with:
77+
name: release-dists
78+
path: dist/
79+
6780
- name: Publish package
6881
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc # v1.12.4

.github/workflows/test.yml

Lines changed: 97 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: Test
33
on: ['push', 'pull_request']
44

55
jobs:
6-
build:
6+
build-linux:
77
runs-on: ${{ matrix.os }}
88

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

1414
steps:
1515
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -25,20 +25,12 @@ jobs:
2525
python3 -m pip install -U pytest pytest-runner flake8
2626
2727
- name: Install sphinx dependencies
28-
run: >-
29-
python3 -m
30-
pip install
31-
sphinx
32-
sphinx-argparse
33-
--user
28+
run:
29+
python3 -m pip install sphinx sphinx-argparse --user
3430

3531
- name: Install tldr dependencies
36-
run: >-
37-
python3 -m
38-
pip install
39-
-r
40-
requirements.txt
41-
--user
32+
run:
33+
python3 -m pip install -r requirements.txt --user
4234

4335
- name: Generate the manpage
4436
working-directory: docs
@@ -54,10 +46,100 @@ jobs:
5446
run: |
5547
python3 -m pip install .
5648
tldr --version
49+
tldr tldr --markdown
50+
51+
build-macos:
52+
runs-on: macos-latest
53+
54+
strategy:
55+
matrix:
56+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.10', 'pypy3.11']
57+
58+
steps:
59+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60+
61+
- name: Set up Python ${{ matrix.python-version }}
62+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
63+
with:
64+
python-version: ${{ matrix.python-version }}
65+
66+
- name: Install developer dependencies
67+
run: |
68+
python3 -m pip install -U pip setuptools
69+
python3 -m pip install -U pytest pytest-runner flake8
70+
71+
- name: Install sphinx dependencies
72+
run: |
73+
python3 -m pip install sphinx sphinx-argparse
74+
echo "$HOME/.local/bin" >> $GITHUB_PATH
75+
76+
- name: Install tldr dependencies
77+
run:
78+
python3 -m pip install -r requirements.txt --user
79+
80+
- name: Generate the manpage
81+
working-directory: docs
82+
run: make man
83+
84+
- name: Lint codebase
85+
run: python3 -m flake8
86+
87+
- name: Run test suite
88+
run: python3 -m pytest tests/
89+
90+
- name: Test tldr cli
91+
run: |
92+
python3 -m pip install .
93+
tldr --version
94+
tldr tldr --markdown
95+
96+
build-windows:
97+
runs-on: windows-latest
98+
99+
strategy:
100+
matrix:
101+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13']
102+
103+
steps:
104+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
105+
106+
- name: Set up Python ${{ matrix.python-version }}
107+
uses: actions/setup-python@8d9ed9ac5c53483de85588cdf95a591a75ab9f55 # v5.5.0
108+
with:
109+
python-version: ${{ matrix.python-version }}
110+
111+
- name: Install developer dependencies
112+
run: |
113+
python3 -m pip install -U pip setuptools
114+
python3 -m pip install -U pytest pytest-runner flake8
115+
116+
- name: Install sphinx dependencies
117+
run: |
118+
python -m pip install sphinx sphinx-argparse --user
119+
120+
- name: Install tldr dependencies
121+
run:
122+
python3 -m pip install -r requirements.txt --user
123+
124+
- name: Generate the manpage
125+
working-directory: docs
126+
run: make man
127+
128+
- name: Lint codebase
129+
run: python3 -m flake8
130+
131+
- name: Run test suite
132+
run: python3 -m pytest tests/
133+
134+
- name: Test tldr cli
135+
run: |
136+
python3 -m pip install .
137+
tldr --version
138+
tldr tldr --markdown
57139
58140
build-snap:
59141
runs-on: ${{ matrix.os }}
60-
needs: ['build']
142+
needs: ['build-linux']
61143

62144
strategy:
63145
matrix:

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
'pytest-runner',
3636
],
3737
version=version,
38-
python_requires='~=3.8',
38+
python_requires='~=3.9',
3939
classifiers=[
4040
"Development Status :: 5 - Production/Stable",
4141
"License :: OSI Approved :: MIT License",

0 commit comments

Comments
 (0)