From 5224b5ad8fe555dcf26122caf1cf3ac1f5fc31de Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Mon, 30 Oct 2023 09:02:51 +0000 Subject: [PATCH 1/4] Initial pypi fix. --- .github/workflows/ci.yaml | 37 +++++++++++++++++++++++-------------- pyproject.toml | 3 +++ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0f03265..d69e424 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,6 +19,7 @@ on: permissions: contents: read + # Only have a run a single parallel for each branch. # Runs for trunk are queues. # Older runs for non-trunk branches are cancelled and the jobs are executed @@ -55,15 +56,11 @@ jobs: python-version: ${{ matrix.python-version }} allow-prereleases: true - - name: Test build - run: pipx run --python=python build . - - name: Install dependencies run: | - openssl version - python -m pip install --upgrade twisted coverage build + python -m pip install --upgrade twisted coverage - - name: Test + - name: Test code run: | coverage run -m twisted.trial constantly mv .coverage .coverage.${{ matrix.python-version }} @@ -75,6 +72,7 @@ jobs: path: .coverage.* if-no-files-found: error # 'warn' or 'ignore' are also available. + coverage: name: Combine & check coverage. needs: testing @@ -163,23 +161,34 @@ jobs: with: python-version: '${{ env.DEFAULT_PYTHON_VERSION }}' + - name: Install dependencies + run: | + python -m pip install --upgrade build + - name: Build run: | rm -rf dist/* - pipx run --python=python build . + python -m build . - name: Files to be pushed to PyPi run: ls -R dist/ - - name: Check matched tag version and branch version - on tag - if: startsWith(github.ref, 'refs/tags/') - run: | - python -Im pip install --upgrade pep517 - python admin/check_tag_version_match.py "${{ github.ref }}" + # FIXME: + # Remove comment after testing, + # - name: Check matched tag version and branch version - on tag + # if: startsWith(github.ref, 'refs/tags/') + # run: | + # python -Im pip install --upgrade pep517 + # python admin/check_tag_version_match.py "${{ github.ref }}" - name: Publish to PyPI - on tag - if: startsWith(github.ref, 'refs/tags/') - uses: pypa/gh-action-pypi-publish@a56da0b891b3dc519c7ee3284aff1fad93cc8598 + # FIXME: + # Remove comment after testing, + # if: startsWith(github.ref, 'refs/tags/') + uses: pypa/gh-action-pypi-publish@release/v1 + # Uncomment to run on testing. + with: + repository-url: https://test.pypi.org/legacy/ # We have this job so that the PR can be blocked on a single job. diff --git a/pyproject.toml b/pyproject.toml index 1f9877b..9016d4b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,3 +42,6 @@ versionfile_source = "constantly/_version.py" versionfile_build = "constantly/_version.py" tag_prefix = "" parentdir_prefix = "constantly-" + +[bdist_wheel] +universal=0 From e5d3e141febf40817edabd80f44997927e54df8b Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Mon, 30 Oct 2023 09:13:06 +0000 Subject: [PATCH 2/4] Add id-token. --- .github/workflows/ci.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d69e424..ba4ffd8 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,6 @@ on: permissions: contents: read - # Only have a run a single parallel for each branch. # Runs for trunk are queues. # Older runs for non-trunk branches are cancelled and the jobs are executed @@ -153,6 +152,10 @@ jobs: release-publish: name: Check release and publish on twisted-* tag runs-on: 'ubuntu-latest' + permissions: + # IMPORTANT: this permission is mandatory for trusted publishing + id-token: write + steps: - uses: actions/checkout@v3 From f779bce2d32f5089a0d972dabe01661b70415154 Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Mon, 30 Oct 2023 09:22:47 +0000 Subject: [PATCH 3/4] Cleanup before review. --- .github/workflows/ci.yaml | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ba4ffd8..03885ef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -57,7 +57,10 @@ jobs: - name: Install dependencies run: | - python -m pip install --upgrade twisted coverage + python -m pip install --upgrade twisted coverage build + + - name: Test build on each supported python + run: python -m build . - name: Test code run: | @@ -176,22 +179,15 @@ jobs: - name: Files to be pushed to PyPi run: ls -R dist/ - # FIXME: - # Remove comment after testing, - # - name: Check matched tag version and branch version - on tag - # if: startsWith(github.ref, 'refs/tags/') - # run: | - # python -Im pip install --upgrade pep517 - # python admin/check_tag_version_match.py "${{ github.ref }}" + - name: Check matched tag version and branch version - on tag + if: startsWith(github.ref, 'refs/tags/') + run: | + python -Im pip install --upgrade pep517 + python admin/check_tag_version_match.py "${{ github.ref }}" - name: Publish to PyPI - on tag - # FIXME: - # Remove comment after testing, - # if: startsWith(github.ref, 'refs/tags/') + if: startsWith(github.ref, 'refs/tags/') uses: pypa/gh-action-pypi-publish@release/v1 - # Uncomment to run on testing. - with: - repository-url: https://test.pypi.org/legacy/ # We have this job so that the PR can be blocked on a single job. From 57df2962ba405ce51b7ce30c397d432bcbd838e9 Mon Sep 17 00:00:00 2001 From: Adi Roiban Date: Wed, 31 Jan 2024 16:37:45 +0000 Subject: [PATCH 4/4] Revert build tests. --- .github/workflows/ci.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 03885ef..37abc0a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -55,6 +55,9 @@ jobs: python-version: ${{ matrix.python-version }} allow-prereleases: true + - name: Test build + run: pipx run --python=python build . + - name: Install dependencies run: | python -m pip install --upgrade twisted coverage build