fix(clickhouse): skip UPDATE/DELETE round-trips (no standard syntax) … #40
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: | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| LUA_PATH: "./?.lua;./?/init.lua;;" | |
| jobs: | |
| lint: | |
| name: lint (luacheck) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: "5.4" | |
| - uses: leafo/gh-actions-luarocks@v4 | |
| - run: luarocks install luacheck | |
| - run: luacheck lua_SQLBuilder spec | |
| unit: | |
| name: unit (Lua ${{ matrix.lua }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua: ["5.1", "5.2", "5.3", "5.4", "luajit-2.1"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: ${{ matrix.lua }} | |
| - uses: leafo/gh-actions-luarocks@v4 | |
| - name: Run unit specs (pure SQL generation, no DB) | |
| run: | | |
| if [ "${{ matrix.lua }}" = "luajit-2.1" ]; then | |
| # LuaJIT cannot load luarocks' large manifests (>65536 constants); | |
| # the zero-dependency runner needs no rocks at all. | |
| lua spec/run.lua spec/unit spec/audit spec/production | |
| else | |
| luarocks install busted | |
| busted --helper=spec/helpers/init.lua spec/unit spec/audit spec/production | |
| fi | |
| integration-sqlite: | |
| name: sqlite integration (Lua ${{ matrix.lua }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua: ["5.1", "5.2", "5.3", "5.4"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: ${{ matrix.lua }} | |
| - uses: leafo/gh-actions-luarocks@v4 | |
| - run: luarocks install busted | |
| - name: Install sqlite driver | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libsqlite3-dev | |
| luarocks install lsqlite3 | |
| - name: Run integration specs against in-process SQLite | |
| run: busted --helper=spec/helpers/init.lua spec/integration | |
| env: | |
| LUA_SQLBUILDER_DB: sqlite | |
| integration-duckdb: | |
| name: duckdb integration (Lua ${{ matrix.lua }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua: ["5.1", "5.2", "5.3", "5.4"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: ${{ matrix.lua }} | |
| - uses: leafo/gh-actions-luarocks@v4 | |
| - run: luarocks install busted | |
| - name: Install duckdb prebuilt lib (official release asset) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wget unzip build-essential | |
| cd /tmp | |
| wget -q https://github.com/duckdb/duckdb/releases/download/v1.5.5/libduckdb-linux-amd64.zip | |
| mkdir -p /tmp/duckdb-lib && cd /tmp/duckdb-lib | |
| unzip -o ../libduckdb-linux-amd64.zip | |
| ls -la | |
| # luasql-duckdb expects DUCKDB_DIR/include + DUCKDB_DIR/lib | |
| sudo mkdir -p /opt/duckdb/include /opt/duckdb/lib | |
| sudo cp duckdb.h /opt/duckdb/include/ | |
| sudo cp libduckdb.so /opt/duckdb/lib/ | |
| sudo sh -c 'echo /opt/duckdb/lib > /etc/ld.so.conf.d/duckdb.conf' | |
| sudo ldconfig | |
| luarocks install luasql-duckdb DUCKDB_DIR=/opt/duckdb | |
| - name: Run integration specs against in-process DuckDB | |
| run: busted --helper=spec/helpers/init.lua spec/integration | |
| env: | |
| LUA_SQLBUILDER_DB: duckdb | |
| integration-clickhouse: | |
| name: clickhouse integration (Lua ${{ matrix.lua }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua: ["5.1", "5.4"] | |
| services: | |
| clickhouse: | |
| image: clickhouse/clickhouse-server:24.8 | |
| env: | |
| CLICKHOUSE_PASSWORD: clickhouse | |
| ports: ["8123:8123"] | |
| options: >- | |
| --health-cmd="clickhouse-client --password clickhouse --query 'SELECT 1'" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: ${{ matrix.lua }} | |
| - uses: leafo/gh-actions-luarocks@v4 | |
| - run: luarocks install busted | |
| - name: Install clickhouse HTTP deps (luasocket + cjson) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libssl-dev | |
| luarocks install luasocket | |
| luarocks install lua-cjson | |
| - name: Diagnose clickhouse reachability | |
| run: | | |
| curl -s -u default:clickhouse --data "SELECT 1" http://127.0.0.1:8123/ || echo "curl failed" | |
| - name: Run integration specs against ClickHouse over HTTP | |
| run: busted --helper=spec/helpers/init.lua spec/integration | |
| env: | |
| LUA_SQLBUILDER_DB: clickhouse | |
| CLICKHOUSE_HOST: 127.0.0.1 | |
| CLICKHOUSE_PORT: "8123" | |
| integration-oracle: | |
| name: oracle integration (Lua ${{ matrix.lua }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua: ["5.4"] | |
| services: | |
| oracle: | |
| image: gvenzl/oracle-free:23-slim | |
| env: | |
| ORACLE_PASSWORD: app | |
| APP_USER: app | |
| APP_USER_PASSWORD: app | |
| ports: ["1521:1521"] | |
| options: >- | |
| --health-cmd="healthcheck.sh" | |
| --health-interval=10s | |
| --health-timeout=10s | |
| --health-retries=30 | |
| --health-start-period=60s | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: ${{ matrix.lua }} | |
| - uses: leafo/gh-actions-luarocks@v4 | |
| - run: luarocks install busted | |
| - name: Install Oracle Instant Client + luasql-oci8 (best-effort) | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y wget unzip | |
| sudo mkdir -p /opt/oracle/instantclient | |
| cd /opt/oracle/instantclient | |
| wget -q https://download.oracle.com/otn_software/linux/instantclient/2114000/instantclient-basiclite-linux.x64-21.14.0.0.0dbru.zip || true | |
| wget -q https://download.oracle.com/otn_software/linux/instantclient/2114000/instantclient-sdk-linux.x64-21.14.0.0.0dbru.zip || true | |
| for z in *.zip; do [ -f "$z" ] && sudo unzip -o "$z"; done | |
| ls -la /opt/oracle/instantclient/instantclient_21_14/ 2>/dev/null | head -5 || echo "OCI dir missing" | |
| sudo sh -c 'echo /opt/oracle/instantclient/instantclient_21_14 > /etc/ld.so.conf.d/oracle.conf' | |
| sudo ldconfig || true | |
| export LD_LIBRARY_PATH=/opt/oracle/instantclient/instantclient_21_14:$LD_LIBRARY_PATH | |
| if [ -f /opt/oracle/instantclient/instantclient_21_14/sdk/include/oci.h ]; then | |
| luarocks install luasql-oci8 \ | |
| OCI8_INCDIR=/opt/oracle/instantclient/instantclient_21_14/sdk/include \ | |
| OCI8_LIBDIR=/opt/oracle/instantclient/instantclient_21_14 | |
| else | |
| echo "OCI SDK headers missing - skipping luasql-oci8 install" | |
| fi | |
| - name: Run integration specs against Oracle | |
| run: busted --helper=spec/helpers/init.lua spec/integration | |
| env: | |
| LD_LIBRARY_PATH: /opt/oracle/instantclient/instantclient_21_14 | |
| LUA_SQLBUILDER_DB: oracle | |
| ORACLE_USER: app | |
| ORACLE_PASSWORD: app | |
| ORACLE_HOST: 127.0.0.1 | |
| ORACLE_PORT: "1521" | |
| ORACLE_SERVICE: FREEPDB1 | |
| integration-servers: | |
| name: ${{ matrix.db }} integration (Lua ${{ matrix.lua }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| lua: ["5.1", "5.2", "5.3", "5.4"] | |
| db: [mysql, postgres] | |
| services: | |
| mysql: | |
| image: mysql:8.0 | |
| env: | |
| MYSQL_ROOT_PASSWORD: root | |
| MYSQL_DATABASE: sqlbuilder_test | |
| ports: ["3306:3306"] | |
| options: >- | |
| --health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -proot" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=20 | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: sqlbuilder_test | |
| # trust auth: no crypto needed. pgmoon's md5 AND scram both require | |
| # luaossl/LuaCrypto (openssl); luaossl does not build on OpenSSL 3. | |
| # Server-side scram-stored passwords force SCRAM even with md5 in | |
| # pg_hba, so trust is the only zero-crypto option for CI. | |
| POSTGRES_HOST_AUTH_METHOD: trust | |
| ports: ["5432:5432"] | |
| options: >- | |
| --health-cmd="pg_isready -U postgres -h 127.0.0.1" | |
| --health-interval=5s | |
| --health-timeout=5s | |
| --health-retries=20 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: leafo/gh-actions-lua@v13 | |
| with: | |
| luaVersion: ${{ matrix.lua }} | |
| - uses: leafo/gh-actions-luarocks@v4 | |
| - run: luarocks install busted | |
| - name: Install DB drivers | |
| run: | | |
| sudo apt-get update | |
| if [ "${{ matrix.db }}" = "mysql" ]; then | |
| sudo apt-get install -y libmysqlclient-dev | |
| luarocks install luasql-mysql MYSQL_INCDIR=/usr/include/mysql MYSQL_LIBDIR=/usr/lib/x86_64-linux-gnu | |
| else | |
| # pgmoon is pure Lua; trust auth needs no crypto rock | |
| # (luaossl does not build against OpenSSL 3) | |
| sudo apt-get install -y libssl-dev | |
| luarocks install luasocket | |
| luarocks install lua-cjson | |
| luarocks install pgmoon | |
| fi | |
| - name: Run integration specs against ${{ matrix.db }} | |
| run: busted --helper=spec/helpers/init.lua spec/integration | |
| env: | |
| LUA_SQLBUILDER_DB: ${{ matrix.db }} | |
| MYSQL_HOST: 127.0.0.1 | |
| MYSQL_PORT: "3306" | |
| MYSQL_USER: root | |
| MYSQL_PASSWORD: root | |
| MYSQL_DATABASE: sqlbuilder_test | |
| POSTGRES_HOST: 127.0.0.1 | |
| POSTGRES_PORT: "5432" | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DATABASE: sqlbuilder_test |