From d484c2cc03ca23fdcf7ac7d5c2dd9f0aa86cf20e Mon Sep 17 00:00:00 2001 From: Yefu Wang <1yefuwang1@gmail.com> Date: Mon, 1 Jul 2024 22:55:52 +0800 Subject: [PATCH] cleanup workflows --- .github/workflows/build-wheel.yml | 50 -------------- .github/workflows/ci.yml | 104 +++++++++++++++++++++++++++++ .github/workflows/upload-wheel.yml | 49 -------------- 3 files changed, 104 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/build-wheel.yml create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/upload-wheel.yml diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml deleted file mode 100644 index 5991990..0000000 --- a/.github/workflows/build-wheel.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Build wheels - -on: [workflow_dispatch] - -jobs: - build_wheels: - name: Build wheels on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14] - # os: [ubuntu-latest, macos-13, macos-14] - # os: [windows-latest] - - steps: - - uses: actions/checkout@v4 - - - uses: benjlevesque/short-sha@v3.0 - id: short_sha - - # Used to host cibuildwheel - - uses: actions/setup-python@v5 - - - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.19.1 pipx pytest apsw numpy - - - uses: ilammy/msvc-dev-cmd@v1 - - - name: Setup cmake - uses: jwlawson/actions-setup-cmake@v2 - - - name: Setup Ninja - uses: seanmiddleditch/gha-setup-ninja@v5 - - - name: Bootstrap vcpkg - run: | - git submodule update --init --recursive - python bootstrap_vcpkg.py - - - name: Build wheels - run: pipx run cibuildwheel --output-dir wheelhouse - - - name: Short SHA - shell: bash - run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - - uses: actions/upload-artifact@v4 - with: - name: vectorlite-${{ matrix.os }}-${{ steps.short_sha.outputs.sha }} - path: ./wheelhouse/*.whl \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..f15bb55 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,104 @@ +name: CI + +on: + workflow_dispatch: + inputs: + upload_wheel: + description: 'whether/where to upload the wheel' + required: false + default: 'no' + type: 'choice' + options: ['no', 'pypi', 'testpypi'] + + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + # os: [ubuntu-latest, macos-13, macos-14] + # os: [windows-latest] + + steps: + - uses: actions/checkout@v4 + + - uses: benjlevesque/short-sha@v3.0 + id: short_sha + + # Used to host cibuildwheel + - uses: actions/setup-python@v5 + + - name: Install cibuildwheel + run: python -m pip install cibuildwheel==2.19.1 pytest apsw numpy + + - uses: ilammy/msvc-dev-cmd@v1 + + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v2 + + - name: Setup Ninja + uses: seanmiddleditch/gha-setup-ninja@v5 + + - name: Bootstrap vcpkg + run: | + git submodule update --init --recursive + python bootstrap_vcpkg.py + + - name: Build wheels + run: python -m cibuildwheel --output-dir wheelhouse + + - name: Short SHA + shell: bash + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + + - uses: actions/upload-artifact@v4 + with: + name: vectorlite-wheel-${{ matrix.os }}-${{ steps.short_sha.outputs.sha }} + path: ./wheelhouse/*.whl + + - uses: actions/upload-artifact@v4 + with: + name: vectorlite-${{ matrix.os }}-${{ steps.short_sha.outputs.sha }} + path: ./build/release/vectorlite.* + + upload_wheels: + name: Upload wheels + if: ${{ github.event.inputs.upload_wheel != 'no' }} + runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-13, macos-14] + + steps: + - uses: actions/checkout@v4 + + - uses: benjlevesque/short-sha@v3.0 + id: short_sha + + # Download artifact + - uses: actions/download-artifact@v4 + with: + name: vectorlite-wheel-${{ matrix.os }}-${{ steps.short_sha.outputs.sha }} + path: ./wheelhouse + + - name: Upload to test.pypi.org + if: ${{ github.event.inputs.upload_wheel == 'testpypi' }} + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} + run: pipx run twine upload --repository testpypi wheelhouse/*.whl + + - name: Upload to pypi.org + if: ${{ github.event.inputs.upload_wheel == 'pypi' && startsWith(github.ref, 'refs/tags/v') }} + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: pipx run twine upload wheelhouse/*.whl + + - name: Fail if uploading to pypi.org without a tag + if: ${{ github.event.inputs.upload_wheel == 'pypi' && !startsWith(github.ref, 'refs/tags/v') }} + run: | + echo "Error: Uploading to pypi.org requires a tag" + exit 1 \ No newline at end of file diff --git a/.github/workflows/upload-wheel.yml b/.github/workflows/upload-wheel.yml deleted file mode 100644 index 198ff80..0000000 --- a/.github/workflows/upload-wheel.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Upload wheels - -on: - workflow_dispatch: - inputs: - pypi_test: - description: 'Upload to test.pypi.org' - required: false - default: 'true' - type: 'boolean' - -jobs: - upload_wheels: - name: Upload wheels - runs-on: ubuntu-latest - strategy: - matrix: - os: [ubuntu-latest, windows-latest, macos-13, macos-14] - - steps: - - uses: actions/checkout@v4 - - - uses: benjlevesque/short-sha@v3.0 - id: short_sha - - # Download artifact - - uses: actions/download-artifact@v4 - with: - name: vectorlite-${{ matrix.os }}-${{ steps.short_sha.outputs.sha }} - path: ./wheelhouse - - - uses: actions/setup-python@v5 - - - name: Install twine - run: python -m pip install twine - - - name: Upload to test.pypi.org - if: ${{ github.event.inputs.pypi_test == 'true' }} - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} - run: python -m twine upload --repository testpypi wheelhouse/*.whl - - - name: Upload to pypi.org - if: ${{ github.event.inputs.pypi_test == 'false' }} - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: python -m twine upload wheelhouse/*.whl