Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb454f65

Browse files
committed
CI Refactoring: Unify code of all three CI workflows
1 parente70b9d9 commitb454f65

File tree

3 files changed

+170
-133
lines changed

3 files changed

+170
-133
lines changed

‎.github/workflows/c-cpp.yml

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name:'AQO basic CI'
22

3-
on:
4-
pull_request:
5-
63
env:
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+
913
jobs:
1014
build:
1115

@@ -15,6 +19,11 @@ jobs:
1519
-uses:actions/checkout@v3
1620
-name:"Define PostreSQL major version"
1721
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 "ci@postgrespro.ru"
25+
git config --global user.name "CI PgPro admin"
26+
1827
patch_name=$(ls aqo_*.patch|tail -1)
1928
echo "CORE_PATCH_NAME=$patch_name" >> $GITHUB_ENV
2029
@@ -24,38 +33,43 @@ jobs:
2433
2534
branch_name="REL_${vers_number}_STABLE"
2635
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
27-
28-
echo "COPT=-Werror" >> $GITHUB_ENV
29-
echo "CONFIGURE_OPTS=--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert" >> $GITHUB_ENV
30-
3136
-name:"Set master branch name, if needed"
3237
if:env.PG_MAJOR_VERSION == ''
3338
run:|
3439
branch_name="master"
3540
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
3641
37-
-name:"Environment (debug output)"
38-
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"
3945
run:|
40-
echo "Use PostgreSQL branch$PG_BRANCH(patch: $CORE_PATCH_NAME)"
41-
echo "COPT: $COPT"
42-
echo "CONFIGURE_OPTS: $CONFIGURE_OPTS"
43-
echo "Deploying to production server on branch" $BRANCH_NAME "(PG $PG_BRANCH)"
44-
git config --global user.email "ci@postgrespro.ru"
45-
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
4652
4753
-name:"Prepare PG directory"
4854
run:|
49-
git clone -b $PG_BRANCH --depth=1 --single-branch https://github.com/postgres/postgres.git $GITHUB_WORKSPACE/../pg
50-
cd $GITHUB_WORKSPACE/../pg
55+
cd $PG_DIR
5156
cp -r ../aqo contrib/aqo
5257
patch -p1 --no-backup-if-mismatch < contrib/aqo/$CORE_PATCH_NAME
58+
echo "COPT=-Werror" >> $GITHUB_ENV
59+
echo "CONFIGURE_OPTS=--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert" >> $GITHUB_ENV
5360
54-
-name:"make check"
61+
# Just for debug
62+
-name:"Environment (debug output)"
63+
if:${{ always() }}
5564
run:|
56-
sudo apt install libipc-run-perl
65+
echo "PG_MAJOR_VERSION: $PG_MAJOR_VERSION"
66+
echo "PG_DIR: $PG_DIR"
67+
echo "PG_BRANCH: $PG_BRANCH"
68+
echo "CORE_PATCH_NAME: $CORE_PATCH_NAME"
5769
58-
cd $GITHUB_WORKSPACE/../pg
70+
-name:"make check"
71+
run:|
72+
cd $PG_DIR
5973
./configure $CONFIGURE_OPTS CFLAGS="-O2" > /dev/null
6074
make -j4 > /dev/null && make -j4 -C contrib > /dev/null
6175
env CLIENTS=50 THREADS=50 make -C contrib/aqo check
@@ -73,7 +87,7 @@ jobs:
7387
with:
7488
name:make_check_logs
7589
path:|
76-
/home/runner/work/aqo/pg/contrib/aqo/regression.diffs
77-
/home/runner/work/aqo/pg/contrib/aqo/log
78-
/home/runner/work/aqo/pg/contrib/aqo/tmp_check/log
90+
${{ env.PG_DIR }}/contrib/aqo/regression.diffs
91+
${{ env.PG_DIR }}/contrib/aqo/log
92+
${{ env.PG_DIR }}/contrib/aqo/tmp_check/log
7993
retention-days:7

‎.github/workflows/installchecks.yml

Lines changed: 52 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
name:"InstallChecks"
22

3-
on:
4-
push:
5-
63
env:
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+
913
jobs:
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 "ci@postgrespro.ru"
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 "ci@postgrespro.ru"
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
@@ -75,7 +86,7 @@ jobs:
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

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp