feat: support prefilter (#83) #31
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: | |
pull_request: | |
paths: | |
- ".cargo" | |
- ".github/workflows/check.yml" | |
- "src/**" | |
- "tests/**" | |
- "tools/**" | |
- ".taplo.toml" | |
- ".typos.toml" | |
- "Cargo.lock" | |
- "Cargo.toml" | |
- "*.control" | |
push: | |
paths: | |
- ".cargo" | |
- ".github/workflows/check.yml" | |
- "src/**" | |
- "tests/**" | |
- "tools/**" | |
- ".taplo.toml" | |
- ".typos.toml" | |
- "Cargo.lock" | |
- "Cargo.toml" | |
- "*.control" | |
merge_group: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
env: | |
CARGO_TERM_COLOR: always | |
RUST_BACKTRACE: 1 | |
SCCACHE_GHA_ENABLED: true | |
RUSTC_WRAPPER: sccache | |
RUSTFLAGS: "-Dwarnings" | |
jobs: | |
style: | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Typos | |
uses: crate-ci/typos@master | |
- name: Taplo | |
run: | | |
curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-full-linux-$(uname -m).gz | gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo | |
taplo fmt --check | |
- name: Rustfmt | |
run: cargo fmt --check | |
get-dependencies-version: | |
runs-on: ubuntu-latest | |
outputs: | |
PG_TOKENIZER_VERSION: ${{ steps.get-dependencies-version.outputs.PG_TOKENIZER_VERSION }} | |
steps: | |
- name: Get dependencies latest version | |
id: get-dependencies-version | |
run: | | |
PG_TOKENIZER_VERSION=$(curl -sSL https://api.github.com/repos/tensorchord/pg_tokenizer.rs/releases/latest | jq -r '.tag_name') | |
if [ "$PG_TOKENIZER_VERSION" == "null" ]; then | |
echo "Failed to get PG_TOKENIZER_VERSION" | |
exit 1 | |
else | |
echo "PG_TOKENIZER_VERSION=$PG_TOKENIZER_VERSION" >> $GITHUB_OUTPUT | |
fi | |
lint: | |
needs: ["get-dependencies-version"] | |
strategy: | |
matrix: | |
version: ["14", "15", "16", "17"] | |
arch: ["x86_64", "aarch64"] | |
runs-on: ${{ matrix.arch == 'x86_64' && 'ubuntu-24.04' || 'ubuntu-24.04-arm' }} | |
env: | |
POSTGRES_VERSION: ${{ matrix.version }} | |
PLATFORM: ${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64' }} | |
PG_TOKENIZER_VERSION: ${{ needs.get-dependencies-version.outputs.PG_TOKENIZER_VERSION }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Environment | |
run: ./tools/setup.sh | |
- name: Set up Sccache | |
uses: mozilla-actions/[email protected] | |
- name: Clippy | |
run: cargo clippy --features "pg${{ matrix.version }} pg_test" | |
- name: Test | |
run: | | |
export tmp_file=$(mktemp) | |
getfacl -R /usr/share/postgresql > $tmp_file | |
getfacl -R /usr/lib/postgresql >> $tmp_file | |
sudo chmod -R 777 /usr/share/postgresql | |
sudo chmod -R 777 /usr/lib/postgresql | |
cargo pgrx test --features pg${{ matrix.version }} | |
cd / | |
sudo setfacl --restore=$tmp_file | |
- name: Install | |
run: cargo pgrx install --features "pg${{ matrix.version }}" --release --sudo | |
- name: SqlLogicTest | |
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;' | |
sqllogictest --db $USER --user $USER './tests/**/*.slt' |