Skip to content

ci: Install icu on macOS for PostgreSQL 16 (#87) #243

ci: Install icu on macOS for PostgreSQL 16 (#87)

ci: Install icu on macOS for PostgreSQL 16 (#87) #243

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: "false"
jobs:
Test:
strategy:
fail-fast: false # We want all of them to run, even if one fails
matrix:
os: [ ubuntu-latest, macos-latest ]
pg: [ "12", "13", "14", "15", "16" ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install icu
if: runner.os == 'macOS' && matrix.pg == '16'
run: |
brew install icu4c
- name: Install cargo-pgrx
run: |
PGRX_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name=="pgrx")|.version')
cargo install --locked --version=$PGRX_VERSION cargo-pgrx --debug --force
cargo pgrx init --pg${{ matrix.pg }} download
- name: Run unit tests
run: cd plprql && echo "\q" | cargo pgrx run pg${{ matrix.pg }} && cargo test --no-default-features --features pg${{ matrix.pg }}
- name: Run integration tests
run: cd plprql && echo "\q" | cargo pgrx run pg${{ matrix.pg }} && cd ../plprql-tests && cargo test --no-default-features --features pg${{ matrix.pg }}
Install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install PostgreSQL headers
run: |
sudo apt-get update
sudo apt-get install postgresql-server-dev-14
- name: Install cargo-pgrx
run: |
PGRX_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name=="pgrx")|.version')
cargo install --locked --version=$PGRX_VERSION cargo-pgrx --debug --force
cargo pgrx init --pg14 $(which pg_config)
- name: Install PL/PRQL
run: |
cd plprql
cargo pgrx install --no-default-features --release --sudo
- name: Start PostgreSQL
run: |
sudo systemctl start postgresql.service
pg_isready
# superuser (-s), can create databases (-d) and roles (-r), no password prompt (-w) named runner
sudo -u postgres createuser -s -d -r -w runner
- name: Verify install
run: |
createdb -U runner runner
psql -U runner -c "create extension plprql;"
psql -U runner -c "select prql_to_sql('from table');"
rustfmt:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run rustfmt
run: cargo fmt -- --check
rust-clippy:
runs-on: ubuntu-latest
strategy:
matrix:
pg: [ "16" ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install cargo-pgrx
run: |
PGRX_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name=="pgrx")|.version')
cargo install --locked --version=$PGRX_VERSION cargo-pgrx --debug --force
cargo pgrx init --pg${{ matrix.pg }} download
- name: Run clippy
run: cargo clippy --all-targets --no-default-features --features pg${{ matrix.pg }} -- -D warnings
commitlint:
runs-on: ubuntu-latest
name: Conventional Commits
steps:
- name: Run commitlint
uses: opensource-nepal/commitlint@v1