Skip to content

Fix date functions to take into account the timezone setting (#2947) #67

Fix date functions to take into account the timezone setting (#2947)

Fix date functions to take into account the timezone setting (#2947) #67

Workflow file for this run

name: Version Upgrade Test Framework
on: [push, pull_request]
jobs:
generate-version-upgrade-tests:
name: Generate Version Upgrade Tests
runs-on: ubuntu-20.04
outputs:
upgrade-path-list: ${{ steps.generate-upgrade-path.outputs.upgrade-path-list }}
steps:
- uses: actions/checkout@v2
- name: "Read and setup upgrade path list from configuration"
id: generate-upgrade-path
run: |
config="'$(yq -o=json ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml)'"
config=$(echo $config | sed "s/\"/\\\\\"/g")
UPGRADE_PATH_LIST=$(node -e "let k = JSON.parse($config); let p = k['upgrade-version'].map((itm, index) => ({ id: index, path: itm['upgrade-path'].map(i => i.version.toString().replace(/[.]/g, \"_\")), server_collation_name: itm['babelfishpg_tsql_server_collation_name'] ? itm['babelfishpg_tsql_server_collation_name'] : \"default\", title: itm['upgrade-path'].map(i => i.version.toString().replace(/[.]/g, \"_\")).join(\"-\") + (itm['babelfishpg_tsql_server_collation_name'] ? (\" with server-collation - \" + itm['babelfishpg_tsql_server_collation_name'] + \" \") : \"\"), last_version: itm['upgrade-path'][itm['upgrade-path'].length - 1].version.toString().replace(/[.]/g, \"_\") })); console.log(JSON.stringify(p));")
echo "::set-output name=upgrade-path-list::$UPGRADE_PATH_LIST"
run-version-upgrade-test:
needs: generate-version-upgrade-tests
strategy:
fail-fast: false
matrix:
upgrade-path: ${{ fromJson(needs.generate-version-upgrade-tests.outputs.upgrade-path-list) }}
name: Run Version Upgrade Test for ${{ matrix.upgrade-path.title }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Install yq - yaml parser
id: install-yq
if: always()
run: sudo snap install yq
- name: Read Base Version and Final Version
id: read-base-and-final-version
if: always() && steps.install-yq.outcome == 'success'
run: >
echo "::set-output name=base-version::$(
yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path"[0].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml
)" &&
echo "::set-output name=final-version::$(
yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path"[-1].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml
)"
- name: Find Engine and Extension Branches for Base Version ${{ steps.read-base-and-final-version.outputs.base-version }}
id: find-branch
if: always() && steps.read-base-and-final-version.outcome == 'success'
run: >
echo "::set-output name=base-engine-branch::$(
yq '."${{ steps.read-base-and-final-version.outputs.base-version }}".engine_branch' ${{ github.workspace }}/.github/template/version-branch-template.yml
)" &&
echo "::set-output name=base-extension-branch::$(
yq '."${{ steps.read-base-and-final-version.outputs.base-version }}".extension_branch' ${{ github.workspace }}/.github/template/version-branch-template.yml
)" &&
echo "::set-output name=base-dir::$(echo psql$(awk -F. '{print $1}' <<< ${{ steps.read-base-and-final-version.outputs.base-version }}))"
- name: Setup Base Version ${{ steps.read-base-and-final-version.outputs.base-version }} and Run Preparation Tests
id: setup-base-version
if: always() && steps.find-branch.outcome == 'success'
uses: ./.github/composite-actions/setup-base-version
with:
engine_branch: ${{ steps.find-branch.outputs.base-engine-branch }}
extension_branch: ${{ steps.find-branch.outputs.base-extension-branch }}
install_dir: ${{ steps.find-branch.outputs.base-dir }}
migration_mode: 'multi-db'
server_collation_name: ${{ matrix.upgrade-path.server_collation_name }}
- name: Setup Upgrade Version Composite Action
id: setup-upgrade-ver-ca
if: always() && steps.install-yq.outcome == 'success' && steps.setup-base-version.outcome == 'success'
uses: ./.github/composite-actions/setup-upgrade-version-ca
with:
base_version: ${{ steps.read-base-and-final-version.outputs.base-version }}
server_collation_name: ${{ matrix.upgrade-path.server_collation_name }}
- name: Upgrade till final version ${{ steps.read-base-and-final-version.outputs.final-version }} and run verify scripts
id: upgrade-and-test
if: always() && steps.setup-upgrade-ver-ca.outcome == 'success'
uses: ./.github/composite-actions/upgrade-version
# Due to some action/checkout's in previous step the dynamically generated upgrade-version composite action isn't available,
# hence to avoid error in post action step recreated the upgrade-version composite action
- name: Recreate Upgrade Version Composite Action
if: always() && steps.install-yq.outcome == 'success' && steps.setup-base-version.outcome == 'success'
uses: ./.github/composite-actions/setup-upgrade-version-ca
with:
base_version: ${{ steps.read-base-and-final-version.outputs.base-version }}
- name: Rename Test Summary Files
id: test-file-rename
if: always() && (steps.setup-base-version.outcome == 'failure' || steps.upgrade-and-test.outcome == 'failure')
run: |
cd test/JDBC/Info
timestamp=`ls -Art | tail -n 1`
cd $timestamp
mkdir -p ~/upgrade
cp $timestamp.diff ~/upgrade/output-diff.diff
cp "$timestamp"_runSummary.log ~/upgrade/run-summary.log
mkdir -p ~/failed-testscript-outputs
# copy output files of failed test scripts
BASE_VERSION=${{ steps.read-base-and-final-version.outputs.base-version }}
BASE_VERSION=${BASE_VERSION/./_}
FINAL_VERSION=${{ steps.read-base-and-final-version.outputs.final-version }}
FINAL_VERSION=${FINAL_VERSION/./_}
if [[ "$BASE_VERSION" == *"latest"* ]]; then
BASE_VERSION="latest"
fi
if [[ "$FINAL_VERSION" == *"latest"* ]]; then
FINAL_VERSION="latest"
fi
for f in $(grep "[A-Za-z_\-]*:[ ]*Failed" $timestamp"_runSummary.log" | cut -d ":" -f 1);
do
if [[ -f ../../output/$f".out" ]]; then
cp ../../output/$f".out" ~/failed-testscript-outputs/$f".out"
elif [[ -f ../../output/$BASE_VERSION"__preparation__"$f".out" ]]; then
cp ../../output/$BASE_VERSION"__preparation__"$f".out" ~/failed-testscript-outputs/$BASE_VERSION"__preparation__"$f".out"
else
cp ../../output/$FINAL_VERSION"__verification_cleanup__"$BASE_VERSION"__"$f".out" ~/failed-testscript-outputs/$FINAL_VERSION"__verification_cleanup__"$BASE_VERSION"__"$f".out"
fi
done
- name: Upload Logs
if: always() && (steps.setup-base-version.outcome == 'failure' || steps.upgrade-and-test.outcome == 'failure')
uses: actions/upload-artifact@v4
with:
name: upgrade-logs-${{ matrix.upgrade-path.title }}
path: |
~/upgrade/*.log
~/upgrade/*.diff
~/upgrade/*.out
~/upgrade/*.csv
~/psql*/data/logfile
~/psql*/data/pg_upgrade_output.d/*
~/failed-testscript-outputs
- name: Check and upload coredumps
if: always() && (steps.setup-base-version.outcome == 'failure' || steps.upgrade-and-test.outcome == 'failure')
uses: ./.github/composite-actions/upload-coredump