forked from pgcentralfoundation/pgrx
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (65 loc) · 2.51 KB
/
cargo-pgx-init.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
name: cargo-pgx-init
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
cargo-pgx-init:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'nogha')"
strategy:
matrix:
os: ["ubuntu-latest"]
steps:
- uses: actions/checkout@v2
- name: cargo version
run: cargo --version
# Ubuntu system dependencies for Postgres
- name: remove old postgres
run: sudo apt remove -y postgres*
# Update apt
- name: update apt
run: |
sudo apt-get update -y -qq --fix-missing
sudo apt-get install -y wget gnupg
sudo bash -c 'echo deb http://apt.postgresql.org/pub/repos/apt/ focal-pgdg main >> /etc/apt/sources.list.d/pgdg.list'
sudo apt update
# Install Postgres build dependencies
- name: install postgres build dependencies
run: sudo apt-get install -y clang-10 llvm-10 clang gcc make build-essential libz-dev zlib1g-dev strace libssl-dev pkg-config
# install cargo-pgx
- name: install cargo-pgx
run: cargo install --path cargo-pgx/ --debug
# initialize pgx with all PG versions it supports
- name: cargo pgx init
run: cargo pgx init
# create new sample extension
- name: create new sample extension
run: cd /tmp/ && cargo pgx new sample
# hack Cargo.toml to use this version of pgx from github
- name: hack Cargo.toml
run: |
export git_hash=$(git rev-parse --short $GITHUB_SHA)
export git_url=$(git config --get remote.origin.url)
echo "[patch.crates-io]" >> /tmp/sample/Cargo.toml
echo "pgx = { git = \"${git_url}\", package = \"pgx\", rev = \"${git_hash}\" }" >> /tmp/sample/Cargo.toml
echo "pgx-macros = { git = \"${git_url}\", package = \"pgx-macros\", rev = \"${git_hash}\" }" >> /tmp/sample/Cargo.toml
echo "pgx-tests = { git = \"${git_url}\", package = \"pgx-tests\", rev = \"${git_hash}\" }" >> /tmp/sample/Cargo.toml
- name: show Cargo.toml
run: cat /tmp/sample/Cargo.toml
# test that sample extension on all 4 Postgres'
- name: test sample on pg10
run: cd /tmp/sample && cargo pgx test pg10
- name: test sample on pg11
run: cd /tmp/sample && cargo pgx test pg11
- name: test sample on pg12
run: cd /tmp/sample && cargo pgx test pg12
- name: test sample on pg13
run: cd /tmp/sample && cargo pgx test pg13
- name: test sample on pg14
run: cd /tmp/sample && cargo pgx test pg14