From 4f0f1432695658b2642c4d44c507d32d45ba94c7 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 12 Feb 2025 14:09:01 -0300 Subject: [PATCH 1/5] fix: add workflow and pypi test job --- .github/workflows/build_assets.yml | 21 ++++++++++--------- .github/workflows/build_for_pypi.yml | 30 +++++++++++++++++++++------- 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build_assets.yml b/.github/workflows/build_assets.yml index ca757c801..53b55dc78 100644 --- a/.github/workflows/build_assets.yml +++ b/.github/workflows/build_assets.yml @@ -2,13 +2,12 @@ name: Build Compiled Assets on: - pull_request: - branches: - - main - push: - # Pattern matched against refs/tags - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + workflow_call: + inputs: + release: + type: boolean + default: false + description: "Attach artifacts to a release" jobs: build_assets: @@ -69,12 +68,12 @@ jobs: run: ${{matrix.CMD_BUILD}} - name: Upload a Build Artifact uses: actions/upload-artifact@v4 - if: github.ref_type == 'tag' + if: inputs.release == false with: name: ${{ matrix.OUT_FILE_NAME }} path: ./dist/${{ matrix.OUT_FILE_NAME }} - name: Upload Release Asset - if: github.ref_type == 'tag' + if: inputs.release == true id: upload-release-asset uses: svenstaro/upload-release-action@v2 with: @@ -119,12 +118,12 @@ jobs: ./scripts/build_${{ matrix.distro_name }}_arm.sh ${{ matrix.distro_name }}_${{ matrix.arch }} - name: Upload a Build Artifact uses: actions/upload-artifact@v4 - if: github.ref_type == 'tag' + if: inputs.release == false with: name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} path: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }} - name: Upload Release Asset - if: github.ref_type == 'tag' + if: inputs.release == true id: upload-release-asset uses: svenstaro/upload-release-action@v2 with: diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index b265bbde8..dfc33995b 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -3,12 +3,13 @@ name: Build and Optionally Publish to PyPi on: pull_request: - branches: - - main - push: - # Pattern matched against refs/tags - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' + branches: main + workflow_call: + inputs: + publish: + type: boolean + default: false + description: "Publish to PyPi" jobs: build_src_for_pypi: @@ -64,9 +65,24 @@ jobs: name: cibw-wheels-${{ matrix.os }} path: ./wheelhouse/*.whl + test_publish_to_pypi: + if: inputs.publish == false || true + needs: + - build_dist_for_pypi + - build_src_for_pypi + runs-on: ubuntu-latest + steps: + - name: Download artifacts + uses: actions/download-artifact@v4 + with: + pattern: cibw-* + - name: Display artifacts + run: | + ls -alrt + ls -alrt dist/ publish_to_pypi: - if: github.ref_type == 'tag' + if: inputs.publish == true || false needs: - build_dist_for_pypi - build_src_for_pypi From d1acd7b9b8ac7bd5f4464018585b70549d321b0e Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 12 Feb 2025 14:44:49 -0300 Subject: [PATCH 2/5] fix: true ls --- .github/workflows/build_for_pypi.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index dfc33995b..be94c3a05 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -78,8 +78,7 @@ jobs: pattern: cibw-* - name: Display artifacts run: | - ls -alrt - ls -alrt dist/ + ls -alrt */* publish_to_pypi: if: inputs.publish == true || false From 32864c0620ccc6b356479c94fc612c83e2614ad4 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 12 Feb 2025 14:56:10 -0300 Subject: [PATCH 3/5] fix: add path --- .github/workflows/build_for_pypi.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index be94c3a05..5c423449f 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -76,12 +76,12 @@ jobs: uses: actions/download-artifact@v4 with: pattern: cibw-* + path: dist/ - name: Display artifacts run: | - ls -alrt */* + ls -alrt */*/* publish_to_pypi: - if: inputs.publish == true || false needs: - build_dist_for_pypi - build_src_for_pypi @@ -95,8 +95,13 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: + path: dist/ pattern: cibw-* + - name: Display artifacts + run: | + ls -alrt */*/* - name: Publish package to PyPi + if: inputs.publish == true || false uses: pypa/gh-action-pypi-publish@release/v1 with: verbose: true From b0f0075f29921362363bcdf491495330ffaefb09 Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 12 Feb 2025 15:16:19 -0300 Subject: [PATCH 4/5] fix: update release process --- .github/workflows/build_for_pypi.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 5c423449f..4e1f256fd 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -65,22 +65,6 @@ jobs: name: cibw-wheels-${{ matrix.os }} path: ./wheelhouse/*.whl - test_publish_to_pypi: - if: inputs.publish == false || true - needs: - - build_dist_for_pypi - - build_src_for_pypi - runs-on: ubuntu-latest - steps: - - name: Download artifacts - uses: actions/download-artifact@v4 - with: - pattern: cibw-* - path: dist/ - - name: Display artifacts - run: | - ls -alrt */*/* - publish_to_pypi: needs: - build_dist_for_pypi From 84876b161aef051e861f2abcce7cb646c4a70f9d Mon Sep 17 00:00:00 2001 From: Tom Hu Date: Wed, 12 Feb 2025 15:24:07 -0300 Subject: [PATCH 5/5] fix: publish only --- .github/workflows/build_for_pypi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_for_pypi.yml b/.github/workflows/build_for_pypi.yml index 4e1f256fd..49603f1b2 100644 --- a/.github/workflows/build_for_pypi.yml +++ b/.github/workflows/build_for_pypi.yml @@ -66,6 +66,7 @@ jobs: path: ./wheelhouse/*.whl publish_to_pypi: + if: inputs.publish == true || false needs: - build_dist_for_pypi - build_src_for_pypi @@ -85,7 +86,6 @@ jobs: run: | ls -alrt */*/* - name: Publish package to PyPi - if: inputs.publish == true || false uses: pypa/gh-action-pypi-publish@release/v1 with: verbose: true