-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: run ci when updating tests dir (#92)
* ci: run ci when updating tests dir Signed-off-by: silver-ymz <[email protected]> * change src Signed-off-by: silver-ymz <[email protected]> * use sudo to install extension Signed-off-by: silver-ymz <[email protected]> * update ci Signed-off-by: silver-ymz <[email protected]> * Elevate permissions Signed-off-by: silver-ymz <[email protected]> * update ci Signed-off-by: silver-ymz <[email protected]> * fix wrong quotation marks in command Signed-off-by: silver-ymz <[email protected]> * fix wrong quotation marks in command Signed-off-by: silver-ymz <[email protected]> * use ankane/setup-postgres Signed-off-by: silver-ymz <[email protected]> * chmod for postgres dir Signed-off-by: silver-ymz <[email protected]> * fix indent Signed-off-by: silver-ymz <[email protected]> * set testdb Signed-off-by: silver-ymz <[email protected]> * add github cache Signed-off-by: silver-ymz <[email protected]> * alter password Signed-off-by: silver-ymz <[email protected]> * ignore if binary installed Signed-off-by: silver-ymz <[email protected]> * update pg_config path Signed-off-by: silver-ymz <[email protected]> * revert ankane/setup-postgres Signed-off-by: silver-ymz <[email protected]> * use sccache Signed-off-by: silver-ymz <[email protected]> * close previous postgres Signed-off-by: silver-ymz <[email protected]> * fix wrong quotation marks Signed-off-by: silver-ymz <[email protected]> --------- Signed-off-by: silver-ymz <[email protected]>
- Loading branch information
1 parent
bdcb899
commit 4fb1dd5
Showing
3 changed files
with
76 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,17 +4,21 @@ on: | |
push: | ||
branches: [ "main" ] | ||
paths: | ||
- '.github/workflows/check.yml' | ||
- 'src/**' | ||
- 'Cargo.toml' | ||
- 'Cargo.lock' | ||
- 'rust-toolchain.toml' | ||
- 'tests/**' | ||
pull_request: | ||
branches: [ "main" ] | ||
paths: | ||
- '.github/workflows/check.yml' | ||
- 'src/**' | ||
- 'Cargo.toml' | ||
- 'Cargo.lock' | ||
- 'rust-toolchain.toml' | ||
- 'tests/**' | ||
merge_group: | ||
workflow_dispatch: | ||
|
||
|
@@ -24,6 +28,8 @@ concurrency: | |
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
SCCACHE_GHA_ENABLED: true | ||
RUSTC_WRAPPER: sccache | ||
|
||
jobs: | ||
lint: | ||
|
@@ -33,13 +39,23 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
key: cargo-${{ runner.os }}-pg${{ matrix.version }}-${{ hashFiles('./Cargo.toml') }} | ||
restore-keys: cargo-${{ runner.os }}-pg${{ matrix.version }} | ||
- uses: mozilla-actions/[email protected] | ||
- name: Prepare | ||
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 libpq-dev postgresql-${{ matrix.version }} postgresql-server-dev-${{ matrix.version }} | ||
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1) | ||
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1) || true | ||
cargo pgrx init --pg${{ matrix.version }}=/usr/lib/postgresql/${{ matrix.version }}/bin/pg_config | ||
- name: Format check | ||
run: cargo fmt --check | ||
|
@@ -53,13 +69,23 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
key: cargo-${{ runner.os }}-pg${{ matrix.version }}-${{ hashFiles('./Cargo.toml') }} | ||
restore-keys: cargo-${{ runner.os }}-pg${{ matrix.version }} | ||
- uses: mozilla-actions/[email protected] | ||
- name: Prepare | ||
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 libpq-dev postgresql-${{ matrix.version }} postgresql-server-dev-${{ matrix.version }} | ||
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1) | ||
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1) || true | ||
cargo pgrx init --pg${{ matrix.version }}=/usr/lib/postgresql/${{ matrix.version }}/bin/pg_config | ||
- name: Build | ||
run: cargo build --verbose | ||
|
@@ -75,19 +101,47 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
key: cargo-${{ runner.os }}-pg${{ matrix.version }}-${{ hashFiles('./Cargo.toml') }} | ||
restore-keys: cargo-${{ runner.os }}-pg${{ matrix.version }} | ||
- uses: mozilla-actions/[email protected] | ||
- name: Prepare | ||
run: | | ||
sudo pg_dropcluster 14 main | ||
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 libpq-dev postgresql-${{ matrix.version }} postgresql-server-dev-${{ matrix.version }} | ||
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1) | ||
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1) || true | ||
cargo pgrx init --pg${{ matrix.version }}=/usr/lib/postgresql/${{ matrix.version }}/bin/pg_config | ||
cargo install sqllogictest-bin | ||
- name: Build && Install | ||
run: cargo pgrx install --release | ||
cargo install sqllogictest-bin || true | ||
- uses: actions/cache/save@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
key: cargo-${{ runner.os }}-pg${{ matrix.version }}-${{ hashFiles('./Cargo.toml') }} | ||
- name: Build | ||
run: | | ||
sudo chmod -R 777 /usr/share/postgresql/${{ matrix.version }}/extension | ||
sudo chmod -R 777 /usr/lib/postgresql/${{ matrix.version }}/lib | ||
cargo pgrx install --release | ||
sudo systemctl start postgresql@${{ matrix.version }}-main | ||
sudo -u postgres psql -c "CREATE USER $USER LOGIN SUPERUSER" | ||
sudo -u postgres psql -c "CREATE DATABASE $USER OWNER $USER" | ||
psql -c 'ALTER SYSTEM SET shared_preload_libraries = "vectors.so"' | ||
sudo systemctl restart postgresql@${{ matrix.version }}-main | ||
- name: Sqllogictest | ||
run: | | ||
sudo systemctl restart postgresql | ||
sudo -u postgres psql -f tests/init.sql | ||
sudo -u postgres sqllogictest './tests/**/*.slt' | ||
export password=$(openssl rand -base64 32) | ||
psql -c "ALTER USER $USER WITH PASSWORD '$password'" | ||
psql -f ./tests/init.sql | ||
sqllogictest -u "$USER" -w "$password" -d "$USER" './tests/**/*.slt' |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,8 @@ permissions: | |
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
SCCACHE_GHA_ENABLED: true | ||
RUSTC_WRAPPER: sccache | ||
|
||
jobs: | ||
setup: | ||
|
@@ -107,13 +109,23 @@ jobs: | |
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ needs.setup.outputs.ref }} | ||
- uses: actions/cache/restore@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
key: cargo-${{ runner.os }}-pg${{ matrix.version }}-${{ hashFiles('./Cargo.toml') }} | ||
restore-keys: cargo-${{ runner.os }}-pg${{ matrix.version }} | ||
- uses: mozilla-actions/[email protected] | ||
- name: Prepare | ||
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 libpq-dev postgresql-${{ matrix.version }} postgresql-server-dev-${{ matrix.version }} | ||
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1) | ||
cargo install cargo-pgrx --git https://github.com/tensorchord/pgrx.git --rev $(cat Cargo.toml | grep "pgrx =" | awk -F'rev = "' '{print $2}' | cut -d'"' -f1) || true | ||
cargo pgrx init --pg${{ matrix.version }}=/usr/lib/postgresql/${{ matrix.version }}/bin/pg_config | ||
- name: Build Release | ||
id: build_release | ||
|
This file contains 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