-
Notifications
You must be signed in to change notification settings - Fork 92
143 lines (129 loc) · 7.83 KB
/
upgrade-test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
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 "upgrade-path-list=$UPGRADE_PATH_LIST" >> $GITHUB_OUTPUT
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 "base-version=$(
yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path"[0].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml
)" >> $GITHUB_OUTPUT &&
echo "final-version=$(
yq '."upgrade-version"[${{ matrix.upgrade-path.id }}]."upgrade-path"[-1].version' ${{ github.workspace }}/.github/configuration/upgrade-test-configuration.yml
)" >> $GITHUB_OUTPUT
- 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 "base-engine-branch=$(
yq '."${{ steps.read-base-and-final-version.outputs.base-version }}".engine_branch' ${{ github.workspace }}/.github/template/version-branch-template.yml
)" >> $GITHUB_OUTPUT &&
echo "base-extension-branch=$(
yq '."${{ steps.read-base-and-final-version.outputs.base-version }}".extension_branch' ${{ github.workspace }}/.github/template/version-branch-template.yml
)" >> $GITHUB_OUTPUT &&
echo "base-dir=$(echo psql$(awk -F. '{print $1}' <<< ${{ steps.read-base-and-final-version.outputs.base-version }}))" >> $GITHUB_OUTPUT
- 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 }}
antlr_version: ${{ (steps.read-base-and-final-version.outputs.base-version == 'source.latest' || fromJSON(steps.read-base-and-final-version.outputs.base-version) >= 16.7 ) && '4.13.2' || '4.9.3' }}
- 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