-
Notifications
You must be signed in to change notification settings - Fork 54
Generalize basic CI script #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
name: 'C/C++ CI for the stable13' | ||
name: 'AQO basic CI' | ||
|
||
on: | ||
push: | ||
branches: [ stable13 ] | ||
pull_request: | ||
branches: [ stable13 ] | ||
|
||
env: | ||
BRANCH_NAME: ${{ github.head_ref || github.ref_name }} | ||
|
@@ -15,45 +13,70 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: pg | ||
- uses: actions/checkout@v3 | ||
- name: "Define PostreSQL major version" | ||
run: | | ||
sudo apt install libipc-run-perl | ||
echo "$(ls -la)" | ||
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 | ||
|
||
echo "COPT=-Werror" >> $GITHUB_ENV | ||
echo "CONFIGURE_OPTS=--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert" >> $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 | ||
|
||
echo "Deploying to production server on branch" $BRANCH_NAME | ||
- name: "Environment (debug output)" | ||
if: ${{ always() }} | ||
run: | | ||
echo "Use PostgreSQL branch $PG_BRANCH (patch: $CORE_PATCH_NAME)" | ||
echo "COPT: $COPT" | ||
echo "CONFIGURE_OPTS: $CONFIGURE_OPTS" | ||
echo "Deploying to production server on branch" $BRANCH_NAME "(PG $PG_BRANCH)" | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "CI PgPro admin" | ||
export COPT=-Werror | ||
export CONFIGURE_OPTS="--prefix=`pwd`/tmp_install --enable-tap-tests --enable-cassert" | ||
git clone https://github.com/postgres/postgres.git pg | ||
cd pg | ||
|
||
git checkout REL_13_STABLE | ||
git clone https://github.com/postgrespro/aqo.git contrib/aqo | ||
git -C contrib/aqo checkout $BRANCH_NAME | ||
patch -p1 --no-backup-if-mismatch < contrib/aqo/aqo_pg13.patch | ||
./configure $CONFIGURE_OPTS CFLAGS="-O2" | ||
|
||
- name: "Prepare PG directory" | ||
run: | | ||
git clone -b $PG_BRANCH --depth=1 --single-branch https://github.com/postgres/postgres.git $GITHUB_WORKSPACE/../pg | ||
cd $GITHUB_WORKSPACE/../pg | ||
ls -la | ||
cp -r ../aqo contrib/aqo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не обязательно, но думаю, можно не копировать, а переместить файлы, так как у каждого раннера, скажем так свои файлы, и, если не перемещать,можно не копировать .git. Я использовала такую команду, если адаптировать ее под анный раннер: |
||
patch -p1 --no-backup-if-mismatch < contrib/aqo/$CORE_PATCH_NAME | ||
|
||
- name: "make check" | ||
run: | | ||
sudo apt install libipc-run-perl | ||
|
||
cd $GITHUB_WORKSPACE/../pg | ||
./configure $CONFIGURE_OPTS CFLAGS="-O2" > /dev/null | ||
make -j4 > /dev/null && make -j4 -C contrib > /dev/null | ||
env CLIENTS=50 THREADS=50 make -C contrib/aqo check | ||
|
||
echo "Use AQO with debug code included" | ||
git clean -fdx | ||
git -C contrib/aqo clean -fdx | ||
./configure $CONFIGURE_OPTS CFLAGS="-DAQO_DEBUG_PRINT -O0" | ||
./configure $CONFIGURE_OPTS CFLAGS="-DAQO_DEBUG_PRINT -O0" > /dev/null | ||
make -j4 > /dev/null && make -j4 -C contrib > /dev/null | ||
env CLIENTS=50 THREADS=50 make -C contrib/aqo check | ||
- name: Archive regression.diffs | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: regression_diffs | ||
path: /home/runner/work/aqo/aqo/pg/contrib/aqo/regression.diffs | ||
retention-days: 1 | ||
- name: Archive TAP tests log files | ||
|
||
- name: Archive artifacts | ||
if: ${{ always() }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: tap_logs | ||
name: make_check_logs | ||
path: | | ||
log | ||
retention-days: 1 | ||
|
||
/home/runner/work/aqo/pg/contrib/aqo/regression.diffs | ||
/home/runner/work/aqo/pg/contrib/aqo/log | ||
/home/runner/work/aqo/pg/contrib/aqo/tmp_check/log | ||
retention-days: 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
предлагается улучшение:
тут vers_number будет пустым, если название патча было, например: aqo_master.patch.
Можно без дополнительной проверки сразу добавить блок на else:
vers_number="$(echo "$patch_name"|tr -d -c 0-9)"'master'
тогда vers_number сразу будет определено и ниже дополнительная проверка не нужна