Skip to content

pg_frontend: decode numeric constants directly #199

pg_frontend: decode numeric constants directly

pg_frontend: decode numeric constants directly #199

Workflow file for this run

name: CI lints and tests
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
env:
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
RUSTC_WRAPPER: sccache
SCCACHE_VERSION: 0.8.1
SCCACHE_SHA256: "7203a4dcb3a67f3a0272366d50ede22e5faa3e2a798deaa4d1ea377b51c0ab0c"
SCCACHE_DIR: /home/runner/.cache/sccache
SCCACHE_PREFIX: pg_fusion-rust-cache
RUST_TOOLCHAIN_VERSION: 1.96.0
PGRX_VERSION: 0.18.1
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
postgres: [ 17 ]
env:
PG_MAJOR: ${{ matrix.postgres }}
steps:
- uses: actions/checkout@v4
- name: Set up sccache
run: |
wget https://github.com/mozilla/sccache/releases/download/v$SCCACHE_VERSION/sccache-v${{env.SCCACHE_VERSION}}-x86_64-unknown-linux-musl.tar.gz
tar -xzf sccache-v${{env.SCCACHE_VERSION}}-x86_64-unknown-linux-musl.tar.gz
sudo mv sccache-v${{env.SCCACHE_VERSION}}-x86_64-unknown-linux-musl/sccache /usr/local/bin
chmod +x /usr/local/bin/sccache
echo "${{env.SCCACHE_SHA256}} /usr/local/bin/sccache" | sha256sum --check
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
target: x86_64-unknown-linux-gnu
components: rustfmt, clippy, llvm-tools-preview
- name: Cache cargo registry
uses: actions/cache@v4
continue-on-error: false
with:
path: |
~/.cargo/.crates.toml
~/.cargo/.crates2.json
~/.cargo/bin
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: ${{env.SCCACHE_PREFIX}}-${{ runner.os }}-${{ hashFiles('Cargo.toml', '.github/workflows/ci.yaml') }}
- name: Cache sccache directory
uses: actions/cache@v4
continue-on-error: false
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{env.SCCACHE_PREFIX}}-${{ runner.os }}-${{ hashFiles('Cargo.toml', '.github/workflows/ci.yaml') }}
- 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 -y install build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev \
libxslt-dev libssl-dev libxml2-utils xsltproc ccache pkg-config \
gnupg ca-certificates
sudo apt-get -y install postgresql-${{ env.PG_MAJOR }}-postgis-3 \
postgresql-server-dev-${{ env.PG_MAJOR }} \
postgresql-client-${{ env.PG_MAJOR }} \
libpq-dev
- name: Install and configure pgrx
run: |
cargo install --locked cargo-pgrx@${{ env.PGRX_VERSION }}
cargo pgrx init --pg${{ env.PG_MAJOR }} /usr/lib/postgresql/${{ env.PG_MAJOR }}/bin/pg_config
- name: Install cargo-llvm-cov for coverage report
run: cargo install --locked cargo-llvm-cov@0.6.12
- name: Format and lint
run: |
cargo fmt --all -- --check
cargo clippy --all-targets --features "pg${{ env.PG_MAJOR }}, pg_test" --no-default-features
- name: Set up permissions for PostgreSQL
run: |
sudo chmod a+rwx $(/usr/lib/postgresql/${{ env.PG_MAJOR }}/bin/pg_config --pkglibdir) \
$(/usr/lib/postgresql/${{ env.PG_MAJOR }}/bin/pg_config --sharedir)/extension \
/var/run/postgresql/
- name: Run pgrx coverage tests
working-directory: .
run: |
# Run PostgreSQL-bound crates with coverage inside pgrx/PostgreSQL.
LLVM_COV_ENV=$(mktemp)
cargo llvm-cov show-env --export-prefix > "$LLVM_COV_ENV"
source "$LLVM_COV_ENV"
cargo llvm-cov clean
cargo pgrx test pg${{ env.PG_MAJOR }} -p pg_test --no-default-features
cargo pgrx test pg${{ env.PG_MAJOR }} -p pg_fusion --features pg_test pg_fusion_simple_select_smoke
PG_FUSION_SPILL_PG_TEST=1 cargo pgrx test pg${{ env.PG_MAJOR }} -p pg_fusion --features pg_test pg_fusion_spill_metrics_smoke
cargo llvm-cov report --lcov --output-path pgrx_lcov.info
- name: Upload pgrx coverage to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./pgrx_lcov.info
token: ${{ secrets.CODECOV_TOKEN }}
- name: Run library coverage
working-directory: .
run: |
# Run all non-extension crates with coverage
LLVM_COV_ENV=$(mktemp)
cargo llvm-cov show-env --export-prefix > "$LLVM_COV_ENV"
source "$LLVM_COV_ENV"
cargo llvm-cov clean
cargo llvm-cov --workspace \
--exclude backend_service \
--exclude df_catalog \
--exclude pg_fusion \
--exclude pg_test \
--exclude plan_builder \
--exclude row_estimator_seed \
--exclude slot_encoder \
--exclude slot_import \
--exclude slot_scan \
--lcov --output-path core_lcov.info
- name: Upload core coverage report to Codecov
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
files: ./core_lcov.info
token: ${{ secrets.CODECOV_TOKEN }}