-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds pgrx utility functions #14
Merged
+187
−1,614
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6154d25
declare cargo dependencies
aykut-bozkurt f20fcd5
add vscode settings file
aykut-bozkurt 7c4ac3a
add ci workflow file
aykut-bozkurt d20e021
update extension control file comment
aykut-bozkurt 61f4ad4
add pgrx utils module
aykut-bozkurt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
[target.'cfg(target_os="macos")'] | ||
# Postgres symbols won't be available until runtime | ||
rustflags = ["-Clink-arg=-Wl,-undefined,dynamic_lookup"] | ||
|
||
[net] | ||
git-fetch-with-cli = true | ||
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: CI lints and tests | ||
on: | ||
push: | ||
branches: | ||
- "*" | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Rust | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
toolchain: 1.81.0 | ||
target: x86_64-unknown-linux-gnu | ||
components: rustfmt, clippy | ||
|
||
- name: Install cargo-llvm-cov for coverage report | ||
run: cargo install --locked [email protected] | ||
|
||
- name: Install PostgreSQL | ||
run: | | ||
sudo sh -c 'echo "deb https://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 install build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config | ||
sudo apt-get -y install postgresql-16-postgis-3 libpq-dev postgresql-server-dev-16 postgresql-client-16 | ||
|
||
- name: Install and configure pgrx | ||
run: | | ||
cargo install --locked [email protected] | ||
cargo pgrx init --pg16 $(which pg_config) | ||
|
||
- name: Format and lint | ||
run: | | ||
cargo fmt --all -- --check | ||
cargo clippy --all-targets --all-features -- -D warnings | ||
|
||
# pgrx tests with runas argument ignores environment variables, | ||
# so we need to create a .env file beforehand | ||
- name: Create .env file | ||
run: | | ||
touch /tmp/.env | ||
echo AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} >> /tmp/.env | ||
echo AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} >> /tmp/.env | ||
echo AWS_REGION=${{ secrets.AWS_REGION }} >> /tmp/.env | ||
echo AWS_S3_TEST_BUCKET=${{ secrets.AWS_S3_TEST_BUCKET }} >> /tmp/.env | ||
|
||
- name: Run tests | ||
run: | | ||
cargo llvm-cov test --lcov --output-path lcov.info | ||
env: | ||
RUST_TEST_THREADS: 1 | ||
CARGO_PGRX_TEST_RUNAS: postgres | ||
CARGO_PGRX_TEST_PGDATA: /tmp/pgdata | ||
|
||
- name: Upload coverage report to Codecov | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
fail_ci_if_error: true | ||
files: ./lcov.info | ||
flags: pgrxtests | ||
token: ${{ secrets.CODECOV_TOKEN }} |
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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"editor.formatOnSave": true, | ||
"editor.defaultFormatter": "rust-lang.rust-analyzer" | ||
"editor.defaultFormatter": "rust-lang.rust-analyzer", | ||
"rust-analyzer.check.command": "clippy", | ||
"rust-analyzer.checkOnSave": true, | ||
"editor.inlayHints.enabled": "offUnlessPressed", | ||
} |
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 |
---|---|---|
@@ -1,35 +1,43 @@ | ||
[package] | ||
name = "pg_parquet" | ||
version = "0.0.0" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
crate-type = ["cdylib","lib"] | ||
|
||
[[bin]] | ||
name = "pgrx_embed_pg_parquet" | ||
path = "./src/bin/pgrx_embed.rs" | ||
|
||
[features] | ||
default = ["pg16"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will add pg17 later |
||
# pg11 = ["pgrx/pg11", "pgrx-tests/pg11" ] | ||
# pg12 = ["pgrx/pg12", "pgrx-tests/pg12" ] | ||
# pg13 = ["pgrx/pg13", "pgrx-tests/pg13" ] | ||
# pg14 = ["pgrx/pg14", "pgrx-tests/pg14" ] | ||
# pg15 = ["pgrx/pg15", "pgrx-tests/pg15" ] | ||
pg16 = ["pgrx/pg16", "pgrx-tests/pg16" ] | ||
pg_test = [] | ||
|
||
[dependencies] | ||
parquet = { version = "52.0.0", features = [ | ||
arrow = {version = "53", default-features = false} | ||
arrow-schema = {version = "53", default-features = false} | ||
dotenvy = "0.15" | ||
futures = "0.3" | ||
object_store = {version = "0.11", default-features = false, features = ["aws"]} | ||
once_cell = "1" | ||
parquet = {version = "53", default-features = false, features = [ | ||
"arrow", | ||
"snap", | ||
"brotli", | ||
"flate2", | ||
"lz4", | ||
"zstd", | ||
"base64" | ||
"object_store", | ||
]} | ||
parquet_derive = "52.0.0" | ||
pgrx = "=0.11.4" | ||
pgrx = "=0.12.4" | ||
serde = {version = "1", default-features = false} | ||
serde_json = "1" | ||
tokio = {version = "1", default-features = false, features = ["rt", "time", "macros"]} | ||
|
||
[dev-dependencies] | ||
pgrx-tests = "=0.11.4" | ||
pgrx-tests = "=0.12.4" | ||
|
||
[profile.dev] | ||
panic = "unwind" | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// magic is required due to PR https://github.com/pgcentralfoundation/pgrx/pull/1468 | ||
::pgrx::pgrx_embed!(); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for reference https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli