From 0261d80b44f92b42902c78de4e8fdfb4e6a1ab33 Mon Sep 17 00:00:00 2001 From: Abdullah Alaqeel Date: Tue, 17 Oct 2023 12:23:22 +0300 Subject: [PATCH 1/5] ci: allow auto releasing to pypi --- .github/workflows/release.yaml | 35 ++++++++++++++++++++++++ .github/workflows/{main.yml => test.yml} | 5 ++-- setup.cfg | 1 + 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/release.yaml rename .github/workflows/{main.yml => test.yml} (97%) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..430983c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +name: release +on: + push: + tags: + - '*' + +jobs: + release: + name: Upload release to PyPI + runs-on: ubuntu-latest + if: github.repository == 'pytest-dev/pytest-timeout' + + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: 3.7 + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U build pytest>=5.0.0 + + - name: Build package + run: | + python -m build + python -m twine check dist/* + + - name: Publish package distributions to PyPI + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/main.yml b/.github/workflows/test.yml similarity index 97% rename from .github/workflows/main.yml rename to .github/workflows/test.yml index c4c27ba..6e65d2a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/test.yml @@ -1,8 +1,7 @@ ---- -name: build +name: Test "on": [push, pull_request] jobs: - build: + test: runs-on: ${{ matrix.os }} strategy: fail-fast: false diff --git a/setup.cfg b/setup.cfg index be6b63f..5191546 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,6 +2,7 @@ name = pytest-timeout description = pytest plugin to abort hanging tests long_description = file: README.rst +long_description_content_type = text/x-rst version = 2.2.0 author = Floris Bruynooghe author_email = flub@devork.be From 0317dfd79f2fa0716bc4e14e40f7e14d9401cdf2 Mon Sep 17 00:00:00 2001 From: Abdullah Alaqeel Date: Tue, 17 Oct 2023 21:33:41 +0300 Subject: [PATCH 2/5] Apply suggestions from code review Co-authored-by: Thomas Grainger --- .github/workflows/release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 430983c..8b44d11 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,12 +18,12 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.7 + python-version: 3.12 - name: Install dependencies run: | python -m pip install -U pip - python -m pip install -U build pytest>=5.0.0 + python -m pip install -U build - name: Build package run: | From 5fdf28ad72fb5837667c847e20a02ce4df08a041 Mon Sep 17 00:00:00 2001 From: Abdullah Alaqeel Date: Thu, 19 Oct 2023 11:51:54 +0300 Subject: [PATCH 3/5] ci: change event to `release` --- .github/workflows/release.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8b44d11..57122c3 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,8 +1,7 @@ -name: release +name: Release on: - push: - tags: - - '*' + release: + types: [published] jobs: release: @@ -31,5 +30,4 @@ jobs: python -m twine check dist/* - name: Publish package distributions to PyPI - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 From f8e80f94ce3bb7befb092c4424f416587fde807f Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Mon, 23 Oct 2023 20:13:31 +0200 Subject: [PATCH 4/5] Only check repo owner pytest-dev is not going to fork this and means it's more re-usable Co-authored-by: Hugo van Kemenade --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 57122c3..104a656 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,7 +7,7 @@ jobs: release: name: Upload release to PyPI runs-on: ubuntu-latest - if: github.repository == 'pytest-dev/pytest-timeout' + if: github.repository_owner == 'pytest-dev' permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing From 11e1963c658e7fe333c8fe41ea14c7c8a6f4befd Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Mon, 23 Oct 2023 20:14:18 +0200 Subject: [PATCH 5/5] Use a generic stable python Otherwise we have to keep changing this. Co-authored-by: Hugo van Kemenade --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 104a656..da9c38a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: 3.12 + python-version: 3.x - name: Install dependencies run: |