ENH: update commit hash in flowy.wrap #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build on every branch push, tag push, and pull request change: | |
| # Sources: | |
| # https://github.com/pypa/cibuildwheel/blob/main/examples/github-deploy.yml | |
| # https://github.com/airspeed-velocity/asv/blob/main/.github/workflows/build_wheels.yml | |
| # include [wheel build] in the commit to trigger wheel builds | |
| name: Build wheels | |
| on: [push, pull_request, workflow_dispatch] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| jobs: | |
| get_commit_message: | |
| name: Get commit message | |
| runs-on: ubuntu-latest | |
| if: "github.repository == 'flowy-code/pyflowy'" | |
| outputs: | |
| message: ${{ steps.commit_message.outputs.message }} | |
| steps: | |
| - name: Checkout project | |
| uses: actions/checkout@v4 | |
| # Gets the correct commit message for pull request | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Get commit message | |
| id: commit_message | |
| run: | | |
| set -xe | |
| COMMIT_MSG=$(git log --no-merges -1 --oneline) | |
| echo "message=$COMMIT_MSG" >> $GITHUB_OUTPUT | |
| echo github.ref ${{ github.ref }} | |
| build_wheels: | |
| name: Build wheels | |
| needs: get_commit_message | |
| if: >- | |
| contains(needs.get_commit_message.outputs.message, '[wheel build]') || | |
| github.event_name == 'schedule' || | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0'))) | |
| runs-on: ${{ matrix.buildplat[0] }} | |
| strategy: | |
| # Ensure that a wheel builder finishes even if another fails | |
| fail-fast: false | |
| matrix: | |
| # From NumPy | |
| # Github Actions doesn't support pairing matrix values together, let's improvise | |
| # https://github.com/github/feedback/discussions/7835#discussioncomment-1769026 | |
| buildplat: | |
| # TODO(rg): This needs to be pruned | |
| # This will build all 21 (many,musl)linux related wheels (64, 32), for supported pythons 3.9, 3.10, 3.11, 3.12, pypy 3.9, pypy 3.10 | |
| - [ubuntu-20.04, manylinux_x86_64] | |
| # - [ubuntu-20.04, musllinux_x86_64] | |
| # TODO(rg): Handle these later via indirection | |
| # - [macos-12, macosx_x86_64] | |
| # - [macos-12, macosx_arm64] | |
| # - [windows-2019, win_amd64] | |
| python-version: ['3.11'] # This is the python version of the CI, not related to the ones built by cibuildwheel | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Echo Python version and build platform | |
| run: echo Building wheel for ${{ matrix.python-version }}-${{ matrix.buildplat[1] }} | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@v2.16.5 | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| path: ./wheelhouse/*.whl | |
| build_sdist: | |
| name: Build source distribution | |
| needs: get_commit_message | |
| if: >- | |
| contains(needs.get_commit_message.outputs.message, '[wheel build]') || | |
| github.event_name == 'schedule' || | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && ( ! endsWith(github.ref, 'dev0'))) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: sudo apt-get install libnetcdf-dev libfmt-dev libxtensor-dev libxtensor-blas-dev | |
| - name: Build sdist | |
| shell: bash -l {0} | |
| run: pipx run build --sdist | |
| - uses: actions/upload-artifact@v3 | |
| with: | |
| path: dist/*.tar.gz |