11name : " InstallChecks"
22
3- on :
4- push :
5-
63env :
4+ # Use it just for a report
75 BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
86
7+ # Trigger it each timeon push or pull request. Honestly, it will be redundant
8+ # most of the time, but external pull-request checks don't be missed out.
9+ on :
10+ push :
11+ pull_request :
12+
913jobs :
1014 build :
1115
1216 runs-on : ubuntu-latest
1317
1418 steps :
15-
16- # Set major PostgreSQL version for all underlying steps
1719 - uses : actions/checkout@v3
18- - name : " Define PostreSQL major version"
20+ - name : " Define PostreSQL major version and set basic environment "
1921 run : |
22+ echo "The action workflow is triggered by the $BRANCH_NAME"
23+ sudo apt install libipc-run-perl
24+ git config --global user.email "[email protected] " 25+ git config --global user.name "CI PgPro admin"
26+
2027 patch_name=$(ls aqo_*.patch|tail -1)
2128 echo "CORE_PATCH_NAME=$patch_name" >> $GITHUB_ENV
2229
@@ -26,47 +33,51 @@ jobs:
2633
2734 branch_name="REL_${vers_number}_STABLE"
2835 echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
29-
3036 - name : " Set master branch name, if needed"
3137 if : env.PG_MAJOR_VERSION == ''
3238 run : |
3339 branch_name="master"
3440 echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
3541
36- - name : " Environment (debug output)"
37- if : ${{ always() }}
42+ # Create workspace directory and environment variable.
43+ # It is the second step because on the first we define versions and branches
44+ - name : " Initial dir"
3845 run : |
39- echo "Use PostgreSQL branch $PG_BRANCH (patch: $CORE_PATCH_NAME)"
40- echo "Deploying to production server on branch" $BRANCH_NAME "(PG $PG_BRANCH)"
41- git config --global user.email "[email protected] " 42- git config --global user.name "CI PgPro admin"
46+ git clone -b $PG_BRANCH --depth=1 --single-branch https://github.com/postgres/postgres.git $GITHUB_WORKSPACE/../pg
47+
48+ # Invent variable with full path to PG directory just because github
49+ # actions don't like relative paths ...
50+ cd $GITHUB_WORKSPACE/../pg
51+ echo PG_DIR=`pwd` >> $GITHUB_ENV
4352
4453 - name : " Prepare PG directory"
4554 run : |
46- sudo apt install libipc-run-perl libxml2-utils libxml2-dev xsltproc libxslt1-dev
47- git clone -b $PG_BRANCH --depth=1 --single-branch https://github.com/postgres/postgres.git $GITHUB_WORKSPACE/../pg
48- cd $GITHUB_WORKSPACE/../pg
55+ cd $PG_DIR
4956 cp -r ../aqo contrib/aqo
5057 patch -p1 --no-backup-if-mismatch < contrib/aqo/$CORE_PATCH_NAME
51-
52- - name : " Paths"
53- run : |
54- cd $GITHUB_WORKSPACE/../pg
5558 echo "COPT=-Werror" >> $GITHUB_ENV
5659 echo "CONFIGURE_OPTS=--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert" >> $GITHUB_ENV
57- echo "$GITHUB_WORKSPACE/../pg/tmp_install/bin" >> $GITHUB_PATH
58- echo "$GITHUB_WORKSPACE/../pg/contrib/aqo/.github/scripts/job" >> $GITHUB_PATH
59- echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/pg/tmp_install/lib" >> $GITHUB_ENV
60- echo "PGDATABASE=`whoami`" >> $GITHUB_ENV
61- echo "PGHOST=localhost" >> $GITHUB_ENV
62- echo "PGDATA=PGDATA" >> $GITHUB_ENV
63- echo "PGUSER=`whoami`" >> $GITHUB_ENV
64- echo "PGPORT=5432" >> $GITHUB_ENV
60+
61+ # Instance-related environment
62+ echo "$PG_DIR/tmp_install/bin" >> $GITHUB_PATH
63+ echo "LD_LIBRARY_PATH=$PG_DIR/tmp_install/lib" >> $GITHUB_ENV
64+ echo `pwd`/contrib/aqo/.github/scripts/job >> $GITHUB_PATH
65+
66+ # Just for debug
67+ - name : " Environment (debug output)"
68+ if : ${{ always() }}
69+ run : |
70+ echo "PG_MAJOR_VERSION: $PG_MAJOR_VERSION"
71+ echo "PG_DIR: $PG_DIR"
72+ echo "PG_BRANCH: $PG_BRANCH"
73+ echo "CORE_PATCH_NAME: $CORE_PATCH_NAME"
74+ # See these paths to understand correctness of the instance initialization
75+ echo "PATHs: $PATH"
76+ echo "PG Libs: $LD_LIBRARY_PATH"
6577
6678 - name : " Compilation"
6779 run : |
68- cd $GITHUB_WORKSPACE/../pg
69- echo "paths: $PATH"
80+ cd $PG_DIR
7081 echo "COPT: $COPT"
7182 echo "CONFIGURE_OPTS: $CONFIGURE_OPTS"
7283 ./configure $CONFIGURE_OPTS CFLAGS="-O2" > /dev/null
7586
7687 - name : " Launch AQO instance"
7788 run : |
78- cd $GITHUB_WORKSPACE/../pg
89+ cd $PG_DIR
7990
8091 # Launch an instance with AQO extension
8192 aqo_instance_launch.sh
@@ -86,29 +97,29 @@ jobs:
8697 # Pass installcheck in disabled mode
8798 - name : installcheck_disabled
8899 run : |
89- cd $GITHUB_WORKSPACE/../pg
100+ cd $PG_DIR
90101 psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'off'"
91102 psql -c "SELECT pg_reload_conf()"
92103 make installcheck-world
93104
94105 - name : installcheck_disabled_forced_stat
95106 run : |
96- cd $GITHUB_WORKSPACE/../pg
107+ cd $PG_DIR
97108 psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
98109 psql -c "SELECT pg_reload_conf()"
99110 make installcheck-world
100111
101112 - name : installcheck_frozen
102113 run : |
103- cd $GITHUB_WORKSPACE/../pg
114+ cd $PG_DIR
104115 psql -c "ALTER SYSTEM SET aqo.mode = 'frozen'"
105116 psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
106117 psql -c "SELECT pg_reload_conf()"
107118 make installcheck-world
108119
109120 - name : installcheck_controlled
110121 run : |
111- cd $GITHUB_WORKSPACE/../pg
122+ cd $PG_DIR
112123 psql -c "ALTER SYSTEM SET aqo.mode = 'controlled'"
113124 psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
114125 psql -c "SELECT pg_reload_conf()"
@@ -117,7 +128,7 @@ jobs:
117128 - name : installcheck_learn
118129 continue-on-error : true
119130 run : |
120- cd $GITHUB_WORKSPACE/../pg
131+ cd $PG_DIR
121132 psql -c "ALTER SYSTEM SET aqo.mode = 'learn'"
122133 psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
123134 psql -c "SELECT pg_reload_conf()"
@@ -126,7 +137,7 @@ jobs:
126137 - name : installcheck_intelligent
127138 continue-on-error : true
128139 run : |
129- cd $GITHUB_WORKSPACE/../pg
140+ cd $PG_DIR
130141 psql -c "ALTER SYSTEM SET aqo.mode = 'intelligent'"
131142 psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
132143 psql -c "SELECT pg_reload_conf()"
@@ -135,7 +146,7 @@ jobs:
135146 - name : installcheck_forced
136147 continue-on-error : true
137148 run : |
138- cd $GITHUB_WORKSPACE/../pg
149+ cd $PG_DIR
139150 psql -c "ALTER SYSTEM SET aqo.mode = 'forced'"
140151 psql -c "ALTER SYSTEM SET aqo.force_collect_stat = 'on'"
141152 psql -c "SELECT pg_reload_conf()"
@@ -148,8 +159,8 @@ jobs:
148159 with :
149160 name : ${{ env.AQO_VERSION }}-${{ env.PG_BRANCH }}-${{ env.CORE_PATCH_NAME }}-artifacts
150161 path : |
151- pg /src/test/regress/regression.diffs
152- pg /logfile.log
153- pg /contrib/aqo/tmp_check/log
162+ ${{ env.PG_DIR }} /src/test/regress/regression.diffs
163+ ${{ env.PG_DIR }} /logfile.log
164+ ${{ env.PG_DIR }} /contrib/aqo/tmp_check/log
154165 retention-days : 2
155166
0 commit comments