From d1e756a902addcb009375a173cc97d7c727c07bc Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Thu, 27 Mar 2025 18:31:39 +0530 Subject: [PATCH 1/7] feat/ci: extend testing workflow to Windows and MacOS runners --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 99ed718..9f34b3b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: - os: ['ubuntu-latest', 'ubuntu-24.04-arm'] + os: ['ubuntu-latest', 'ubuntu-24.04-arm', 'windows-latest', 'macos-latest'] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10'] steps: From 018f9b42019afd3db59c7c0aae08b5308bb0e4ee Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Thu, 27 Mar 2025 18:47:55 +0530 Subject: [PATCH 2/7] test: seperate windows and mac builds to seperate jobs Signed-off-by: K.B.Dharun Krishna --- .github/workflows/test.yml | 105 +++++++++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9f34b3b..d6f21eb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,12 +3,12 @@ name: Test on: ['push', 'pull_request'] jobs: - build: + build-linux: runs-on: ${{ matrix.os }} strategy: matrix: - os: ['ubuntu-latest', 'ubuntu-24.04-arm', 'windows-latest', 'macos-latest'] + os: ['ubuntu-latest', 'ubuntu-24.04-arm'] python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10'] steps: @@ -55,9 +55,108 @@ jobs: python3 -m pip install . tldr --version + build-macos: + runs-on: macos-latest + + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10'] + + 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: | + brew install sphinx-doc + brew link sphinx-doc --force + + - 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 + + build-windows: + runs-on: windows-latest + + strategy: + matrix: + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10'] + + 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 + build-snap: runs-on: ${{ matrix.os }} - needs: ['build'] + needs: ['build-linux'] strategy: matrix: From 110baa366c7e12453abd5ed56d5bb5a293890131 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Thu, 27 Mar 2025 18:56:03 +0530 Subject: [PATCH 3/7] test: update macos job Signed-off-by: K.B.Dharun Krishna --- .github/workflows/test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d6f21eb..9c8fbd7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,6 +54,7 @@ jobs: run: | python3 -m pip install . tldr --version + tldr tldr build-macos: runs-on: macos-latest @@ -77,8 +78,8 @@ jobs: - name: Install sphinx dependencies run: | - brew install sphinx-doc - brew link sphinx-doc --force + python3 -m pip install sphinx sphinx-argparse + echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install tldr dependencies run: >- @@ -102,6 +103,7 @@ jobs: run: | python3 -m pip install . tldr --version + tldr tldr build-windows: runs-on: windows-latest @@ -153,6 +155,7 @@ jobs: run: | python3 -m pip install . tldr --version + tldr tldr build-snap: runs-on: ${{ matrix.os }} From d38884520605fd32d2fd3323cf9d6772584c586d Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Thu, 27 Mar 2025 19:15:24 +0530 Subject: [PATCH 4/7] cleanup: update testing jobs Signed-off-by: K.B.Dharun Krishna --- .github/workflows/test.yml | 47 ++++++++++++-------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9c8fbd7..bf62cd8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: 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.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.10', 'pypy3.11'] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -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 @@ -61,7 +53,7 @@ jobs: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.10', 'pypy3.11'] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -82,12 +74,8 @@ jobs: echo "$HOME/.local/bin" >> $GITHUB_PATH - 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 @@ -110,7 +98,7 @@ jobs: strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10'] + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.10', 'pypy3.11'] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -126,20 +114,13 @@ jobs: python3 -m pip install -U pytest pytest-runner flake8 - name: Install sphinx dependencies - run: >- - python -m - pip install - sphinx - sphinx-argparse - --user + run: | + python -m pip install sphinx sphinx-argparse --user + echo "$env:USERPROFILE\.local\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - 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 From 293635aaac35fdbd9661e184217eed0c1b661ca3 Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Thu, 27 Mar 2025 19:21:52 +0530 Subject: [PATCH 5/7] test: updated windows job Signed-off-by: K.B.Dharun Krishna --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bf62cd8..30f5650 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -116,7 +116,6 @@ jobs: - name: Install sphinx dependencies run: | python -m pip install sphinx sphinx-argparse --user - echo "$env:USERPROFILE\.local\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - name: Install tldr dependencies run: From 48a125bbb65aeb9643f1174eb32f42a41ea73f7c Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Thu, 27 Mar 2025 19:35:08 +0530 Subject: [PATCH 6/7] cleanup: update workflow, drop eol Python 3.8 support Signed-off-by: K.B.Dharun Krishna --- .github/workflows/publish.yml | 2 +- .github/workflows/test.yml | 12 ++++++------ setup.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a80a69b..71e86e4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,7 +26,7 @@ jobs: - 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: >- diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 30f5650..6dee1a4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: os: ['ubuntu-latest', 'ubuntu-24.04-arm'] - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.10', 'pypy3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.10', 'pypy3.11'] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -46,14 +46,14 @@ jobs: run: | python3 -m pip install . tldr --version - tldr tldr + tldr tldr --markdown build-macos: runs-on: macos-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.10', 'pypy3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.10', 'pypy3.11'] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -91,14 +91,14 @@ jobs: run: | python3 -m pip install . tldr --version - tldr tldr + tldr tldr --markdown build-windows: runs-on: windows-latest strategy: matrix: - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.10', 'pypy3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -135,7 +135,7 @@ jobs: run: | python3 -m pip install . tldr --version - tldr tldr + tldr tldr --markdown build-snap: runs-on: ${{ matrix.os }} diff --git a/setup.py b/setup.py index 1da313b..489f62d 100644 --- a/setup.py +++ b/setup.py @@ -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", From 6a9448109561956a772f474aca7efb77134f2aba Mon Sep 17 00:00:00 2001 From: "K.B.Dharun Krishna" Date: Thu, 27 Mar 2025 20:02:37 +0530 Subject: [PATCH 7/7] feat: seperate release build and publish jobs Signed-off-by: K.B.Dharun Krishna --- .github/workflows/publish.yml | 67 +++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 71e86e4..7863dfd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,19 +6,15 @@ 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 @@ -29,40 +25,57 @@ jobs: 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