From 2ac85e1bc5bba7f4c0874cea8c9c4b7270e5023a Mon Sep 17 00:00:00 2001 From: PrimozGodec Date: Thu, 21 Mar 2024 15:56:34 +0100 Subject: [PATCH] [CI] Use reusable wokflow for automated release --- .github/workflows/build_wheels.yml | 138 ----------------------------- .github/workflows/release.yml | 13 +++ pyproject.toml | 14 --- 3 files changed, 13 insertions(+), 152 deletions(-) delete mode 100644 .github/workflows/build_wheels.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml deleted file mode 100644 index e1660b2..0000000 --- a/.github/workflows/build_wheels.yml +++ /dev/null @@ -1,138 +0,0 @@ -name: Build wheels - -on: - release: - types: [published] - - # Enable manual run - workflow_dispatch: - -jobs: - generate-wheels-matrix: - # Create a matrix of all architectures & versions to build. - # This enables the next step to run cibuildwheel in parallel. - # From https://iscinumpy.dev/post/cibuildwheel-2-10-0/#only-210 - name: Generate wheels matrix - runs-on: ubuntu-latest - outputs: - include: ${{ steps.set-matrix.outputs.include }} - steps: - - uses: actions/checkout@v3 - - name: Install cibuildwheel - # Nb. keep cibuildwheel version pin consistent with job below - run: pipx install cibuildwheel==2.14.1 - - id: set-matrix - run: | - MATRIX=$( - { - cibuildwheel --print-build-identifiers --platform linux \ - | jq -nRc '{"only": inputs, "os": "ubuntu-latest"}' \ - && cibuildwheel --print-build-identifiers --platform macos \ - | jq -nRc '{"only": inputs, "os": "macos-latest"}' \ - && cibuildwheel --print-build-identifiers --platform windows \ - | jq -nRc '{"only": inputs, "os": "windows-latest"}' - } | jq -sc - ) - echo "include=$MATRIX" >> $GITHUB_OUTPUT - - build_wheels: - name: Build ${{ matrix.only }} - needs: generate-wheels-matrix - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: ${{ fromJson(needs.generate-wheels-matrix.outputs.include) }} - - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - - name: Set up QEMU - if: runner.os == 'Linux' - uses: docker/setup-qemu-action@v2 - with: - platforms: all - - - name: Build wheels - uses: pypa/cibuildwheel@v2.14.1 - with: - only: ${{ matrix.only }} - - - uses: actions/upload-artifact@v2 - with: - path: ./wheelhouse/*.whl - name: bdist_files - - build_sdist: - name: Build source distribution - runs-on: ubuntu-20.04 - steps: - - name: Check out the repo - uses: actions/checkout@v2 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 - - - name: Build sdist (pep517) - run: | - python -m pip install pep517 - python -m pep517.build -s . - - - name: Upload sdist - uses: actions/upload-artifact@v2 - with: - name: sdist_files - path: dist/*.tar.gz - - upload_release_assets: - name: Upload Release Assets - needs: [build_wheels] - runs-on: ubuntu-20.04 - if: startsWith(github.ref, 'refs/tags') - - steps: - - name: Download bdist files - id: download_artifact - uses: actions/download-artifact@v2 - with: - name: bdist_files - path: ~/downloads - - - name: List downloaded artifacts - run: ls -la ~/downloads - - - name: Upload to release - uses: shogo82148/actions-upload-release-asset@v1.2.3 - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ steps.download_artifact.outputs.download-path }}/*.whl - - pypi_publish: - name: PyPI Publish - needs: [build_wheels, build_sdist] - runs-on: ubuntu-20.04 - if: startsWith(github.ref, 'refs/tags') - - steps: - - name: Download bdist files - uses: actions/download-artifact@v2 - with: - name: bdist_files - path: downloads/ - - - name: Download sdist files - uses: actions/download-artifact@v2 - with: - name: sdist_files - path: downloads/ - - - name: Display structure of downloaded files - run: ls -R downloads/ - - - name: Publish packages to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - packages_dir: downloads/ diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..10fbc0e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,13 @@ +name: Release +on: + release: + types: [published] + workflow_dispatch: + pull_request: + +jobs: + release: + uses: biolab/orange-ci-cd/.github/workflows/release.yml@master + with: + pure-python: false + secrets: inherit diff --git a/pyproject.toml b/pyproject.toml index 4910d95..d5807f1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,17 +4,3 @@ requires = [ 'wheel', ] build-backend = 'setuptools.build_meta' - -[tool.cibuildwheel] -# todo: skipping cp311 since _fpgrowth not compatible, fix it and then enalbe cp311 -skip = ["cp36-*", "cp37-*", "cp38-*", "cp311-*", "pp*", "*-musllinux_*"] -build-verbosity = 2 - -[tool.cibuildwheel.linux] -archs = ["x86_64", "aarch64"] - -[tool.cibuildwheel.windows] -archs = ["AMD64"] - -[tool.cibuildwheel.macos] -archs = ["x86_64", "arm64"] \ No newline at end of file