1+ name : CI
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches :
9+ - main
10+
11+ env :
12+ CARGO_TERM_COLOR : always
13+ RUST_BACKTRACE : 1
14+ CARGO_INCREMENTAL : " false"
15+
16+ jobs :
17+ Test :
18+ strategy :
19+ fail-fast : false # We want all of them to run, even if one fails
20+ matrix :
21+ os : [ ubuntu-latest, macos-latest ]
22+ pg : [ "12", "13", "14", "15", "16" ]
23+ runs-on : ${{ matrix.os }}
24+ steps :
25+ - uses : actions/checkout@v4
26+ - name : Install cargo-pgrx
27+ run : |
28+ PGRX_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name=="pgrx")|.version')
29+ cargo install --locked --version=$PGRX_VERSION cargo-pgrx --debug --force
30+ cargo pgrx init --pg${{ matrix.pg }} download
31+ - name : Run tests
32+ run : echo "\q" | cargo pgrx run pg${{ matrix.pg }} && cargo test --no-default-features --features pg${{ matrix.pg }}
33+ Install :
34+ runs-on : ubuntu-latest
35+ steps :
36+ - uses : actions/checkout@v4
37+ - name : Install PostgreSQL headers
38+ run : |
39+ sudo apt-get update
40+ sudo apt-get install postgresql-server-dev-14
41+ - name : Install cargo-pgrx
42+ run : |
43+ PGRX_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name=="pgrx")|.version')
44+ cargo install --locked --version=$PGRX_VERSION cargo-pgrx --debug --force
45+ cargo pgrx init --pg14 $(which pg_config)
46+ - name : Install PL/PRQL
47+ run : |
48+ cd plprql
49+ cargo pgrx install --no-default-features --release --sudo
50+ - name : Start PostgreSQL
51+ run : |
52+ sudo systemctl start postgresql.service
53+ pg_isready
54+ # superuser (-s), can create databases (-d) and roles (-r), no password prompt (-w) named runner
55+ sudo -u postgres createuser -s -d -r -w runner
56+ - name : Verify install
57+ run : |
58+ createdb -U runner runner
59+ psql -U runner -c "create extension typeid;"
60+ psql -U runner -c "select typeid_generate('user');"
61+ rustfmt :
62+ runs-on : ubuntu-latest
63+ steps :
64+ - name : Checkout code
65+ uses : actions/checkout@v4
66+ - name : Run rustfmt
67+ run : cargo fmt -- --check
68+ rust-clippy :
69+ runs-on : ubuntu-latest
70+ strategy :
71+ matrix :
72+ pg : [ "16" ]
73+ steps :
74+ - name : Checkout code
75+ uses : actions/checkout@v4
76+ - name : Install cargo-pgrx
77+ run : |
78+ PGRX_VERSION=$(cargo metadata --format-version 1 | jq -r '.packages[]|select(.name=="pgrx")|.version')
79+ cargo install --locked --version=$PGRX_VERSION cargo-pgrx --debug --force
80+ cargo pgrx init --pg${{ matrix.pg }} download
81+ - name : Run clippy
82+ run : cargo clippy --all-targets --no-default-features --features pg${{ matrix.pg }} -- -D warnings
0 commit comments