perf: Parse HogQL with C++ for a huge speedup #43
Workflow file for this run
This file contains 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 hogql-parser | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- hogql_parser/** | |
- .github/workflows/build-hogql-parser.yml | |
pull_request: | |
paths: | |
- hogql_parser/** | |
- .github/workflows/build-hogql-parser.yml | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
check-version: | |
name: Check version legitimacy | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Compare versions | |
shell: bash | |
run: | | |
published=$(curl -fSsl https://pypi.org/pypi/hogql-parser/json | jq -r '.info.version') | |
local=$(python hogql_parser/setup.py --version) | |
if [[ "$published" == "$local" ]]; then | |
echo "Version $local is already published on PyPI - update hogql_parser/setup.py" | |
exit 1 | |
fi | |
build-wheels: | |
name: Build wheels on ${{ matrix.os }} | |
needs: check-version | |
# if: github.ref == 'refs/heads/master' TODO: Only build on master once the containers build on ARM | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 120 # The Linux ARM builds are painfully slow | |
strategy: | |
matrix: | |
# ARM emulation is reasonably fast on macOS, but insanely slow (20x longer) on Linux runners | |
os: [ubuntu-22.04, buildjet-2vcpu-ubuntu-2204-arm, macos-12] | |
steps: | |
- uses: actions/checkout@v4 | |
- if: ${{ !endsWith(matrix.os, '-arm') }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- if: ${{ endsWith(matrix.os, '-arm') }} | |
uses: deadsnakes/[email protected] # Unfortunately actions/setup-python@v4 just doesn't work on ARM! This does | |
with: | |
python-version: '3.10' | |
- name: Build sdist | |
if: matrix.os == 'ubuntu-22.04' # Only build the sdist once | |
run: cd hogql_parser && python setup.py sdist | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel==2.16.* | |
- name: Build wheels | |
run: cd hogql_parser && python -m cibuildwheel --output-dir dist | |
env: | |
MACOSX_DEPLOYMENT_TARGET: '12' # A modern target allows us to use C++20 | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: | | |
hogql_parser/dist/*.whl | |
hogql_parser/dist/*.tar.gz | |
if-no-files-found: error | |
publish: | |
name: Publish on PyPI | |
needs: build-wheels | |
environment: pypi-hogql-parser | |
permissions: | |
id-token: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Fetch wheels | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist/ | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |