refactor: rewrite #65
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: Check | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.ref }}-${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| style: | |
| runs-on: "ubuntu-24.04" | |
| steps: | |
| - name: Set up Environment | |
| run: | | |
| curl -fsSL https://github.com/tamasfe/taplo/releases/download/0.10.0/taplo-linux-$(uname -m).gz | gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo | |
| curl -fsSL https://github.com/EmbarkStudios/cargo-deny/releases/download/0.18.9/cargo-deny-0.18.9-$(uname -m)-unknown-linux-musl.tar.gz | tar -xOzf - cargo-deny-0.18.9-$(uname -m)-unknown-linux-musl/cargo-deny | install -m 755 /dev/stdin /usr/local/bin/cargo-deny | |
| - name: Install Rust | |
| run: rustup update | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Typos | |
| uses: crate-ci/typos@master | |
| - name: Taplo | |
| run: taplo fmt --check | |
| - name: Rustfmt | |
| run: cargo fmt --check -- --config-path /dev/null --config imports_granularity=Module | |
| - name: Deny | |
| run: cargo deny check | |
| - name: License Header | |
| run: | | |
| HEADER=$(cat <<EOF | |
| This software is licensed under a dual license model: | |
| GNU Affero General Public License v3 (AGPLv3): You may use, modify, and | |
| distribute this software under the terms of the AGPLv3. | |
| Elastic License v2 (ELv2): You may also use, modify, and distribute this | |
| software under the Elastic License v2, which has specific restrictions. | |
| We welcome any commercial collaboration or support. For inquiries | |
| regarding the licenses, please contact us at: | |
| vectorchord-inquiry@tensorchord.ai | |
| Copyright (c) 2025 TensorChord Inc. | |
| EOF | |
| ) | |
| COUNT=$(echo "$HEADER" | wc -l) | |
| RS_HEADER=$(echo "$HEADER" | awk '{ if ($0 ~ /^$/) print "//"; else print "// " $0 }') | |
| C_HEADER=$(echo "$HEADER" | awk '{ if ($0 ~ /^$/) print "//"; else print "// " $0 }') | |
| PY_HEADER=$(echo "$HEADER" | awk '{ if ($0 ~ /^$/) print "#"; else print "# " $0 }') | |
| RS_FILES=$(find . -type f -name "*.rs" -not -path "./target/*") | |
| C_FILES=$(find . -type f -name "*.c" -not -path "./target/*") | |
| PY_FILES=$(find . -type f -name "*.py" -not -path "./target/*") | |
| FLAG="0" | |
| for p in $RS_FILES; do | |
| if ! head -n "$COUNT" "$p" | cmp -s - <(echo "$RS_HEADER"); then | |
| echo "license header mismatch in file $p" | |
| FLAG="1" | |
| fi | |
| done | |
| for p in $C_FILES; do | |
| if ! head -n "$COUNT" "$p" | cmp -s - <(echo "$C_HEADER"); then | |
| echo "license header mismatch in file $p" | |
| FLAG="1" | |
| fi | |
| done | |
| for p in $PY_FILES; do | |
| if ! head -n "$COUNT" "$p" | cmp -s - <(echo "$PY_HEADER"); then | |
| echo "license header mismatch in file $p" | |
| FLAG="1" | |
| fi | |
| done | |
| if [ "$FLAG" -eq "1" ]; then | |
| exit 1 | |
| fi | |
| # - name: SQL | |
| # run: | | |
| # ! grep -P '\t' -r ./sql | |
| psql: | |
| strategy: | |
| matrix: | |
| version: ["14", "15", "16", "17", "18"] | |
| arch: ["x86_64"] # ["x86_64", "aarch64"] | |
| fail-fast: false | |
| runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }} | |
| env: | |
| SCCACHE_GHA_ENABLED: "true" | |
| RUSTUP_AUTO_INSTALL: "0" | |
| RUSTC_WRAPPER: "sccache" | |
| RUSTFLAGS: "-Dwarnings" | |
| CARGO_TERM_COLOR: "always" | |
| RUST_BACKTRACE: "1" | |
| PG_TOKENIZER: "0.1.1" | |
| steps: | |
| - name: Set up Environment | |
| run: | | |
| sudo apt-get update | |
| curl -fsSL https://github.com/risinglightdb/sqllogictest-rs/releases/download/v0.29.0/sqllogictest-bin-v0.29.0-$(uname -m)-unknown-linux-musl.tar.gz | tar -xOzf - ./sqllogictest | install -m 755 /dev/stdin /usr/local/bin/sqllogictest | |
| - name: Install Rust | |
| run: rustup update | |
| - name: Set up Sccache | |
| uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # v0.0.9 | |
| - name: Install PostgreSQL & pg_tokenizer.rs | |
| run: | | |
| sudo apt-get remove -y '^postgres.*' '^libpq.*' | |
| sudo apt-get purge -y '^postgres.*' '^libpq.*' | |
| sudo apt-get install -y --no-install-recommends postgresql-common | |
| sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y | |
| sudo apt-get install -y --no-install-recommends postgresql-server-dev-${{ matrix.version }} | |
| sudo apt-get install -y --no-install-recommends postgresql-${{ matrix.version }} | |
| echo "local all all trust" | sudo tee /etc/postgresql/${{ matrix.version }}/main/pg_hba.conf | |
| echo "host all all 127.0.0.1/32 trust" | sudo tee -a /etc/postgresql/${{ matrix.version }}/main/pg_hba.conf | |
| echo "host all all ::1/128 trust" | sudo tee -a /etc/postgresql/${{ matrix.version }}/main/pg_hba.conf | |
| sudo mkdir -p /etc/systemd/system/postgresql@.service.d/ | |
| echo "[Service]" | sudo tee /etc/systemd/system/postgresql@.service.d/limit.conf | |
| echo "LimitNOFILE=infinity" | sudo tee -a /etc/systemd/system/postgresql@.service.d/limit.conf | |
| echo "LimitMEMLOCK=infinity" | sudo tee -a /etc/systemd/system/postgresql@.service.d/limit.conf | |
| sudo systemctl daemon-reload | |
| sudo -iu postgres createuser -s -r $(whoami) | |
| sudo -iu postgres createdb -O $(whoami) $(whoami) | |
| if [ "${{ matrix.version }}" -ge "18" ]; then | |
| psql -c 'ALTER SYSTEM SET io_method = io_uring' | |
| fi | |
| psql -c 'ALTER SYSTEM SET max_worker_processes = 1024' | |
| psql -c 'ALTER SYSTEM SET shared_preload_libraries = pg_tokenizer, vchord_bm25' | |
| psql -c 'ALTER SYSTEM SET search_path = "\$user", public, tokenizer_catalog, bm25_catalog' | |
| psql -c 'ALTER SYSTEM SET autovacuum = off' | |
| sudo systemctl stop postgresql | |
| pg_config | |
| echo PG_CONFIG=pg_config >> $GITHUB_ENV | |
| mkdir ~/pg_tokenizer-install | |
| curl -fsSL https://github.com/tensorchord/pg_tokenizer.rs/releases/download/${PG_TOKENIZER}/postgresql-${{ matrix.version }}-pg-tokenizer_${PG_TOKENIZER}-1_$(dpkg --print-architecture).deb -o ~/pg_tokenizer-install/pg_tokenizer.deb | |
| sudo apt-get install -y ~/pg_tokenizer-install/pg_tokenizer.deb | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| # - name: Clippy | |
| # run: make PROFILE=dev clippy | |
| - name: Build | |
| run: make PROFILE=dev build | |
| - name: Install | |
| run: sudo make PG_CONFIG=$PG_CONFIG install | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0 | |
| with: | |
| name: postgresql-${{ matrix.version }}-vchord-bm25_0.0.0_${{ matrix.arch }}-linux-gnu | |
| path: ./build | |
| compression-level: 9 | |
| retention-days: 14 | |
| - name: Service | |
| run: | | |
| sudo systemctl start postgresql | |
| psql -c 'CREATE EXTENSION IF NOT EXISTS pg_tokenizer CASCADE;' | |
| psql -c 'CREATE EXTENSION IF NOT EXISTS vchord_bm25 CASCADE;' | |
| # - name: SqlLogictest | |
| # run: | | |
| # sqllogictest --db $(whoami) --user $(whoami) './tests/sqllogictest/*.slt' | |
| - name: Fuzz | |
| run: | | |
| lscpu | |
| cargo run -p fuzz --target $(rustc --print host-tuple) -- "user=$(whoami) dbname=$(whoami) host=localhost" | |
| - name: Logging | |
| if: always() | |
| run: | | |
| cat /var/log/postgresql/postgresql-${{ matrix.version }}-main.log |