-
Notifications
You must be signed in to change notification settings - Fork 55
166 lines (141 loc) · 5.57 KB
/
installchecks.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
name: "InstallChecks"
env:
# Use it just for a report
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
# Trigger it each timeon push or pull request. Honestly, it will be redundant
# most of the time, but external pull-request checks don't be missed out.
on:
push:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: "Define PostreSQL major version and set basic environment"
run: |
echo "The action workflow is triggered by the $BRANCH_NAME"
sudo apt install libipc-run-perl
git config --global user.email "[email protected]"
git config --global user.name "CI PgPro admin"
patch_name=$(ls aqo_*.patch|tail -1)
echo "CORE_PATCH_NAME=$patch_name" >> $GITHUB_ENV
# we can get number, otherwise set up master
vers_number=$(echo "$patch_name"|tr -d -c 0-9)
echo "PG_MAJOR_VERSION=$vers_number" >> $GITHUB_ENV
branch_name="REL_${vers_number}_STABLE"
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
- name: "Set master branch name, if needed"
if: env.PG_MAJOR_VERSION == ''
run: |
branch_name="master"
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
# Create workspace directory and environment variable.
# It is the second step because on the first we define versions and branches
- name: "Initial dir"
run: |
git clone -b $PG_BRANCH --depth=1 --single-branch https://github.com/postgres/postgres.git $GITHUB_WORKSPACE/../pg
# Invent variable with full path to PG directory just because github
# actions don't like relative paths ...
cd $GITHUB_WORKSPACE/../pg
echo PG_DIR=`pwd` >> $GITHUB_ENV
- name: "Prepare PG directory"
run: |
cd $PG_DIR
cp -r ../aqo contrib/aqo
patch -p1 --no-backup-if-mismatch < contrib/aqo/$CORE_PATCH_NAME
echo "COPT=-Werror" >> $GITHUB_ENV
echo "CONFIGURE_OPTS=--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert" >> $GITHUB_ENV
# Instance-related environment
echo "$PG_DIR/tmp_install/bin" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$PG_DIR/tmp_install/lib" >> $GITHUB_ENV
echo `pwd`/contrib/aqo/.github/scripts/job >> $GITHUB_PATH
# Just for debug
- name: "Environment (debug output)"
if: ${{ always() }}
run: |
echo "PG_MAJOR_VERSION: $PG_MAJOR_VERSION"
echo "PG_DIR: $PG_DIR"
echo "PG_BRANCH: $PG_BRANCH"
echo "CORE_PATCH_NAME: $CORE_PATCH_NAME"
# See these paths to understand correctness of the instance initialization
echo "PATHs: $PATH"
echo "PG Libs: $LD_LIBRARY_PATH"
- name: "Compilation"
run: |
cd $PG_DIR
echo "COPT: $COPT"
echo "CONFIGURE_OPTS: $CONFIGURE_OPTS"
./configure $CONFIGURE_OPTS CFLAGS="-O2" > /dev/null
make -j4 > /dev/null && make -j4 -C contrib > /dev/null
make install >> make.log && make -C contrib install > /dev/null
- name: "Launch AQO instance"
run: |
cd $PG_DIR
# Launch an instance with AQO extension
aqo_instance_launch.sh
AQO_VERSION=$(psql -t -c "SELECT extversion FROM pg_extension WHERE extname='aqo'")
echo "AQO_VERSION=$AQO_VERSION" >> $GITHUB_ENV
echo "Use AQO v.$AQO_VERSION"
# Pass installcheck in disabled mode
- name: installcheck_disabled
run: |
cd $PG_DIR
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'off'"
psql -c "SELECT pg_reload_conf()"
make installcheck-world
- name: installcheck_disabled_forced_stat
run: |
cd $PG_DIR
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
psql -c "SELECT pg_reload_conf()"
make installcheck-world
- name: installcheck_frozen
run: |
cd $PG_DIR
psql -c "ALTER SYSTEM SET aqo.mode = 'frozen'"
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
psql -c "SELECT pg_reload_conf()"
make installcheck-world
- name: installcheck_controlled
run: |
cd $PG_DIR
psql -c "ALTER SYSTEM SET aqo.mode = 'controlled'"
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
psql -c "SELECT pg_reload_conf()"
make installcheck-world
- name: installcheck_learn
continue-on-error: true
run: |
cd $PG_DIR
psql -c "ALTER SYSTEM SET aqo.mode = 'learn'"
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
psql -c "SELECT pg_reload_conf()"
learn_result=$(make -k installcheck-world)
- name: installcheck_intelligent
continue-on-error: true
run: |
cd $PG_DIR
psql -c "ALTER SYSTEM SET aqo.mode = 'intelligent'"
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
psql -c "SELECT pg_reload_conf()"
make -k installcheck-world
- name: installcheck_forced
continue-on-error: true
run: |
cd $PG_DIR
psql -c "ALTER SYSTEM SET aqo.mode = 'forced'"
psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
psql -c "SELECT pg_reload_conf()"
make -k installcheck-world
# Save Artifacts
- name: Archive artifacts
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.AQO_VERSION }}-${{ env.PG_BRANCH }}-${{ env.CORE_PATCH_NAME }}-artifacts
path: |
${{ env.PG_DIR }}/src/test/regress/regression.diffs
${{ env.PG_DIR }}/logfile.log
${{ env.PG_DIR }}/contrib/aqo/tmp_check/log
retention-days: 2