-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (91 loc) · 3.22 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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