-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (53 loc) · 1.86 KB
/
ci.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
name: build
on:
push:
branches: [main]
pull_request:
branches: [main]
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pg-version: [14]
steps:
- name: Add PG_VERSION to env
run: |
echo "PG_VERSION=${{ matrix.pg-version }}" >> $GITHUB_ENV
echo "PG_SRC_DIR=$HOME/pg${{ matrix.pg-version }}" >> $GITHUB_ENV
- name: Get latest commit id of PostgreSQL ${{ env.PG_VERSION }}
run: |
echo "PG_COMMIT_HASH=$(git ls-remote git://git.postgresql.org/git/postgresql.git refs/heads/REL_${PG_VERSION}_STABLE | awk '{print $1}')" >> $GITHUB_ENV
- name: Cache PostgreSQL ${{ env.PG_VERSION }}
uses: actions/cache@v4
id: pg-source-cache
with:
path: ${{ env.PG_SRC_DIR }}
key: ${{ runner.os }}-v2-pg-${{ env.PG_COMMIT_HASH }}
- name: Install PostgreSQL ${{ env.PG_VERSION }}
if: steps.pg-source-cache.outputs.cache-hit != 'true'
run: |
git clone --depth 1 --branch REL_${PG_VERSION}_STABLE git://git.postgresql.org/git/postgresql.git $PG_SRC_DIR
cd $PG_SRC_DIR
./configure --prefix=$PG_SRC_DIR CFLAGS="-std=gnu99 -ggdb -O0" --enable-cassert
make install -j$(nproc) > /dev/null
- uses: actions/checkout@v4
- name: Build
id: build
run: |
make PG_CONFIG=$PG_SRC_DIR/bin/pg_config install -j$(nproc)
- name: Package Extension
id: package
run: |
npm install
npm run main -- --pgVersion $PG_VERSION
working-directory: ${{ github.workspace }}/packaging
- name: Upload Release Asset
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ github.workspace }}/*.deb