feat: Add prebuilt tree-sitter grammars for Semble #11
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| jobs: | |
| quality: | |
| name: Run quality checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - run: uv sync --all-extras | |
| - run: | | |
| make lint | |
| make typecheck | |
| build-linux: | |
| name: Build Linux grammars | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - run: npm install -g tree-sitter-cli@0.26.11 | |
| - run: uv run --no-project python scripts/build_grammars.py | |
| - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 | |
| with: | |
| name: grammar-linux | |
| path: src/semble_grammars/grammars | |
| test-linux: | |
| name: Test Linux (Python ${{ matrix.python-version }}) | |
| needs: build-linux | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 | |
| with: | |
| name: grammar-linux | |
| path: src/semble_grammars/grammars | |
| - run: uv sync --all-extras | |
| - run: make test | |
| - if: matrix.python-version == '3.13' | |
| uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| test-windows: | |
| name: Build and test ${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: windows-x86_64 | |
| runner: windows-latest | |
| - platform: windows-arm64 | |
| runner: windows-11-arm | |
| runs-on: ${{ matrix.runner }} | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - run: npm install -g tree-sitter-cli@0.26.11 | |
| - name: Install MinGW-w64 | |
| if: matrix.platform == 'windows-x86_64' | |
| run: choco install mingw --no-progress -y | |
| - shell: bash | |
| run: uv run --no-project python scripts/build_grammars.py | |
| - run: uv sync --all-extras | |
| - shell: bash | |
| run: make test | |
| test-macos: | |
| name: Build and test ${{ matrix.platform }} | |
| strategy: | |
| fail-fast: false | |
| 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 | |
| - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 | |
| with: | |
| python-version: "3.13" | |
| - uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - run: npm install -g tree-sitter-cli@0.26.11 | |
| - run: uv run --no-project python scripts/build_grammars.py | |
| - run: uv sync --all-extras | |
| - run: make test | |
| test-linux-arm64: | |
| name: Build and test Linux arm64 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0 | |
| - uses: astral-sh/setup-uv@d0d8abe699bfb85fec6de9f7adb5ae17292296ff | |
| - name: Build grammar bundle for linux-arm64 | |
| run: | | |
| uv run --no-project 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 --no-project 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 | |
| ' |