Skip to content

Commit 43efdb5

Browse files
committed
Generalize basic CI script
reviewed-by: a.rybakina
1 parent f84caae commit 43efdb5

File tree

1 file changed

+52
-29
lines changed

1 file changed

+52
-29
lines changed

.github/workflows/c-cpp.yml

Lines changed: 52 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
name: 'C/C++ CI for the stable13'
1+
name: 'AQO basic CI'
22

33
on:
44
push:
5-
branches: [ stable13 ]
65
pull_request:
7-
branches: [ stable13 ]
86

97
env:
108
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
@@ -15,45 +13,70 @@ jobs:
1513
runs-on: ubuntu-latest
1614

1715
steps:
18-
- name: pg
16+
- uses: actions/checkout@v3
17+
- name: "Define PostreSQL major version"
1918
run: |
20-
sudo apt install libipc-run-perl
19+
echo "$(ls -la)"
20+
patch_name=$(ls aqo_*.patch|tail -1)
21+
echo "CORE_PATCH_NAME=$patch_name" >> $GITHUB_ENV
22+
23+
# we can get number, otherwise set up master
24+
vers_number=$(echo "$patch_name"|tr -d -c 0-9)
25+
echo "PG_MAJOR_VERSION=$vers_number" >> $GITHUB_ENV
26+
27+
branch_name="REL_${vers_number}_STABLE"
28+
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
29+
30+
echo "COPT=-Werror" >> $GITHUB_ENV
31+
echo "CONFIGURE_OPTS=--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert" >> $GITHUB_ENV
32+
33+
- name: "Set master branch name, if needed"
34+
if: env.PG_MAJOR_VERSION == ''
35+
run: |
36+
branch_name="master"
37+
echo "PG_BRANCH=$branch_name" >> $GITHUB_ENV
2138
22-
echo "Deploying to production server on branch" $BRANCH_NAME
39+
- name: "Environment (debug output)"
40+
if: ${{ always() }}
41+
run: |
42+
echo "Use PostgreSQL branch $PG_BRANCH (patch: $CORE_PATCH_NAME)"
43+
echo "COPT: $COPT"
44+
echo "CONFIGURE_OPTS: $CONFIGURE_OPTS"
45+
echo "Deploying to production server on branch" $BRANCH_NAME "(PG $PG_BRANCH)"
2346
git config --global user.email "[email protected]"
2447
git config --global user.name "CI PgPro admin"
25-
export COPT=-Werror
26-
export CONFIGURE_OPTS="--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert"
27-
git clone https://github.com/postgres/postgres.git pg
28-
cd pg
29-
30-
git checkout REL_13_STABLE
31-
git clone https://github.com/postgrespro/aqo.git contrib/aqo
32-
git -C contrib/aqo checkout $BRANCH_NAME
33-
patch -p1 --no-backup-if-mismatch < contrib/aqo/aqo_pg13.patch
34-
./configure $CONFIGURE_OPTS CFLAGS="-O2"
48+
49+
- name: "Prepare PG directory"
50+
run: |
51+
git clone -b $PG_BRANCH --depth=1 --single-branch https://github.com/postgres/postgres.git $GITHUB_WORKSPACE/../pg
52+
cd $GITHUB_WORKSPACE/../pg
53+
ls -la
54+
cp -r ../aqo contrib/aqo
55+
patch -p1 --no-backup-if-mismatch < contrib/aqo/$CORE_PATCH_NAME
56+
57+
- name: "make check"
58+
run: |
59+
sudo apt install libipc-run-perl
60+
61+
cd $GITHUB_WORKSPACE/../pg
62+
./configure $CONFIGURE_OPTS CFLAGS="-O2" > /dev/null
3563
make -j4 > /dev/null && make -j4 -C contrib > /dev/null
3664
env CLIENTS=50 THREADS=50 make -C contrib/aqo check
3765
3866
echo "Use AQO with debug code included"
3967
git clean -fdx
4068
git -C contrib/aqo clean -fdx
41-
./configure $CONFIGURE_OPTS CFLAGS="-DAQO_DEBUG_PRINT -O0"
69+
./configure $CONFIGURE_OPTS CFLAGS="-DAQO_DEBUG_PRINT -O0" > /dev/null
4270
make -j4 > /dev/null && make -j4 -C contrib > /dev/null
4371
env CLIENTS=50 THREADS=50 make -C contrib/aqo check
44-
- name: Archive regression.diffs
45-
if: ${{ always() }}
46-
uses: actions/upload-artifact@v3
47-
with:
48-
name: regression_diffs
49-
path: /home/runner/work/aqo/aqo/pg/contrib/aqo/regression.diffs
50-
retention-days: 1
51-
- name: Archive TAP tests log files
72+
73+
- name: Archive artifacts
5274
if: ${{ always() }}
5375
uses: actions/upload-artifact@v3
5476
with:
55-
name: tap_logs
77+
name: make_check_logs
5678
path: |
57-
log
58-
retention-days: 1
59-
79+
/home/runner/work/aqo/pg/contrib/aqo/regression.diffs
80+
/home/runner/work/aqo/pg/contrib/aqo/log
81+
/home/runner/work/aqo/pg/contrib/aqo/tmp_check/log
82+
retention-days: 7

0 commit comments

Comments
 (0)