|
39 | 39 |
|
40 | 40 | CLI_ARGS=$1
|
41 | 41 |
|
| 42 | + |
| 43 | +################################ |
| 44 | +# Run tests and exist with --test |
| 45 | +################################ |
| 46 | + |
| 47 | +function run_app_smoke_tests { |
| 48 | + # Call romp with an archive to run the smoke tests on the selected |
| 49 | + # operating system remotely using Azure |
| 50 | + # |
| 51 | + # Arguments: |
| 52 | + # operating_system: One of windows, linux or macos |
| 53 | + |
| 54 | + operating_system=$1 |
| 55 | + |
| 56 | + echo " " |
| 57 | + echo "### Testing app on OS: $operating_system" |
| 58 | + archive_to_test=$(ls -1 -R release/archives/ | grep "$PYTHON_APP_VERSION-$operating_system") |
| 59 | + |
| 60 | + echo "#### Testing $archive_to_test with Python $PYTHON_APP_DOT_VERSION on OS: $operating_system" |
| 61 | + |
| 62 | + # Check checksum of archive and script since it transits through file.io |
| 63 | + sha_arch=$(sha256sum release/archives/$archive_to_test | awk '{ print $1 }') |
| 64 | + sha_py=$(sha256sum etc/release/scancode_release_tests.py | awk '{ print $1 }') |
| 65 | + |
| 66 | + echo "#### Creating a temp archive that contains the tested archive: $archive_file and the test script" |
| 67 | + archive_file=input.tar.gz |
| 68 | + tar -czf $archive_file \ |
| 69 | + -C release/archives $archive_to_test \ |
| 70 | + -C ../../etc/release scancode_release_tests.py |
| 71 | + |
| 72 | + tar -tvf $archive_file |
| 73 | + |
| 74 | + echo "#### Remote test command: python scancode_release_tests.py app $archive_to_test sha_arch:$sha_arch sha_py:$sha_py" |
| 75 | + |
| 76 | + romp \ |
| 77 | + --interpreter cpython \ |
| 78 | + --architecture x86_64 \ |
| 79 | + --check-period 5 \ |
| 80 | + --version $PYTHON_APP_DOT_VERSION \ |
| 81 | + --platform $operating_system \ |
| 82 | + --archive-file $archive_file \ |
| 83 | + --command "python scancode_release_tests.py app $archive_to_test $sha_arch $sha_py" |
| 84 | + |
| 85 | + echo "#### RELEASE TEST: Completed App tests of $archive_to_test with Python $PYTHON_APP_DOT_VERSION on OS: $operating_system" |
| 86 | +} |
| 87 | + |
| 88 | + |
| 89 | +function run_pypi_smoke_tests { |
| 90 | + # Call romp with a PyPI archive to pip install and run the smoke tests on |
| 91 | + # the selected Python and operating system remotely using Azure |
| 92 | + # |
| 93 | + # Arguments: |
| 94 | + # dist: One of whl for wheel, or tar.gz for sdist |
| 95 | + # python_dot_versions: run with these Python version as in "3.6 3.7" |
| 96 | + # operating_systems: run on these operating_systems as in "windows linux macos" |
| 97 | + |
| 98 | + dist=$1 |
| 99 | + python_dot_versions=$2 |
| 100 | + operating_systems=$3 |
| 101 | + |
| 102 | + archive_to_test=$(ls -1 -R release/pypi | grep "$dist") |
| 103 | + echo " " |
| 104 | + echo "### Testing $archive_to_test with Pythons: $python_dot_versions on OSses: $operating_systems" |
| 105 | + |
| 106 | + # Check checksum of archive and script since it transits through file.io |
| 107 | + sha_arch=$(sha256sum release/pypi/$archive_to_test | awk '{ print $1 }') |
| 108 | + sha_py=$(sha256sum etc/release/scancode_release_tests.py | awk '{ print $1 }') |
| 109 | + |
| 110 | + echo "#### Creating a temp archive that contains the tested archive: $archive_file and the test script" |
| 111 | + archive_file=input.tar.gz |
| 112 | + tar -czf $archive_file \ |
| 113 | + -C release/pypi $archive_to_test \ |
| 114 | + -C ../../etc/release scancode_release_tests.py |
| 115 | + |
| 116 | + tar -tvf $archive_file |
| 117 | + |
| 118 | + echo "#### Remote test command: python scancode_release_tests.py pypi $archive_to_test $sha_arch $sha_py" |
| 119 | + |
| 120 | + # build options for Python versions and OS |
| 121 | + ver_opts=" " |
| 122 | + for pdv in $python_dot_versions |
| 123 | + do |
| 124 | + ver_opts="$ver_opts --version $pdv" |
| 125 | + done |
| 126 | + |
| 127 | + os_opts=" " |
| 128 | + for os in $operating_systems |
| 129 | + do |
| 130 | + os_opts="$os_opts --platform $os" |
| 131 | + done |
| 132 | + |
| 133 | + romp \ |
| 134 | + --interpreter cpython \ |
| 135 | + --architecture x86_64 \ |
| 136 | + --check-period 5 \ |
| 137 | + $ver_opts \ |
| 138 | + $os_opts \ |
| 139 | + --archive-file $archive_file \ |
| 140 | + --command "python scancode_release_tests.py pypi $archive_to_test $sha_arch $sha_py" |
| 141 | + |
| 142 | + echo "#### RELEASE TEST: Completed PyPI tests of $archive_to_test with Pythons: $python_dot_versions on OSses: $operating_systems" |
| 143 | + |
| 144 | +} |
| 145 | +if [ "$CLI_ARGS" == "--test" ]; then |
| 146 | + echo "##########################################################################" |
| 147 | + echo "### TESTING build for Python: $PYTHON_APP_VERSIONS on OS: $OPERATING_SYSTEMS" |
| 148 | + for operating_system in $OPERATING_SYSTEMS |
| 149 | + do |
| 150 | + run_app_smoke_tests $operating_system |
| 151 | + done |
| 152 | + |
| 153 | + echo "##########################################################################" |
| 154 | + echo "### TESTING PyPI archives for Python: $PYTHON_PYPI_TESTS_DOT_VERSIONS on OS: $OPERATING_SYSTEMS" |
| 155 | + run_pypi_smoke_tests .whl "$PYTHON_PYPI_TESTS_DOT_VERSIONS" "$OPERATING_SYSTEMS" |
| 156 | + run_pypi_smoke_tests .tar.gz "$PYTHON_PYPI_TESTS_DOT_VERSIONS" "$OPERATING_SYSTEMS" |
| 157 | + |
| 158 | + set +e |
| 159 | + set +x |
| 160 | + exit |
| 161 | +fi |
| 162 | + |
| 163 | + |
| 164 | + |
| 165 | + |
42 | 166 | echo "##########################################################################"
|
43 | 167 | echo "### BUILDING App for Python: $PYTHON_APP_VERSIONS on OS: $OPERATING_SYSTEMS"
|
44 | 168 |
|
45 | 169 |
|
| 170 | + |
| 171 | + |
46 | 172 | ################################
|
47 | 173 | # Setup
|
48 | 174 | ################################
|
@@ -194,123 +320,6 @@ echo "## RELEASE: archives built and ready for test and publishing"
|
194 | 320 | find release -ls
|
195 | 321 |
|
196 | 322 |
|
197 |
| -################################ |
198 |
| -# Run optional smoke tests |
199 |
| -################################ |
200 |
| - |
201 |
| -function run_app_smoke_tests { |
202 |
| - # Call romp with an archive to run the smoke tests on the selected |
203 |
| - # operating system remotely using Azure |
204 |
| - # |
205 |
| - # Arguments: |
206 |
| - # operating_system: One of windows, linux or macos |
207 |
| - |
208 |
| - operating_system=$1 |
209 |
| - |
210 |
| - echo " " |
211 |
| - echo "### Testing app on OS: $operating_system" |
212 |
| - archive_to_test=$(ls -1 -R release/archives/ | grep "$PYTHON_APP_VERSION-$operating_system") |
213 |
| - |
214 |
| - echo "#### Testing $archive_to_test with Python $PYTHON_APP_DOT_VERSION on OS: $operating_system" |
215 |
| - |
216 |
| - # Check checksum of archive and script since it transits through file.io |
217 |
| - sha_arch=$(sha256sum release/archives/$archive_to_test | awk '{ print $1 }') |
218 |
| - sha_py=$(sha256sum etc/release/scancode_release_tests.py | awk '{ print $1 }') |
219 |
| - |
220 |
| - echo "#### Creating a temp archive that contains the tested archive: $archive_file and the test script" |
221 |
| - archive_file=input.tar.gz |
222 |
| - tar -czf $archive_file \ |
223 |
| - -C release/archives $archive_to_test \ |
224 |
| - -C ../../etc/release scancode_release_tests.py |
225 |
| - |
226 |
| - tar -tvf $archive_file |
227 |
| - |
228 |
| - echo "#### Remote test command: python scancode_release_tests.py app $archive_to_test sha_arch:$sha_arch sha_py:$sha_py" |
229 |
| - |
230 |
| - romp \ |
231 |
| - --interpreter cpython \ |
232 |
| - --architecture x86_64 \ |
233 |
| - --check-period 5 \ |
234 |
| - --version $PYTHON_APP_DOT_VERSION \ |
235 |
| - --platform $operating_system \ |
236 |
| - --archive-file $archive_file \ |
237 |
| - --command "python scancode_release_tests.py app $archive_to_test $sha_arch $sha_py" |
238 |
| - |
239 |
| - echo "#### RELEASE TEST: Completed App tests of $archive_to_test with Python $PYTHON_APP_DOT_VERSION on OS: $operating_system" |
240 |
| -} |
241 |
| - |
242 |
| - |
243 |
| -function run_pypi_smoke_tests { |
244 |
| - # Call romp with a PyPI archive to pip install and run the smoke tests on |
245 |
| - # the selected Python and operating system remotely using Azure |
246 |
| - # |
247 |
| - # Arguments: |
248 |
| - # dist: One of whl for wheel, or tar.gz for sdist |
249 |
| - # python_dot_versions: run with these Python version as in "3.6 3.7" |
250 |
| - # operating_systems: run on these operating_systems as in "windows linux macos" |
251 |
| - |
252 |
| - dist=$1 |
253 |
| - python_dot_versions=$2 |
254 |
| - operating_systems=$3 |
255 |
| - |
256 |
| - archive_to_test=$(ls -1 -R release/pypi | grep "$dist") |
257 |
| - echo " " |
258 |
| - echo "### Testing $archive_to_test with Pythons: $python_dot_versions on OSses: $operating_systems" |
259 |
| - |
260 |
| - # Check checksum of archive and script since it transits through file.io |
261 |
| - sha_arch=$(sha256sum release/pypi/$archive_to_test | awk '{ print $1 }') |
262 |
| - sha_py=$(sha256sum etc/release/scancode_release_tests.py | awk '{ print $1 }') |
263 |
| - |
264 |
| - echo "#### Creating a temp archive that contains the tested archive: $archive_file and the test script" |
265 |
| - archive_file=input.tar.gz |
266 |
| - tar -czf $archive_file \ |
267 |
| - -C release/pypi $archive_to_test \ |
268 |
| - -C ../../etc/release scancode_release_tests.py |
269 |
| - |
270 |
| - tar -tvf $archive_file |
271 |
| - |
272 |
| - echo "#### Remote test command: python scancode_release_tests.py pypi $archive_to_test $sha_arch $sha_py" |
273 |
| - |
274 |
| - # build options for Python versions and OS |
275 |
| - ver_opts=" " |
276 |
| - for pdv in $python_dot_versions |
277 |
| - do |
278 |
| - ver_opts="$ver_opts --version $pdv" |
279 |
| - done |
280 |
| - |
281 |
| - os_opts=" " |
282 |
| - for os in $operating_systems |
283 |
| - do |
284 |
| - os_opts="$os_opts --platform $os" |
285 |
| - done |
286 |
| - |
287 |
| - romp \ |
288 |
| - --interpreter cpython \ |
289 |
| - --architecture x86_64 \ |
290 |
| - --check-period 5 \ |
291 |
| - $ver_opts \ |
292 |
| - $os_opts \ |
293 |
| - --archive-file $archive_file \ |
294 |
| - --command "python scancode_release_tests.py pypi $archive_to_test $sha_arch $sha_py" |
295 |
| - |
296 |
| - echo "#### RELEASE TEST: Completed PyPI tests of $archive_to_test with Pythons: $python_dot_versions on OSses: $operating_systems" |
297 |
| - |
298 |
| -} |
299 |
| - |
300 |
| - |
301 |
| -if [ "$CLI_ARGS" == "--test" ]; then |
302 |
| - for operating_system in $OPERATING_SYSTEMS |
303 |
| - do |
304 |
| - run_app_smoke_tests $operating_system |
305 |
| - done |
306 |
| - |
307 |
| - run_pypi_smoke_tests .whl "$PYTHON_PYPI_TESTS_DOT_VERSIONS" "$OPERATING_SYSTEMS" |
308 |
| - run_pypi_smoke_tests .tar.gz "$PYTHON_PYPI_TESTS_DOT_VERSIONS" "$OPERATING_SYSTEMS" |
309 |
| - |
310 |
| -else |
311 |
| - echo " !!!! RELEASE is NOT Tested..." |
312 |
| -fi |
313 |
| - |
314 | 323 |
|
315 | 324 | ################################
|
316 | 325 | # Publish release
|
|
0 commit comments