Skip to content

fix docker build ci context error #535

fix docker build ci context error

fix docker build ci context error #535

Workflow file for this run

name: PostgreSQL
on:
push:
branches: ["main"]
paths:
- ".cargo/**"
- ".github/**"
- "crates/**"
- "scripts/**"
- "src/**"
- "tests/**"
- "Cargo.lock"
- "Cargo.toml"
- "rust-toolchain.toml"
- "vectors.control"
- "vendor/**"
pull_request:
branches: ["main"]
paths:
- ".cargo/**"
- ".github/**"
- "crates/**"
- "scripts/**"
- "src/**"
- "tests/**"
- "Cargo.lock"
- "Cargo.toml"
- "rust-toolchain.toml"
- "vectors.control"
- "vendor/**"
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"
CARGO_PROFILE_OPT_BUILD_OVERRIDE_DEBUG: true
jobs:
test:
strategy:
matrix:
version: [14, 15, 16, 17]
arch: ["x86_64"]
runs-on: ubuntu-latest
env:
SEMVER: "0.0.0"
VERSION: ${{ matrix.version }}
ARCH: ${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Environment
run: |
sudo apt-get remove -y '^postgres.*' '^libpq.*' '^clang.*' '^llvm.*' '^libclang.*' '^libllvm.*' '^mono-llvm.*'
sudo apt-get purge -y '^postgres.*' '^libpq.*' '^clang.*' '^llvm.*' '^libclang.*' '^libllvm.*' '^mono-llvm.*'
sudo apt-get update
sudo apt-get install -y build-essential crossbuild-essential-arm64
sudo apt-get install -y qemu-user-static
echo 'target.aarch64-unknown-linux-gnu.linker = "aarch64-linux-gnu-gcc"' | tee ~/.cargo/config.toml
- name: Set up Sccache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Set up Cache
uses: actions/cache/restore@v4
id: cache
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ hashFiles('./Cargo.lock') }}-${{ matrix.version }}
- name: Build
run: |
export PGRX_PG_CONFIG_PATH=$(pwd)/vendor/pg${VERSION}_${ARCH}_debian/pg_config/pg_config
export PGRX_TARGET_INFO_PATH_PG$VERSION=$(pwd)/vendor/pg${VERSION}_${ARCH}_debian/pgrx_binding
cargo build --package pgvectors --lib --features pg$VERSION --target $ARCH-unknown-linux-gnu --profile opt
./tools/schema.sh --features pg$VERSION --target $ARCH-unknown-linux-gnu --profile opt | expand -t 4 > ./target/schema.sql
- name: Install
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql-$VERSION
echo "local all all trust" | sudo tee /etc/postgresql/$VERSION/main/pg_hba.conf
echo "host all all 127.0.0.1/32 trust" | sudo tee -a /etc/postgresql/$VERSION/main/pg_hba.conf
echo "host all all ::1/128 trust" | sudo tee -a /etc/postgresql/$VERSION/main/pg_hba.conf
sudo systemctl restart postgresql
sudo -iu postgres createuser -s -r $USER
createdb
sudo cp ./target/schema.sql /usr/share/postgresql/$VERSION/extension/vectors--$SEMVER.sql
sudo cp ./target/$ARCH-unknown-linux-gnu/opt/libvectors.so "/usr/lib/postgresql/$VERSION/lib/vectors.so"
sed -e "s/@CARGO_VERSION@/$SEMVER/g" < ./vectors.control | sudo tee "/usr/share/postgresql/$VERSION/extension/vectors.control"
psql -c 'ALTER SYSTEM SET shared_preload_libraries = "vectors.so"'
psql -c 'ALTER SYSTEM SET search_path = "$user", public, vectors'
psql -c 'ALTER SYSTEM SET logging_collector = on'
sudo systemctl restart postgresql
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up cargo-binstall
uses: cargo-bins/cargo-binstall@main
- name: Set up Sqllogictest
run: cargo binstall sqllogictest-bin --version 0.20.6 -y --force
- name: Test
run: ./tests/tests.sh
- name: Post Set up Cache
uses: actions/cache/save@v4
if: ${{ !steps.cache.outputs.cache-hit }}
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ github.job }}-${{ hashFiles('./Cargo.lock') }}-${{ matrix.version }}