From 75f11e330beefdf1b877004294dd848999e4fb18 Mon Sep 17 00:00:00 2001 From: prryplatypus <25409753+prryplatypus@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:25:21 +0200 Subject: [PATCH 1/8] Cleanup Coverage action --- .github/workflows/coverage.yml | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3cfd8726c7..4d094890c4 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -12,29 +12,23 @@ on: - main - current-release - "*LTS" + jobs: - test: - runs-on: ${{ matrix.os }} + coverage: + name: Check coverage + runs-on: ubuntu-latest strategy: - matrix: - python-version: [3.9] - os: [ubuntu-latest] fail-fast: false steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - - name: Install dependencies 🔨 - run: | - python -m pip install --upgrade pip - pip install tox - name: Run coverage - run: tox -e coverage - continue-on-error: true - - uses: codecov/codecov-action@v2 + uses: prryplatypus/simple-tox@main + with: + python-version: "3.9" + tox-env: coverage + ignore-errors: true + - name: Run Codecov + uses: codecov/codecov-action@v2 with: files: ./coverage.xml fail_ci_if_error: false From 47b9a01f165b3a0e8671490a57a037e264fba95f Mon Sep 17 00:00:00 2001 From: prryplatypus <25409753+prryplatypus@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:25:33 +0200 Subject: [PATCH 2/8] Remove on demand (never used) --- .github/workflows/on-demand.yml | 39 --------------------------------- 1 file changed, 39 deletions(-) delete mode 100644 .github/workflows/on-demand.yml diff --git a/.github/workflows/on-demand.yml b/.github/workflows/on-demand.yml deleted file mode 100644 index 1aa721f366..0000000000 --- a/.github/workflows/on-demand.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: On Demand Task -on: - workflow_dispatch: - inputs: - python-version: - description: 'Version of Python to use for running Test' - required: false - default: "3.8" - tox-env: - description: 'Test Environment to Run' - required: true - default: '' - os: - description: 'Operating System to Run Test on' - required: false - default: ubuntu-latest -jobs: - onDemand: - name: tox-${{ matrix.config.tox-env }}-on-${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: ["${{ github.event.inputs.os}}"] - config: - - { tox-env: "${{ github.event.inputs.tox-env }}", py-version: "${{ github.event.inputs.python-version }}"} - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Run tests - uses: harshanarayana/custom-actions@main - with: - python-version: ${{ matrix.config.py-version }} - test-infra-tool: tox - test-infra-version: latest - action: tests - test-additional-args: "-e=${{ matrix.config.tox-env }}" - experimental-ignore-error: "yes" From 389f24be56b2fbfd6cbc0134aa63c401d13c150a Mon Sep 17 00:00:00 2001 From: prryplatypus <25409753+prryplatypus@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:26:23 +0200 Subject: [PATCH 3/8] Rework package upload --- .github/workflows/publish-package.yml | 50 ++++++++++++--------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 1cfc5a6027..8c58775094 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -4,36 +4,32 @@ on: release: types: [created] workflow_dispatch: + +env: + IS_TEST: false + jobs: - build-n-publish: - name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI + build-and-publish-package: + name: Build and publish package runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.x" - - name: Install pypa/build - run: >- - python3 -m - pip install - build - --user + python-version: "3.9" + + - name: Install dependencies + run: pip install build twine + - name: Build a binary wheel and a source tarball - run: >- - python3 -m - build - --sdist - --wheel - --outdir dist/ - . - # - name: Publish distribution 📦 to Test PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 - # with: - # password: ${{ secrets.SANIC_TEST_PYPI_API_TOKEN }} - # repository-url: https://test.pypi.org/legacy/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.SANIC_PYPI_API_TOKEN }} \ No newline at end of file + run: python -m build --sdist --wheel --outdir dist/ . + + - name: Publish to PyPi 🚀 + run: twine upload --no-interactive dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.SANIC_PYPI_API_TOKEN }} + TWINE_REPOSITORY: ${{ env.IS_TEST == 'true' && 'testpypi' || 'pypi' }} From 8c67416b9b706c04b7d35214276ac3e4797fb407 Mon Sep 17 00:00:00 2001 From: prryplatypus <25409753+prryplatypus@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:30:04 +0200 Subject: [PATCH 4/8] Is test -> true --- .github/workflows/publish-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 8c58775094..2512bf9021 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - IS_TEST: false + IS_TEST: true jobs: build-and-publish-package: From 3a648f0cb27ba6c4b80e2a8fe5a0a391ff0dfcc2 Mon Sep 17 00:00:00 2001 From: prryplatypus <25409753+prryplatypus@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:32:19 +0200 Subject: [PATCH 5/8] Fix action --- .github/workflows/publish-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 2512bf9021..85a06c7d90 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -28,7 +28,7 @@ jobs: run: python -m build --sdist --wheel --outdir dist/ . - name: Publish to PyPi 🚀 - run: twine upload --no-interactive dist/* + run: twine upload --non-interactive dist/* env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.SANIC_PYPI_API_TOKEN }} From 13fa04a4313ddfcac86b5eb3e18c256a9db69932 Mon Sep 17 00:00:00 2001 From: prryplatypus <25409753+prryplatypus@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:38:56 +0200 Subject: [PATCH 6/8] Update version on PyPi upload --- .github/workflows/publish-package.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 85a06c7d90..1ce2f5c4b1 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -24,11 +24,17 @@ jobs: - name: Install dependencies run: pip install build twine + - name: Update package version + run: | + tag_name="${{ github.event.release.tag_name }}" + version="${tag_name#v}" + echo "__version__ = \"${version}\"" > sanic/__version__.py + - name: Build a binary wheel and a source tarball run: python -m build --sdist --wheel --outdir dist/ . - name: Publish to PyPi 🚀 - run: twine upload --non-interactive dist/* + run: twine upload --non-interactive --disable-progress-bar dist/* env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.SANIC_PYPI_API_TOKEN }} From ab0705de709beda114c634b711875ae43637cd70 Mon Sep 17 00:00:00 2001 From: prryplatypus <25409753+prryplatypus@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:46:46 +0200 Subject: [PATCH 7/8] Make it work if no leading 'v' --- .github/workflows/publish-package.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 1ce2f5c4b1..4516346e7d 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -27,7 +27,14 @@ jobs: - name: Update package version run: | tag_name="${{ github.event.release.tag_name }}" - version="${tag_name#v}" + + # Remove leading 'v' from the tag name if exists + if [[ $tag_name == v* ]]; then + version="${tag_name#v}" + else + version="$tag_name" + fi + echo "__version__ = \"${version}\"" > sanic/__version__.py - name: Build a binary wheel and a source tarball From b567577832f093117124ed587117aa4eb275adbd Mon Sep 17 00:00:00 2001 From: prryplatypus <25409753+prryplatypus@users.noreply.github.com> Date: Mon, 21 Aug 2023 18:49:38 +0200 Subject: [PATCH 8/8] No more test --- .github/workflows/publish-package.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 4516346e7d..37a0b3a7eb 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: env: - IS_TEST: true + IS_TEST: false jobs: build-and-publish-package: