-
Notifications
You must be signed in to change notification settings - Fork 56
145 lines (128 loc) · 4.21 KB
/
build_and_test.yaml
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: CI
on:
push:
branches: ["main"]
tags: ["v*"]
paths:
- 'src/**'
- 'test/**'
- 'include/**'
- 'sql/**'
- Makefile
- Makefile.global
- duckdb.control
- third_party/duckdb
- '.github/workflows/**'
pull_request:
paths:
- 'src/**'
- 'test/**'
- 'include/**'
- 'sql/**'
- Makefile
- Makefile.global
- duckdb.control
- third_party/duckdb
- '.github/workflows/**'
- .clang-format
jobs:
format:
runs-on: ubuntu-24.04
name: 'Linting and formatting'
steps:
- name: Checkout pg_duckdb extension code
uses: actions/checkout@v4
- name: Fetch main branch
run: git fetch --depth=1 origin +main:refs/remotes/origin/main
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install clang-format (11.0.1) and ruff
run: python3 -m pip install "clang-format==11.0.1" ruff
- name: Run clang-format
run: git clang-format refs/remotes/origin/main --diff
- name: Run ruff check
run: ruff check --output-format=github .
- name: Run ruff format
run: ruff format --diff
build-and-test:
name: 'Build and test'
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
version: [REL_16_STABLE, REL_17_STABLE]
runs-on: ${{ matrix.os }}
steps:
- name: Test details
run: echo Build and test pg_duckdb on ${{ matrix.os }} with PostgreSQL ${{ matrix.version }} branch
- name: Install build deps
run: |
sudo apt-get update -qq
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E298A3A825C0D65DFD57CBB651716619E084DAB9
sudo apt-get install -y build-essential libreadline-dev zlib1g-dev flex bison libxml2-dev libxslt-dev \
libssl-dev libxml2-utils xsltproc pkg-config libc++-dev libc++abi-dev libglib2.0-dev libtinfo5 cmake \
libstdc++-12-dev
echo "${PWD}/postgres/inst/bin:$PATH'" > $GITHUB_PATH
- name: ccache
uses: hendrikmuhs/[email protected]
with:
create-symlink: true
- name: Checkout pg_duckdb extension code
uses: actions/checkout@v4
with:
submodules: 'recursive'
path: duckdb
- name: Compute DuckDB SHA
id: versions
run: |
pushd duckdb
DUCKDB_SHA=`git ls-tree HEAD third_party/duckdb --format='%(objectname)'`
echo "duckdb_sha=${DUCKDB_SHA}" >> "$GITHUB_OUTPUT"
echo "Got DUCKDB_SHA='${DUCKDB_SHA}'"
- name: Setup PG build cache
id: cache-pg-build
uses: actions/cache@v4
with:
path: postgres/inst
key: pg-build-${{ matrix.version }}
- name: Checkout and build PostgreSQL code
if: steps.cache-pg-build.outputs.cache-hit != 'true'
run: |
rm -rf postgres
git clone --branch ${{ matrix.version }} --single-branch --depth 1 https://github.com/postgres/postgres.git
pushd postgres
git branch
./configure --prefix=$PWD/inst/ --enable-cassert --enable-debug --with-openssl --with-icu --with-libxml
make -j8 install
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup DuckDB build cache
id: cache-duckdb-build
uses: actions/cache@v4
with:
path: duckdb/third_party/duckdb/build/
key: duckdb-build-${{ steps.versions.outputs.duckdb_sha }}
- name: Install pytest and other test requirements
run: python3 -m pip install -r duckdb/requirements.txt
- name: Build and test pg_duckdb extension
id: build
run: |
pushd duckdb
make
make install
- name: Run make installcheck
id: installcheck
run: |
pushd duckdb
make installcheck
- name: Run make pycheck
id: pycheck
run: |
pushd duckdb
make pycheck
- name: Print regression.diffs if regression tests failed
if: failure() && steps.installcheck.outcome != 'success'
run: |
cat duckdb/test/regression/regression.diffs