Skip to content

refactor pg to parquet (#21) #2

refactor pg to parquet (#21)

refactor pg to parquet (#21) #2

Workflow file for this run

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: Extract rustc LLVM version
id: rustc-llvm-version
run: echo "version=$(rustc --version --verbose | grep 'LLVM version' | cut -d ' ' -f 3)" >> $GITHUB_OUTPUT
# we need to install exactly the same version of LLVM and Clang as Rust uses for the coverage report
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
with:
version: ${{ steps.rustc-llvm-version.outputs.version }}
- name: Print LLVM and Clang versions
run: |
llvm-config --version
clang --version
- name: Install PostgreSQL dependencies
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
- name: Test
run: |
cargo pgrx test pg16 --runas postgres --pgdata /tmp/pgdata
env:
RUSTFLAGS: "-C instrument-coverage"
CARGO_INCREMENTAL: 0
RUST_TEST_THREADS: 1
- name: Generate coverage report
run: |
llvm-profdata merge default_*.profraw \
--output=pg_parquet.profdata
test_binary=$(find ./target/debug/deps/ -type f -executable -iname 'pg_parquet-*')
llvm-cov export \
--object=$test_binary \
--instr-profile=pg_parquet.profdata \
--format=lcov \
--ignore-filename-regex=.cargo/registry \
--ignore-filename-regex=.cargo/git \
--ignore-filename-regex=pg_parquet/target \
--ignore-filename-regex=rustc \
--check-binary-ids \
> pg_parquet.lcov
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./pg_parquet.lcov
flags: pgrxtests
token: ${{ secrets.CODECOV_TOKEN }}