-
Notifications
You must be signed in to change notification settings - Fork 4
189 lines (163 loc) · 5.73 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
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#
# https://docs.github.com/en/actions
# https://github.com/actions
#
# mac: https://brew.sh/
# win: https://www.msys2.org/docs/package-management/
# win: https://www.archlinux.org/pacman/pacman.8.html
#
name: CI
on:
pull_request: {}
push: {}
jobs:
test:
name: ${{matrix.test.os}}, pg-${{matrix.test.pgver}}
runs-on: ${{matrix.test.os}}
strategy:
matrix:
test:
- {pgver: "12", os: "ubuntu-latest"}
- {pgver: "14", os: "ubuntu-latest"}
- {pgver: "16", os: "ubuntu-latest"}
- {pgver: "16", os: "macos-latest"}
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
submodules: true
- name: "InstallDB / Linux"
if: ${{runner.os == 'Linux'}}
run: |
echo "::group::apt-get-update"
sudo -nH apt-get -q update
sudo -nH apt-get -q install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| gpg --dearmor \
| sudo -nH tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main ${{matrix.test.pgver}}" \
| sudo -nH tee /etc/apt/sources.list.d/pgdg.list
sudo -nH apt-get -q update
echo "::endgroup::"
echo "::group::apt-get-install"
# disable new cluster creation
sudo -nH mkdir -p /etc/postgresql-common/createcluster.d
echo "create_main_cluster = false" | sudo -nH tee /etc/postgresql-common/createcluster.d/no-main.conf
sudo -nH apt-get -qyu install \
postgresql-${{matrix.test.pgver}} \
postgresql-server-dev-${{matrix.test.pgver}} \
libevent-dev python3-docutils \
libpq-dev patchutils
echo "::endgroup::"
# tune environment
echo "/usr/lib/postgresql/${{matrix.test.pgver}}/bin" >> $GITHUB_PATH
echo "PGHOST=/tmp" >> $GITHUB_ENV
echo "SED=sed" >> $GITHUB_ENV
echo "RST2MAN=rst2man" >> $GITHUB_ENV
dpkg -l postgres\* libpq\* gcc\* clang\* libevent\*
- name: "InstallDB / Mac"
if: ${{runner.os == 'macOS'}}
run: |
echo "::group::install"
brew install patchutils gnu-sed docutils libevent postgresql@${{matrix.test.pgver}} autoconf automake
echo "::endgroup::"
echo "/usr/local/opt/docutils/bin" >> $GITHUB_PATH
echo "/usr/local/opt/postgresql@${{matrix.test.pgver}}/bin" >> $GITHUB_PATH
echo "SED=gsed" >> $GITHUB_ENV
echo "RST2MAN=rst2man.py" >> $GITHUB_ENV
- name: "Build"
run: |
./autogen.sh
./configure --prefix=${GITHUB_WORKSPACE}/testinstall
make RST2MAN=${{env.RST2MAN}}
make install
- name: "Install PgQ"
run: |
git clone https://github.com/pgq/pgq
make -C pgq
sudo -nH bash -c "PATH='${PATH}' make -C pgq install"
- name: "StartDB"
run: |
mkdir -p log
LANG=C LC_ALL=C initdb --no-locale data
${SED} -r -i -e "s,^[# ]*(unix_socket_directories).*,\\1='/tmp'," data/postgresql.conf
pg_ctl -D data -l log/pg.log start || { cat log/pg.log ; exit 1; }
sleep 2
- name: "Test"
run: make citest
- name: "StopDB"
run: |
pg_ctl -D data stop
rm -rf data log /tmp/.s.PGSQL*
mingw:
name: ${{matrix.test.os}}, ${{matrix.test.mingw}}
runs-on: ${{matrix.test.os}}
strategy:
matrix:
test:
#- {os: "windows-latest", arch: i686, mingw: mingw32}
- {os: "windows-latest", arch: x86_64, mingw: mingw64}
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
submodules: true
- name: "Setup MSYS"
shell: cmd
run: |
echo C:\msys64\usr\bin>> %GITHUB_PATH%
echo C:\msys64\${{matrix.test.mingw}}\bin>> %GITHUB_PATH%
- name: "InstallDB / mingw / ${{matrix.test.arch}}"
shell: bash
run: |
# search package lists
pacman -Ss libevent
pacman -Ss autoconf
pacman -Ss automake
pacman -Ss libtool
pacman -Ss postgresql
# install
pacman -S --noconfirm --needed \
mingw-w64-${{matrix.test.arch}}-libxml2 \
mingw-w64-${{matrix.test.arch}}-libxslt \
mingw-w64-${{matrix.test.arch}}-gettext \
mingw-w64-${{matrix.test.arch}}-postgresql \
mingw-w64-${{matrix.test.arch}}-python-docutils \
mingw-w64-${{matrix.test.arch}}-libevent \
mingw-w64-${{matrix.test.arch}}-pkgconf \
autoconf automake libtool pkgconf
INCDIR=$(pg_config --includedir)
PG_CPPFLAGS="-I${INCDIR}"
echo "PG_CPPFLAGS=${PG_CPPFLAGS}" >> $GITHUB_ENV
echo "PG_CPPFLAGS=${PG_CPPFLAGS}"
echo "PATH=$PATH"
- name: "Build"
shell: bash
run: |
workspace=$(echo "${GITHUB_WORKSPACE}" | sed -f etc/pathsep.sed)
./autogen.sh
./configure --prefix="${workspace}/testinstall"
make
make install
./pgqd -V
- name: "Install PgQ"
shell: bash
run: |
git clone https://github.com/pgq/pgq
make -C pgq
make -C pgq install
- name: "StartDB"
shell: bash
run: |
mkdir log
initdb.exe --no-locale -U postgres -D data
pg_ctl -D data -l log/pg.log start || { cat log/pg.log ; exit 1; }
sleep 3
- name: "Test"
if: false
shell: bash
run: make citest
- name: "StopDB"
shell: bash
run: |
pg_ctl -D data stop