Release to PyPI #4
Workflow file for this run
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
| name: Release to PyPI | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-macos: | |
| name: Build ${{ matrix.platform }} wheel | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: macos-arm64 | |
| runner: macos-15 | |
| - platform: macos-x86_64 | |
| runner: macos-15-intel | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - name: Install tree-sitter CLI | |
| run: npm install -g tree-sitter-cli@0.26.11 | |
| - name: Build grammar bundle for ${{ matrix.platform }} | |
| run: uv run python scripts/build_grammars.py | |
| - name: Build platform wheel | |
| run: uv run python scripts/build_wheels.py | |
| - name: Smoke test built wheel | |
| run: uv run --with $(ls dist/*.whl) --no-project python tests/verify_installed_wheel.py | |
| - name: Upload dist | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 | |
| with: | |
| name: dist-${{ matrix.platform }} | |
| path: dist/*.whl | |
| build-linux-x86_64: | |
| name: Build linux-x86_64 wheel | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - name: Build grammar bundle for linux-x86_64 | |
| run: | | |
| uv run python -c " | |
| import sys | |
| sys.path.insert(0, 'scripts') | |
| import build_grammars as bg | |
| target = next(t for t in bg.DOCKER_TARGETS if t[0] == 'linux-x86_64') | |
| bg.build_via_docker(*target) | |
| " | |
| - name: Build platform wheel | |
| run: uv run python scripts/build_wheels.py | |
| - name: Smoke test linux-x86_64 wheel on manylinux2014 | |
| run: | | |
| docker run --rm --platform linux/amd64 \ | |
| -v "$PWD:/repo" -w /repo \ | |
| quay.io/pypa/manylinux2014_x86_64 \ | |
| bash -c ' | |
| set -euo pipefail | |
| curl -LsSf https://astral.sh/uv/0.11.30/install.sh \ | |
| | env UV_UNMANAGED_INSTALL=/usr/local/bin sh | |
| uv run --python /opt/python/cp311-cp311/bin/python \ | |
| --with /repo/dist/*manylinux2014_x86_64.whl \ | |
| --no-project python /repo/tests/verify_installed_wheel.py | |
| ' | |
| - name: Upload dist | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 | |
| with: | |
| name: dist-linux-x86_64 | |
| path: dist/*.whl | |
| build-linux-arm64: | |
| name: Build linux-arm64 wheel | |
| runs-on: ubuntu-24.04-arm | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - name: Build grammar bundle for linux-arm64 | |
| run: | | |
| uv run python -c " | |
| import sys | |
| sys.path.insert(0, 'scripts') | |
| import build_grammars as bg | |
| target = next(t for t in bg.DOCKER_TARGETS if t[0] == 'linux-arm64') | |
| bg.build_via_docker(*target) | |
| " | |
| - name: Build platform wheel | |
| run: uv run python scripts/build_wheels.py | |
| - name: Smoke test linux-arm64 wheel on manylinux2014 | |
| run: | | |
| docker run --rm --platform linux/arm64 \ | |
| -v "$PWD:/repo" -w /repo \ | |
| quay.io/pypa/manylinux2014_aarch64 \ | |
| bash -c ' | |
| set -euo pipefail | |
| curl -LsSf https://astral.sh/uv/0.11.30/install.sh \ | |
| | env UV_UNMANAGED_INSTALL=/usr/local/bin sh | |
| uv run --python /opt/python/cp311-cp311/bin/python \ | |
| --with /repo/dist/*manylinux2014_aarch64.whl \ | |
| --no-project python /repo/tests/verify_installed_wheel.py | |
| ' | |
| - name: Upload dist | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 | |
| with: | |
| name: dist-linux-arm64 | |
| path: dist/*.whl | |
| build-windows: | |
| name: Build ${{ matrix.platform }} wheel | |
| strategy: | |
| matrix: | |
| include: | |
| - platform: windows-x86_64 | |
| runner: windows-latest | |
| msvc_arch: amd64 | |
| - platform: windows-arm64 | |
| runner: windows-11-arm | |
| msvc_arch: amd64_arm64 | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - name: Install tree-sitter CLI | |
| shell: bash | |
| run: npm install -g tree-sitter-cli@0.26.11 | |
| - name: Setup MSVC (${{ matrix.msvc_arch }}) | |
| uses: ilammy/msvc-dev-cmd@7defe9254715b088f12dddd9942945a3d75cdad5 # v1.9.0 | |
| with: | |
| arch: ${{ matrix.msvc_arch }} | |
| - name: Build grammar bundle for ${{ matrix.platform }} | |
| shell: pwsh | |
| run: uv run python scripts/build_grammars.py | |
| - name: Build platform wheel | |
| shell: bash | |
| run: uv run python scripts/build_wheels.py | |
| - name: Smoke test built wheel | |
| shell: bash | |
| run: uv run --with $(ls dist/*.whl) --no-project python tests/verify_installed_wheel.py | |
| - name: Upload dist | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 | |
| with: | |
| name: dist-${{ matrix.platform }} | |
| path: dist/*.whl | |
| publish: | |
| name: Publish to PyPI | |
| needs: [build-macos, build-linux-x86_64, build-linux-arm64, build-windows] | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download dist | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 | |
| with: | |
| pattern: dist-* | |
| path: dist/ | |
| merge-multiple: true | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b |