From 83b0e7ce337aba13f2c0abdcefb891f5906447f0 Mon Sep 17 00:00:00 2001 From: Michael Matloka Date: Mon, 9 Oct 2023 11:01:28 +0200 Subject: [PATCH] Add some sudo in CI --- .github/CODEOWNERS | 5 +++- .github/actions/run-backend-tests/action.yml | 21 +++++++++++----- .vscode/launch.json | 25 ++++++++++++++++++++ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index c4ba157c2959cc..dcc5a35a85079b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,4 @@ -/posthog/clickhouse/migrations/** @fuziontech \ No newline at end of file +/posthog/clickhouse/migrations/ @fuziontech +# The below only needs to apply until parsing tests in CI are migrated from PyPI wheels of hogql-parser +# to the source code. This requires compilation of hogql-parser _in backend CI_, which is not yet the case. +/hogql_parser/ @Twixes diff --git a/.github/actions/run-backend-tests/action.yml b/.github/actions/run-backend-tests/action.yml index 5b53f2eb4a5ec3..8570a43fbd7440 100644 --- a/.github/actions/run-backend-tests/action.yml +++ b/.github/actions/run-backend-tests/action.yml @@ -49,6 +49,13 @@ runs: python-version: ${{ inputs.python-version }} token: ${{ inputs.token }} + - name: Determine if hogql-parser has changed compared to master + shell: bash + id: hogql-parser-diff + run: | + changed=$(git diff --quiet HEAD master -- hogql_parser/ && echo "false" || echo "true") + echo "::set-output name=changed::$changed" + - name: Install SAML (python3-saml) dependencies shell: bash run: | @@ -69,18 +76,20 @@ runs: pip install -r requirements.txt -r requirements-dev.txt - name: Install local hogql-parser + if: steps.hogql-parser-diff.outputs.changed == 'true' shell: bash - # This is not cached currently, as it's important to build the current HEAD version (we can't just look at - # requirements.txt, which only has the published version) and caching just one package is not worth the effort + # This is not cached currently, as it's important to build the current HEAD version of hogql-parser if it has + # changed (as requirements.txt only has the published version) run: | sudo apt-get install libboost-all-dev unzip cmake curl uuid pkg-config curl https://www.antlr.org/download/antlr4-cpp-runtime-4.13.1-source.zip --output antlr4-source.zip unzip antlr4-source.zip -d antlr4-source && cd antlr4-source - cmake . + cmake antlr4-source DESTDIR=out make install - cp -r out/usr/local/include/antlr4-runtime /usr/include/ - cp out/usr/local/lib/libantlr4-runtime.so* /usr/lib/ - ldconfig + sudo cp -r out/usr/local/include/antlr4-runtime /usr/include/ + sudo cp out/usr/local/lib/libantlr4-runtime.so* /usr/lib/ + sudo ldconfig + cd .. pip install ./hogql_parser - name: Set up needed files diff --git a/.vscode/launch.json b/.vscode/launch.json index 1624d13d056dc6..4f54c92b0d34f0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -4,6 +4,31 @@ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ + { + "name": "Pytest: Current File", + "type": "python", + "request": "launch", + "module": "pytest", + "args": ["${file}", "-vvv"], + "console": "integratedTerminal", + "justMyCode": true + }, + { + "name": "(lldb) Attach", + "type": "cppdbg", + "request": "attach", + "program": "/Users/twixes/.pyenv/versions/3.10.10/envs/posthog-3.10/bin/python", + "MIMode": "lldb" + }, + { + "name": "Python C++ Debugger", + "type": "pythoncpp", + "request": "launch", + "pythonConfig": "custom", + "pythonLaunchName": "Pytest: Current File", + "cppConfig": "custom", + "cppAttachName": "(lldb) Attach" + }, { "name": "Celery", "type": "python",