From 302108de534ea21ad3eb1e83b538d91e79aeed7e Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 12:27:31 +0000 Subject: [PATCH 01/10] adds rust to CD build env Based on https://doc.rust-lang.org/cargo/guide/continuous-integration.html --- .github/workflows/cd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0d21482..66bea30 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -42,6 +42,9 @@ jobs: with: fetch-depth: 0 + - name: Set up Rust + run: rustup update stable && rustup default stable + - uses: pypa/cibuildwheel@v2.22 - name: Upload wheels From 7eaf49fea56a02e9f08052f6bb86f22a786b09d7 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 14:04:37 +0000 Subject: [PATCH 02/10] adds rust config options to cibuildwheel --- .github/workflows/cd.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 66bea30..ef8606f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -45,7 +45,12 @@ jobs: - name: Set up Rust run: rustup update stable && rustup default stable + # Config options from https://cibuildwheel.pypa.io/en/stable/faq/#building-rust-wheels - uses: pypa/cibuildwheel@v2.22 + env: + CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y + CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc + CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH" - name: Upload wheels uses: actions/upload-artifact@v4 From 0d5ac2d95f35d1b46a05dc86d7b0c056e47169e5 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 15:09:13 +0000 Subject: [PATCH 03/10] restricts python version for binary build --- .github/workflows/cd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index ef8606f..e5a7718 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -51,6 +51,7 @@ jobs: CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH" + CIBW_BUILD: cp311-* cp312-* - name: Upload wheels uses: actions/upload-artifact@v4 From 2391358ce3bf72fc0437305aec0fafb8a37605cb Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 15:30:49 +0000 Subject: [PATCH 04/10] try source only dist --- .github/workflows/cd.yml | 51 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e5a7718..0746db0 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -29,37 +29,38 @@ jobs: with: path: dist/*.tar.gz - build_wheels: - name: Wheel on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest, windows-latest, macos-latest] + # build_wheels: + # name: Wheel on ${{ matrix.os }} + # runs-on: ${{ matrix.os }} + # strategy: + # fail-fast: false + # matrix: + # os: [ubuntu-latest, windows-latest, macos-latest] - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 + # steps: + # - uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: Set up Rust - run: rustup update stable && rustup default stable + # - name: Set up Rust + # run: rustup update stable && rustup default stable - # Config options from https://cibuildwheel.pypa.io/en/stable/faq/#building-rust-wheels - - uses: pypa/cibuildwheel@v2.22 - env: - CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y - CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc - CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH" - CIBW_BUILD: cp311-* cp312-* + # # Config options from https://cibuildwheel.pypa.io/en/stable/faq/#building-rust-wheels + # - uses: pypa/cibuildwheel@v2.22 + # env: + # CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y + # CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc + # CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH" + # CIBW_BUILD: cp311-* cp312-* - - name: Upload wheels - uses: actions/upload-artifact@v4 - with: - path: wheelhouse/*.whl + # - name: Upload wheels + # uses: actions/upload-artifact@v4 + # with: + # path: wheelhouse/*.whl upload_all: - needs: [build_wheels, make_sdist] + # needs: [build_wheels, make_sdist] + needs: [make_sdist] environment: release permissions: id-token: write From 15ff6c0c7fd9cb7653a56d290847e63efa893ef4 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 15:52:53 +0000 Subject: [PATCH 05/10] seperates PyPI and TestPyPI publishing rules --- .github/workflows/cd.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0746db0..9d941e7 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -65,7 +65,6 @@ jobs: permissions: id-token: write runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' steps: - uses: actions/download-artifact@v4 @@ -78,3 +77,6 @@ jobs: # Remember to tell (test-)pypi about this repo before publishing # Remove this line to publish to PyPI repository-url: https://test.pypi.org/legacy/ + + - uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name == 'release' && github.event.action == 'published' From 6fc138a8d6c490d5529a97375bf360eaecb23a6c Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 16:29:06 +0000 Subject: [PATCH 06/10] seperate publishing GH envs --- .github/workflows/cd.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 9d941e7..a0d104a 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -58,7 +58,7 @@ jobs: # with: # path: wheelhouse/*.whl - upload_all: + upload_release: # needs: [build_wheels, make_sdist] needs: [make_sdist] environment: release @@ -66,6 +66,23 @@ jobs: id-token: write runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + name: artifact + path: dist + + - uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name == 'release' && github.event.action == 'published' + + upload_test: + # needs: [build_wheels, make_sdist] + needs: [make_sdist] + environment: testpypi + permissions: + id-token: write + runs-on: ubuntu-latest + steps: - uses: actions/download-artifact@v4 with: @@ -77,6 +94,3 @@ jobs: # Remember to tell (test-)pypi about this repo before publishing # Remove this line to publish to PyPI repository-url: https://test.pypi.org/legacy/ - - - uses: pypa/gh-action-pypi-publish@release/v1 - if: github.event_name == 'release' && github.event.action == 'published' From bebb4dad9f9273fb1b04d68f6c11182ff313685a Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 16:39:06 +0000 Subject: [PATCH 07/10] tidy up cd.yml --- .github/workflows/cd.yml | 35 +---------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a0d104a..b7a7062 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -29,42 +29,13 @@ jobs: with: path: dist/*.tar.gz - # build_wheels: - # name: Wheel on ${{ matrix.os }} - # runs-on: ${{ matrix.os }} - # strategy: - # fail-fast: false - # matrix: - # os: [ubuntu-latest, windows-latest, macos-latest] - - # steps: - # - uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - - # - name: Set up Rust - # run: rustup update stable && rustup default stable - - # # Config options from https://cibuildwheel.pypa.io/en/stable/faq/#building-rust-wheels - # - uses: pypa/cibuildwheel@v2.22 - # env: - # CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y - # CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc - # CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH" - # CIBW_BUILD: cp311-* cp312-* - - # - name: Upload wheels - # uses: actions/upload-artifact@v4 - # with: - # path: wheelhouse/*.whl - upload_release: - # needs: [build_wheels, make_sdist] needs: [make_sdist] environment: release permissions: id-token: write runs-on: ubuntu-latest + if: github.event_name == 'release' && github.event.action == 'published' steps: - uses: actions/download-artifact@v4 @@ -73,10 +44,8 @@ jobs: path: dist - uses: pypa/gh-action-pypi-publish@release/v1 - if: github.event_name == 'release' && github.event.action == 'published' upload_test: - # needs: [build_wheels, make_sdist] needs: [make_sdist] environment: testpypi permissions: @@ -91,6 +60,4 @@ jobs: - uses: pypa/gh-action-pypi-publish@release/v1 with: - # Remember to tell (test-)pypi about this repo before publishing - # Remove this line to publish to PyPI repository-url: https://test.pypi.org/legacy/ From 60486d133961bba7000a2c34ccf2e0608ff0737f Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 16:48:46 +0000 Subject: [PATCH 08/10] temp bypass event restriction --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b7a7062..158c022 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -35,7 +35,7 @@ jobs: permissions: id-token: write runs-on: ubuntu-latest - if: github.event_name == 'release' && github.event.action == 'published' + # if: github.event_name == 'release' && github.event.action == 'published' steps: - uses: actions/download-artifact@v4 From 404a00355538e33e121ddacffb2c4a5ae32a4753 Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 17:20:15 +0000 Subject: [PATCH 09/10] re-enable publish on event restrictions --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 158c022..b7a7062 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -35,7 +35,7 @@ jobs: permissions: id-token: write runs-on: ubuntu-latest - # if: github.event_name == 'release' && github.event.action == 'published' + if: github.event_name == 'release' && github.event.action == 'published' steps: - uses: actions/download-artifact@v4 From b3628bda399bec52e5cd40e30372bdb91a1a05bf Mon Sep 17 00:00:00 2001 From: Andy Smith Date: Mon, 9 Dec 2024 19:34:18 +0000 Subject: [PATCH 10/10] Add skip existing on publish to TestPyPI --- .github/workflows/cd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index b7a7062..6dde08c 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -61,3 +61,6 @@ jobs: - uses: pypa/gh-action-pypi-publish@release/v1 with: repository-url: https://test.pypi.org/legacy/ + # Only skip existing distributions on testpypi (not on pypi). + # See https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file#tolerating-release-package-file-duplicates + skip-existing: true