From 279ba24e251a02dc9b8674a44294839adedf6132 Mon Sep 17 00:00:00 2001 From: Dmitry Kropachev Date: Wed, 5 Mar 2025 05:23:22 -0400 Subject: [PATCH 1/2] cicd: introduce build-test.yml Mantaining file for building and publishing and building for testing is complicated. Let's split them. --- .github/workflows/build-push.yml | 16 ++-------------- .github/workflows/build-test.yml | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/build-test.yml diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index b1c713194..9f77b89de 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -5,22 +5,10 @@ on: branches: - master - 'branch-**' - pull_request: - branches: - - master - paths-ignore: - - docs/* - - examples/* - - .gitignore - - '*.rst' - - '*.ini' - - LICENSE - - .github/dependabot.yml - - .github/pull_request_template.md + workflow_dispatch: jobs: build-and-publish: - if: "(!contains(github.event.pull_request.labels.*.name, 'disable-test-build')) || github.event_name == 'push' && endsWith(github.event.ref, 'scylla')" uses: ./.github/workflows/lib-build-and-push.yml with: - upload: ${{ (github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && endsWith(github.event.ref, 'scylla') }} + upload: ${{ endsWith(github.event.ref, 'scylla') }} diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml new file mode 100644 index 000000000..3e1f1067d --- /dev/null +++ b/.github/workflows/build-test.yml @@ -0,0 +1,23 @@ +name: Test wheels building + +on: + pull_request: + branches: + - master + paths-ignore: + - docs/* + - examples/* + - .gitignore + - '*.rst' + - '*.ini' + - LICENSE + - .github/dependabot.yml + - .github/pull_request_template.md + +jobs: + test-wheels-build: + name: "Test wheels building" + if: "!contains(github.event.pull_request.labels.*.name, 'disable-test-build')" + uses: ./.github/workflows/lib-build-and-push.yml + with: + upload: false \ No newline at end of file From 9247b5e1593fa34185db4132af7d6ad59052dd45 Mon Sep 17 00:00:00 2001 From: Dmitry Kropachev Date: Wed, 5 Mar 2025 05:20:22 -0400 Subject: [PATCH 2/2] cicd: move out publishing stage from reusable workflow There is bug in publishing github action: https://github.com/pypa/gh-action-pypi-publish/issues/166 that does not allow to publish from reusable workflows. So we have to move it out. --- .github/workflows/build-push.yml | 21 ++++++++++++++++++++- .github/workflows/publish-manually.yml | 21 ++++++++++++++++++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-push.yml b/.github/workflows/build-push.yml index 9f77b89de..30c49fa2a 100644 --- a/.github/workflows/build-push.yml +++ b/.github/workflows/build-push.yml @@ -9,6 +9,25 @@ on: jobs: build-and-publish: + name: "Build wheels" uses: ./.github/workflows/lib-build-and-push.yml with: - upload: ${{ endsWith(github.event.ref, 'scylla') }} + upload: false + + # TODO: Remove when https://github.com/pypa/gh-action-pypi-publish/issues/166 is fixed and update build-and-publish.with.upload to ${{ endsWith(github.event.ref, 'scylla') }} + publish: + name: "Publish wheels to PyPi" + if: ${{ endsWith(github.event.ref, 'scylla') }} + needs: build-and-publish + runs-on: ubuntu-22.04 + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true diff --git a/.github/workflows/publish-manually.yml b/.github/workflows/publish-manually.yml index b022888ef..98327b735 100644 --- a/.github/workflows/publish-manually.yml +++ b/.github/workflows/publish-manually.yml @@ -35,10 +35,29 @@ on: jobs: build-and-publish: + name: "Build wheels" uses: ./.github/workflows/lib-build-and-push.yml with: - upload: ${{ inputs.upload }} + upload: false python-version: ${{ inputs.python-version }} ignore_tests: ${{ inputs.ignore_tests }} target_tag: ${{ inputs.target_tag }} target: ${{ inputs.target }} + + # TODO: Remove when https://github.com/pypa/gh-action-pypi-publish/issues/166 is fixed and update build-and-publish.with.upload to ${{ inputs.upload }} + publish: + name: "Publish wheels to PyPi" + needs: build-and-publish + if: inputs.upload + runs-on: ubuntu-22.04 + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true