1 name: Pre-submit tests
   2 
   3 on:
   4   push:
   5     branches-ignore:
   6       - master
   7       - lworld
   8       - type-restrictions
   9       - jep390
  10       - pr/*
  11   workflow_dispatch:
  12     inputs:
  13       platforms:
  14         description: "Platform(s) to execute on"
  15         required: true
  16         default: "Linux x64, Windows x64, macOS x64"
  17 #        default: "Linux additional (hotspot only), Linux x64, Linux x86, Windows aarch64, Windows x64, macOS x64"
  18 
  19 concurrency:
  20   group: ${{ github.workflow }}-${{ github.ref }}
  21   cancel-in-progress: true
  22 
  23 jobs:
  24   prerequisites:
  25     name: Prerequisites
  26     runs-on: "ubuntu-20.04"
  27     outputs:
  28       should_run: ${{ steps.check_submit.outputs.should_run }}
  29       bundle_id: ${{ steps.check_bundle_id.outputs.bundle_id }}
  30       jdk_version: ${{ steps.check_jdk_versions.outputs.jdk_version }}
  31       platform_linux_additional: ${{ steps.check_platforms.outputs.platform_linux_additional }}
  32       platform_linux_x64: ${{ steps.check_platforms.outputs.platform_linux_x64 }}
  33       platform_linux_x86: ${{ steps.check_platforms.outputs.platform_linux_x86 }}
  34       platform_windows_aarch64: ${{ steps.check_platforms.outputs.platform_windows_aarch64 }}
  35       platform_windows_x64: ${{ steps.check_platforms.outputs.platform_windows_x64 }}
  36       platform_macos_x64: ${{ steps.check_platforms.outputs.platform_macos_x64 }}
  37       platform_macos_aarch64: ${{ steps.check_platforms.outputs.platform_macos_aarch64 }}
  38       dependencies: ${{ steps.check_deps.outputs.dependencies }}
  39 
  40     steps:
  41       - name: Check if submit tests should actually run depending on secrets and manual triggering
  42         id: check_submit
  43         run: echo "::set-output name=should_run::${{ github.event.inputs.platforms != '' || (!secrets.JDK_SUBMIT_FILTER || startsWith(github.ref, 'refs/heads/submit/')) }}"
  44 
  45       - name: Check which platforms should be included
  46         id: check_platforms
  47         run: |
  48           echo "::set-output name=platform_linux_additional::${{ contains(github.event.inputs.platforms, 'linux additional (hotspot only)') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'linux additional (hotspot only)'))) }}"
  49           echo "::set-output name=platform_linux_x64::${{ contains(github.event.inputs.platforms, 'linux x64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'linux x64'))) }}"
  50           echo "::set-output name=platform_linux_x86::${{ contains(github.event.inputs.platforms, 'linux x86') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'linux x86'))) }}"
  51           echo "::set-output name=platform_windows_aarch64::${{ contains(github.event.inputs.platforms, 'windows aarch64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'windows aarch64'))) }}"
  52           echo "::set-output name=platform_windows_x64::${{ contains(github.event.inputs.platforms, 'windows x64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'windows x64'))) }}"
  53           echo "::set-output name=platform_macos_x64::${{ contains(github.event.inputs.platforms, 'macos x64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'macos x64'))) }}"
  54           echo "::set-output name=platform_macos_aarch64::${{ contains(github.event.inputs.platforms, 'macos aarch64') || (github.event.inputs.platforms == '' && (secrets.JDK_SUBMIT_PLATFORMS == '' || contains(secrets.JDK_SUBMIT_PLATFORMS, 'macos aarch64'))) }}"
  55         if: steps.check_submit.outputs.should_run != 'false'
  56 
  57       - name: Determine unique bundle identifier
  58         id: check_bundle_id
  59         run: echo "::set-output name=bundle_id::${GITHUB_ACTOR}_${GITHUB_SHA:0:8}"
  60         if: steps.check_submit.outputs.should_run != 'false'
  61 
  62       - name: Checkout the source
  63         uses: actions/checkout@v2
  64         with:
  65           path: jdk
  66         if: steps.check_submit.outputs.should_run != 'false'
  67 
  68       - name: Determine versions and locations to be used for dependencies
  69         id: check_deps
  70         run: "echo ::set-output name=dependencies::`cat make/conf/version-numbers.conf make/conf/test-dependencies | sed -e '1i {' -e 's/#.*//g' -e 's/\"//g' -e 's/\\(.*\\)=\\(.*\\)/\"\\1\": \"\\2\",/g' -e '$s/,\\s\\{0,\\}$/\\}/'`"
  71         working-directory: jdk
  72         if: steps.check_submit.outputs.should_run != 'false'
  73 
  74       - name: Print extracted dependencies to the log
  75         run: "echo '${{ steps.check_deps.outputs.dependencies }}'"
  76         if: steps.check_submit.outputs.should_run != 'false'
  77 
  78       - name: Determine full JDK versions
  79         id: check_jdk_versions
  80         shell: bash
  81         run: |
  82           FEATURE=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_FEATURE }}
  83           INTERIM=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_INTERIM }}
  84           UPDATE=${{ fromJson(steps.check_deps.outputs.dependencies).DEFAULT_VERSION_UPDATE }}
  85           if [ "x${UPDATE}" != "x0" ]; then
  86              V=${FEATURE}.${INTERIM}.${UPDATE}
  87           elif [ "x${INTERIM}" != "x0" ]; then
  88              V={FEATURE}.${INTERIM}
  89           else
  90              V=${FEATURE}
  91           fi
  92           echo "::set-output name=jdk_version::${V}"
  93         if: steps.check_submit.outputs.should_run != 'false'
  94 
  95       - name: Determine the jtreg ref to checkout
  96         run: "echo JTREG_REF=jtreg-${{ fromJson(steps.check_deps.outputs.dependencies).JTREG_VERSION }}+${{ fromJson(steps.check_deps.outputs.dependencies).JTREG_BUILD }} >> $GITHUB_ENV"
  97         if: steps.check_submit.outputs.should_run != 'false'
  98 
  99       - name: Check if a jtreg image is present in the cache
 100         id: jtreg
 101         uses: actions/cache@v2
 102         with:
 103           path: ~/jtreg/
 104           key: jtreg-${{ env.JTREG_REF }}-v1
 105         if: steps.check_submit.outputs.should_run != 'false'
 106 
 107       - name: Checkout the jtreg source
 108         uses: actions/checkout@v2
 109         with:
 110           repository: "openjdk/jtreg"
 111           ref: ${{ env.JTREG_REF }}
 112           path: jtreg
 113         if: steps.check_submit.outputs.should_run != 'false' && steps.jtreg.outputs.cache-hit != 'true'
 114 
 115       - name: Build jtreg
 116         run: bash make/build.sh --jdk ${JAVA_HOME_8_X64}
 117         working-directory: jtreg
 118         if: steps.check_submit.outputs.should_run != 'false' && steps.jtreg.outputs.cache-hit != 'true'
 119 
 120       - name: Move jtreg image to destination folder
 121         run: mv build/images/jtreg ~/
 122         working-directory: jtreg
 123         if: steps.check_submit.outputs.should_run != 'false' && steps.jtreg.outputs.cache-hit != 'true'
 124 
 125       - name: Store jtreg for use by later steps
 126         uses: actions/upload-artifact@v2
 127         with:
 128           name: transient_jtreg_${{ steps.check_bundle_id.outputs.bundle_id }}
 129           path: ~/jtreg/
 130         if: steps.check_submit.outputs.should_run != 'false'
 131 
 132   linux_x64_build:
 133     name: Linux x64
 134     runs-on: "ubuntu-20.04"
 135     needs: prerequisites
 136     if: needs.prerequisites.outputs.should_run != 'false' && (needs.prerequisites.outputs.platform_linux_x64 != 'false' || needs.prerequisites.outputs.platform_linux_additional == 'true')
 137 
 138     strategy:
 139       fail-fast: false
 140       matrix:
 141         flavor:
 142           - build release
 143           - build debug
 144         include:
 145           - flavor: build debug
 146             flags: --enable-debug
 147             artifact: -debug
 148 
 149     env:
 150       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
 151       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
 152       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}"
 153       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}"
 154       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_SHA256 }}"
 155 
 156     steps:
 157       - name: Checkout the source
 158         uses: actions/checkout@v2
 159         with:
 160           path: jdk
 161 
 162       - name: Restore boot JDK from cache
 163         id: bootjdk
 164         uses: actions/cache@v2
 165         with:
 166           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
 167           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
 168 
 169       - name: Download boot JDK
 170         run: |
 171           mkdir -p "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 172           wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}"
 173           echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | sha256sum -c >/dev/null -
 174           tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 175           mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"
 176         if: steps.bootjdk.outputs.cache-hit != 'true'
 177 
 178       - name: Restore jtreg artifact
 179         id: jtreg_restore
 180         uses: actions/download-artifact@v2
 181         with:
 182           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
 183           path: ~/jtreg/
 184         continue-on-error: true
 185 
 186       - name: Restore jtreg artifact (retry)
 187         uses: actions/download-artifact@v2
 188         with:
 189           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
 190           path: ~/jtreg/
 191         if: steps.jtreg_restore.outcome == 'failure'
 192 
 193       - name: Checkout gtest sources
 194         uses: actions/checkout@v2
 195         with:
 196           repository: "google/googletest"
 197           ref: "release-${{ fromJson(needs.prerequisites.outputs.dependencies).GTEST_VERSION }}"
 198           path: gtest
 199 
 200       - name: Install dependencies
 201         run: |
 202           sudo apt-get update
 203           sudo apt-get install gcc-10=10.3.0-1ubuntu1~20.04 g++-10=10.3.0-1ubuntu1~20.04 libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
 204           sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
 205 
 206       - name: Configure
 207         run: >
 208           bash configure
 209           --with-conf-name=linux-x64
 210           ${{ matrix.flags }}
 211           --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
 212           --with-boot-jdk=${HOME}/bootjdk/${BOOT_JDK_VERSION}
 213           --with-jtreg=${HOME}/jtreg
 214           --with-gtest=${GITHUB_WORKSPACE}/gtest
 215           --with-default-make-target="product-bundles test-bundles"
 216           --with-zlib=system
 217           --enable-jtreg-failure-handler
 218         working-directory: jdk
 219 
 220       - name: Build
 221         run: make CONF_NAME=linux-x64
 222         working-directory: jdk
 223 
 224       - name: Persist test bundles
 225         uses: actions/upload-artifact@v2
 226         with:
 227           name: transient_jdk-linux-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
 228           path: |
 229             jdk/build/linux-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin${{ matrix.artifact }}.tar.gz
 230             jdk/build/linux-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin-tests${{ matrix.artifact }}.tar.gz
 231 
 232   linux_x64_test:
 233     name: Linux x64
 234     runs-on: "ubuntu-20.04"
 235     needs:
 236       - prerequisites
 237       - linux_x64_build
 238 
 239     strategy:
 240       fail-fast: false
 241       matrix:
 242         test:
 243           - jdk/tier1 part 1
 244           - jdk/tier1 part 2
 245           - jdk/tier1 part 3
 246           - langtools/tier1
 247           - hs/tier1 common
 248           - hs/tier1 compiler
 249           - hs/tier1 gc
 250           - hs/tier1 runtime
 251           - hs/tier1 serviceability
 252         include:
 253           - test: jdk/tier1 part 1
 254             suites: test/jdk/:tier1_part1
 255           - test: jdk/tier1 part 2
 256             suites: test/jdk/:tier1_part2
 257           - test: jdk/tier1 part 3
 258             suites: test/jdk/:tier1_part3
 259           - test: langtools/tier1
 260             suites: test/langtools/:tier1
 261           - test: hs/tier1 common
 262             suites: test/hotspot/jtreg/:tier1_common
 263             artifact: -debug
 264           - test: hs/tier1 compiler
 265             suites: test/hotspot/jtreg/:tier1_compiler
 266             artifact: -debug
 267           - test: hs/tier1 gc
 268             suites: test/hotspot/jtreg/:tier1_gc
 269             artifact: -debug
 270           - test: hs/tier1 runtime
 271             suites: test/hotspot/jtreg/:tier1_runtime
 272             artifact: -debug
 273           - test: hs/tier1 serviceability
 274             suites: test/hotspot/jtreg/:tier1_serviceability
 275             artifact: -debug
 276 
 277     env:
 278       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
 279       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
 280       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}"
 281       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}"
 282       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_SHA256 }}"
 283 
 284     steps:
 285       - name: Checkout the source
 286         uses: actions/checkout@v2
 287 
 288       - name: Restore boot JDK from cache
 289         id: bootjdk
 290         uses: actions/cache@v2
 291         with:
 292           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
 293           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
 294 
 295       - name: Download boot JDK
 296         run: |
 297           mkdir -p "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 298           wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}"
 299           echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | sha256sum -c >/dev/null -
 300           tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 301           mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"
 302         if: steps.bootjdk.outputs.cache-hit != 'true'
 303 
 304       - name: Restore jtreg artifact
 305         id: jtreg_restore
 306         uses: actions/download-artifact@v2
 307         with:
 308           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
 309           path: ~/jtreg/
 310         continue-on-error: true
 311 
 312       - name: Restore jtreg artifact (retry)
 313         uses: actions/download-artifact@v2
 314         with:
 315           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
 316           path: ~/jtreg/
 317         if: steps.jtreg_restore.outcome == 'failure'
 318 
 319       - name: Restore build artifacts
 320         id: build_restore
 321         uses: actions/download-artifact@v2
 322         with:
 323           name: transient_jdk-linux-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
 324           path: ~/jdk-linux-x64${{ matrix.artifact }}
 325         continue-on-error: true
 326 
 327       - name: Restore build artifacts (retry)
 328         uses: actions/download-artifact@v2
 329         with:
 330           name: transient_jdk-linux-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
 331           path: ~/jdk-linux-x64${{ matrix.artifact }}
 332         if: steps.build_restore.outcome == 'failure'
 333 
 334       - name: Unpack jdk
 335         run: |
 336           mkdir -p "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin${{ matrix.artifact }}"
 337           tar -xf "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin${{ matrix.artifact }}"
 338 
 339       - name: Unpack tests
 340         run: |
 341           mkdir -p "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin-tests${{ matrix.artifact }}"
 342           tar -xf "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin-tests${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin-tests${{ matrix.artifact }}"
 343 
 344       - name: Find root of jdk image dir
 345         run: |
 346           imageroot=`find ${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin${{ matrix.artifact }} -name release -type f`
 347           echo "imageroot=`dirname ${imageroot}`" >> $GITHUB_ENV
 348 
 349       - name: Run tests
 350         run: >
 351           JDK_IMAGE_DIR=${{ env.imageroot }}
 352           TEST_IMAGE_DIR=${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin-tests${{ matrix.artifact }}
 353           BOOT_JDK=${HOME}/bootjdk/${BOOT_JDK_VERSION}
 354           JT_HOME=${HOME}/jtreg
 355           make test-prebuilt
 356           CONF_NAME=run-test-prebuilt
 357           LOG_CMDLINES=true
 358           JTREG_VERBOSE=fail,error,time
 359           TEST="${{ matrix.suites }}"
 360           TEST_OPTS_JAVA_OPTIONS=
 361           JTREG_KEYWORDS="!headful"
 362           JTREG="JAVA_OPTIONS=-XX:-CreateCoredumpOnCrash"
 363 
 364       - name: Check that all tests executed successfully
 365         if: always()
 366         run: >
 367           if ! grep --include=test-summary.txt -lqr build/*/test-results -e "TEST SUCCESS" ; then
 368             cat build/*/test-results/*/text/newfailures.txt ;
 369             cat build/*/test-results/*/text/other_errors.txt ;
 370             exit 1 ;
 371           fi
 372 
 373       - name: Create suitable test log artifact name
 374         if: always()
 375         run: echo "logsuffix=`echo ${{ matrix.test }} | sed -e 's!/!_!'g -e 's! !_!'g`" >> $GITHUB_ENV
 376 
 377       - name: Package test results
 378         if: always()
 379         working-directory: build/run-test-prebuilt/test-results/
 380         run: >
 381           zip -r9
 382           "$HOME/linux-x64${{ matrix.artifact }}_testresults_${{ env.logsuffix }}.zip"
 383           .
 384         continue-on-error: true
 385 
 386       - name: Package test support
 387         if: always()
 388         working-directory: build/run-test-prebuilt/test-support/
 389         run: >
 390           zip -r9
 391           "$HOME/linux-x64${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip"
 392           .
 393           -i *.jtr
 394           -i */hs_err*.log
 395           -i */replay*.log
 396         continue-on-error: true
 397 
 398       - name: Persist test results
 399         if: always()
 400         uses: actions/upload-artifact@v2
 401         with:
 402           path: ~/linux-x64${{ matrix.artifact }}_testresults_${{ env.logsuffix }}.zip
 403         continue-on-error: true
 404 
 405       - name: Persist test outputs
 406         if: always()
 407         uses: actions/upload-artifact@v2
 408         with:
 409           path: ~/linux-x64${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip
 410         continue-on-error: true
 411 
 412   linux_additional_build:
 413     name: Linux additional
 414     runs-on: "ubuntu-20.04"
 415     needs:
 416       - prerequisites
 417       - linux_x64_build
 418     if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_linux_additional != 'false'
 419 
 420     strategy:
 421       fail-fast: false
 422       matrix:
 423         flavor:
 424           - hs x64 build only
 425           - hs x64 zero build only
 426           - hs x64 minimal build only
 427           - hs x64 optimized build only
 428           - hs aarch64 build only
 429           - hs arm build only
 430           - hs s390x build only
 431           - hs ppc64le build only
 432         include:
 433           - flavor: hs x64 build only
 434             flags: --enable-debug --disable-precompiled-headers
 435           - flavor: hs x64 zero build only
 436             flags: --enable-debug --disable-precompiled-headers --with-jvm-variants=zero
 437           - flavor: hs x64 minimal build only
 438             flags: --enable-debug --disable-precompiled-headers --with-jvm-variants=minimal
 439           - flavor: hs x64 optimized build only
 440             flags: --with-debug-level=optimized --disable-precompiled-headers
 441           - flavor: hs aarch64 build only
 442             flags: --enable-debug --disable-precompiled-headers
 443             debian-arch: arm64
 444             gnu-arch: aarch64
 445           - flavor: hs arm build only
 446             flags: --enable-debug --disable-precompiled-headers
 447             debian-arch: armhf
 448             gnu-arch: arm
 449             gnu-flavor: eabihf
 450           - flavor: hs s390x build only
 451             flags: --enable-debug --disable-precompiled-headers
 452             debian-arch: s390x
 453             gnu-arch: s390x
 454           - flavor: hs ppc64le build only
 455             flags: --enable-debug --disable-precompiled-headers
 456             debian-arch: ppc64el
 457             gnu-arch: powerpc64le
 458 
 459     env:
 460       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
 461       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
 462       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}"
 463       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}"
 464       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_SHA256 }}"
 465 
 466     steps:
 467       - name: Checkout the source
 468         uses: actions/checkout@v2
 469         with:
 470           path: jdk
 471 
 472       - name: Restore boot JDK from cache
 473         id: bootjdk
 474         uses: actions/cache@v2
 475         with:
 476           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
 477           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
 478 
 479       - name: Download boot JDK
 480         run: |
 481           mkdir -p "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 482           wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}"
 483           echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | sha256sum -c >/dev/null -
 484           tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 485           mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"
 486         if: steps.bootjdk.outputs.cache-hit != 'true'
 487 
 488       - name: Restore build JDK
 489         id: build_restore
 490         uses: actions/download-artifact@v2
 491         with:
 492           name: transient_jdk-linux-x64_${{ needs.prerequisites.outputs.bundle_id }}
 493           path: ~/jdk-linux-x64
 494         continue-on-error: true
 495 
 496       - name: Restore build JDK (retry)
 497         uses: actions/download-artifact@v2
 498         with:
 499           name: transient_jdk-linux-x64_${{ needs.prerequisites.outputs.bundle_id }}
 500           path: ~/jdk-linux-x64
 501         if: steps.build_restore.outcome == 'failure'
 502 
 503       - name: Unpack build JDK
 504         run: |
 505           mkdir -p "${HOME}/jdk-linux-x64/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin"
 506           tar -xf "${HOME}/jdk-linux-x64/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin.tar.gz" -C "${HOME}/jdk-linux-x64/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin"
 507 
 508       - name: Find root of build JDK image dir
 509         run: |
 510           build_jdk_root=`find ${HOME}/jdk-linux-x64/jdk-${{ env.JDK_VERSION }}-internal_linux-x64_bin -name release -type f`
 511           echo "build_jdk_root=`dirname ${build_jdk_root}`" >> $GITHUB_ENV
 512 
 513       - name: Update apt
 514         run: sudo apt-get update
 515 
 516       - name: Install native host dependencies
 517         run: |
 518           sudo apt-get install gcc-10=10.3.0-1ubuntu1~20.04 g++-10=10.3.0-1ubuntu1~20.04 libxrandr-dev libxtst-dev libcups2-dev libasound2-dev
 519           sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
 520         if: matrix.debian-arch == ''
 521 
 522       - name: Install cross-compilation host dependencies
 523         run: sudo apt-get install gcc-10-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}=10.3.0-1ubuntu1~20.04cross1 g++-10-${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}=10.3.0-1ubuntu1~20.04cross1
 524         if: matrix.debian-arch != ''
 525 
 526       - name: Cache sysroot
 527         id: cache-sysroot
 528         uses: actions/cache@v2
 529         with:
 530           path: ~/sysroot-${{ matrix.debian-arch }}/
 531           key: sysroot-${{ matrix.debian-arch }}-${{ hashFiles('jdk/.github/workflows/submit.yml') }}
 532         if: matrix.debian-arch != ''
 533 
 534       - name: Install sysroot host dependencies
 535         run: sudo apt-get install debootstrap qemu-user-static
 536         if: matrix.debian-arch != '' && steps.cache-sysroot.outputs.cache-hit != 'true'
 537 
 538       - name: Create sysroot
 539         run: >
 540           sudo qemu-debootstrap
 541           --arch=${{ matrix.debian-arch }}
 542           --verbose
 543           --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev
 544           --resolve-deps
 545           buster
 546           ~/sysroot-${{ matrix.debian-arch }}
 547           http://httpredir.debian.org/debian/
 548         if: matrix.debian-arch != '' && steps.cache-sysroot.outputs.cache-hit != 'true'
 549 
 550       - name: Prepare sysroot for caching
 551         run: |
 552           sudo chroot ~/sysroot-${{ matrix.debian-arch }} symlinks -cr .
 553           sudo chown ${USER} -R ~/sysroot-${{ matrix.debian-arch }}
 554           rm -rf ~/sysroot-${{ matrix.debian-arch }}/{dev,proc,run,sys}
 555         if: matrix.debian-arch != '' && steps.cache-sysroot.outputs.cache-hit != 'true'
 556 
 557       - name: Configure cross compiler
 558         run: |
 559           echo "CC=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}-gcc-10" >> $GITHUB_ENV
 560           echo "CXX=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}-g++-10" >> $GITHUB_ENV
 561         if: matrix.debian-arch != ''
 562 
 563       - name: Configure cross specific flags
 564         run: >
 565           echo "cross_flags=
 566           --openjdk-target=${{ matrix.gnu-arch }}-linux-gnu${{ matrix.gnu-flavor}}
 567           --with-sysroot=${HOME}/sysroot-${{ matrix.debian-arch }}/
 568           " >> $GITHUB_ENV
 569         if: matrix.debian-arch != ''
 570 
 571       - name: Configure
 572         run: >
 573           bash configure
 574           --with-conf-name=linux-${{ matrix.gnu-arch }}-hotspot
 575           ${{ matrix.flags }}
 576           ${{ env.cross_flags }}
 577           --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
 578           --with-boot-jdk=${HOME}/bootjdk/${BOOT_JDK_VERSION}
 579           --with-build-jdk=${{ env.build_jdk_root }}
 580           --with-default-make-target="hotspot"
 581           --with-zlib=system
 582         working-directory: jdk
 583 
 584       - name: Build
 585         run: make CONF_NAME=linux-${{ matrix.gnu-arch }}-hotspot
 586         working-directory: jdk
 587 
 588   linux_x86_build:
 589     name: Linux x86
 590     runs-on: "ubuntu-20.04"
 591     needs: prerequisites
 592     if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_linux_x86 != 'false'
 593 
 594     strategy:
 595       fail-fast: false
 596       matrix:
 597         flavor:
 598           - build release
 599           - build debug
 600         include:
 601           - flavor: build debug
 602             flags: --enable-debug
 603             artifact: -debug
 604 
 605     # Reduced 32-bit build uses the same boot JDK as 64-bit build
 606     env:
 607       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
 608       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
 609       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}"
 610       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}"
 611       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_SHA256 }}"
 612 
 613     steps:
 614       - name: Checkout the source
 615         uses: actions/checkout@v2
 616         with:
 617           path: jdk
 618 
 619       - name: Restore boot JDK from cache
 620         id: bootjdk
 621         uses: actions/cache@v2
 622         with:
 623           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
 624           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
 625 
 626       - name: Download boot JDK
 627         run: |
 628           mkdir -p "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 629           wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}"
 630           echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | sha256sum -c >/dev/null -
 631           tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 632           mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"
 633         if: steps.bootjdk.outputs.cache-hit != 'true'
 634 
 635       - name: Restore jtreg artifact
 636         id: jtreg_restore
 637         uses: actions/download-artifact@v2
 638         with:
 639           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
 640           path: ~/jtreg/
 641         continue-on-error: true
 642 
 643       - name: Restore jtreg artifact (retry)
 644         uses: actions/download-artifact@v2
 645         with:
 646           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
 647           path: ~/jtreg/
 648         if: steps.jtreg_restore.outcome == 'failure'
 649 
 650       - name: Checkout gtest sources
 651         uses: actions/checkout@v2
 652         with:
 653           repository: "google/googletest"
 654           ref: "release-${{ fromJson(needs.prerequisites.outputs.dependencies).GTEST_VERSION }}"
 655           path: gtest
 656 
 657       # Roll in the multilib environment and its dependencies.
 658       # Some multilib libraries do not have proper inter-dependencies, so we have to
 659       # install their dependencies manually. Additionally, upgrading apt solves
 660       # the libc6 installation bugs until base image catches up, see JDK-8260460.
 661       - name: Install dependencies
 662         run: |
 663           sudo dpkg --add-architecture i386
 664           sudo apt-get update
 665           sudo apt-get install --only-upgrade apt
 666           sudo apt-get install gcc-10-multilib g++-10-multilib libfreetype6-dev:i386 libxrandr-dev:i386 libxtst-dev:i386 libtiff-dev:i386 libcupsimage2-dev:i386 libcups2-dev:i386 libasound2-dev:i386
 667           sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10
 668 
 669       - name: Configure
 670         run: >
 671           bash configure
 672           --with-conf-name=linux-x86
 673           --with-target-bits=32
 674           ${{ matrix.flags }}
 675           --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
 676           --with-boot-jdk=${HOME}/bootjdk/${BOOT_JDK_VERSION}
 677           --with-jtreg=${HOME}/jtreg
 678           --with-gtest=${GITHUB_WORKSPACE}/gtest
 679           --with-default-make-target="product-bundles test-bundles"
 680           --with-zlib=system
 681           --enable-jtreg-failure-handler
 682         working-directory: jdk
 683 
 684       - name: Build
 685         run: make CONF_NAME=linux-x86
 686         working-directory: jdk
 687 
 688       - name: Persist test bundles
 689         uses: actions/upload-artifact@v2
 690         with:
 691           name: transient_jdk-linux-x86${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
 692           path: |
 693             jdk/build/linux-x86/bundles/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin${{ matrix.artifact }}.tar.gz
 694             jdk/build/linux-x86/bundles/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin-tests${{ matrix.artifact }}.tar.gz
 695 
 696   linux_x86_test:
 697     name: Linux x86
 698     runs-on: "ubuntu-20.04"
 699     needs:
 700       - prerequisites
 701       - linux_x86_build
 702 
 703     strategy:
 704       fail-fast: false
 705       matrix:
 706         test:
 707           - jdk/tier1 part 1
 708           - jdk/tier1 part 2
 709           - jdk/tier1 part 3
 710           - langtools/tier1
 711           - hs/tier1 common
 712           - hs/tier1 compiler
 713           - hs/tier1 gc
 714           - hs/tier1 runtime
 715           - hs/tier1 serviceability
 716         include:
 717           - test: jdk/tier1 part 1
 718             suites: test/jdk/:tier1_part1
 719           - test: jdk/tier1 part 2
 720             suites: test/jdk/:tier1_part2
 721           - test: jdk/tier1 part 3
 722             suites: test/jdk/:tier1_part3
 723           - test: langtools/tier1
 724             suites: test/langtools/:tier1
 725           - test: hs/tier1 common
 726             suites: test/hotspot/jtreg/:tier1_common
 727             artifact: -debug
 728           - test: hs/tier1 compiler
 729             suites: test/hotspot/jtreg/:tier1_compiler
 730             artifact: -debug
 731           - test: hs/tier1 gc
 732             suites: test/hotspot/jtreg/:tier1_gc
 733             artifact: -debug
 734           - test: hs/tier1 runtime
 735             suites: test/hotspot/jtreg/:tier1_runtime
 736             artifact: -debug
 737           - test: hs/tier1 serviceability
 738             suites: test/hotspot/jtreg/:tier1_serviceability
 739             artifact: -debug
 740 
 741     # Reduced 32-bit build uses the same boot JDK as 64-bit build
 742     env:
 743       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
 744       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
 745       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}"
 746       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}"
 747       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_SHA256 }}"
 748 
 749     steps:
 750       - name: Checkout the source
 751         uses: actions/checkout@v2
 752 
 753       - name: Restore boot JDK from cache
 754         id: bootjdk
 755         uses: actions/cache@v2
 756         with:
 757           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
 758           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
 759 
 760       - name: Download boot JDK
 761         run: |
 762           mkdir -p "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 763           wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}"
 764           echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | sha256sum -c >/dev/null -
 765           tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
 766           mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"
 767         if: steps.bootjdk.outputs.cache-hit != 'true'
 768 
 769       - name: Restore jtreg artifact
 770         id: jtreg_restore
 771         uses: actions/download-artifact@v2
 772         with:
 773           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
 774           path: ~/jtreg/
 775         continue-on-error: true
 776 
 777       - name: Restore jtreg artifact (retry)
 778         uses: actions/download-artifact@v2
 779         with:
 780           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
 781           path: ~/jtreg/
 782         if: steps.jtreg_restore.outcome == 'failure'
 783 
 784       - name: Restore build artifacts
 785         id: build_restore
 786         uses: actions/download-artifact@v2
 787         with:
 788           name: transient_jdk-linux-x86${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
 789           path: ~/jdk-linux-x86${{ matrix.artifact }}
 790         continue-on-error: true
 791 
 792       - name: Restore build artifacts (retry)
 793         uses: actions/download-artifact@v2
 794         with:
 795           name: transient_jdk-linux-x86${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
 796           path: ~/jdk-linux-x86${{ matrix.artifact }}
 797         if: steps.build_restore.outcome == 'failure'
 798 
 799       - name: Unpack jdk
 800         run: |
 801           mkdir -p "${HOME}/jdk-linux-x86${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin${{ matrix.artifact }}"
 802           tar -xf "${HOME}/jdk-linux-x86${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-linux-x86${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin${{ matrix.artifact }}"
 803 
 804       - name: Unpack tests
 805         run: |
 806           mkdir -p "${HOME}/jdk-linux-x86${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin-tests${{ matrix.artifact }}"
 807           tar -xf "${HOME}/jdk-linux-x86${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin-tests${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-linux-x86${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin-tests${{ matrix.artifact }}"
 808 
 809       - name: Find root of jdk image dir
 810         run: |
 811           imageroot=`find ${HOME}/jdk-linux-x86${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin${{ matrix.artifact }} -name release -type f`
 812           echo "imageroot=`dirname ${imageroot}`" >> $GITHUB_ENV
 813 
 814       - name: Run tests
 815         run: >
 816           JDK_IMAGE_DIR=${{ env.imageroot }}
 817           TEST_IMAGE_DIR=${HOME}/jdk-linux-x86${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_linux-x86_bin-tests${{ matrix.artifact }}
 818           BOOT_JDK=${HOME}/bootjdk/${BOOT_JDK_VERSION}
 819           JT_HOME=${HOME}/jtreg
 820           make test-prebuilt
 821           CONF_NAME=run-test-prebuilt
 822           LOG_CMDLINES=true
 823           JTREG_VERBOSE=fail,error,time
 824           TEST="${{ matrix.suites }}"
 825           TEST_OPTS_JAVA_OPTIONS=
 826           JTREG_KEYWORDS="!headful"
 827           JTREG="JAVA_OPTIONS=-XX:-CreateCoredumpOnCrash"
 828 
 829       - name: Check that all tests executed successfully
 830         if: always()
 831         run: >
 832           if ! grep --include=test-summary.txt -lqr build/*/test-results -e "TEST SUCCESS" ; then
 833             cat build/*/test-results/*/text/newfailures.txt ;
 834             cat build/*/test-results/*/text/other_errors.txt ;
 835             exit 1 ;
 836           fi
 837 
 838       - name: Create suitable test log artifact name
 839         if: always()
 840         run: echo "logsuffix=`echo ${{ matrix.test }} | sed -e 's!/!_!'g -e 's! !_!'g`" >> $GITHUB_ENV
 841 
 842       - name: Package test results
 843         if: always()
 844         working-directory: build/run-test-prebuilt/test-results/
 845         run: >
 846           zip -r9
 847           "$HOME/linux-x86${{ matrix.artifact }}_testresults_${{ env.logsuffix }}.zip"
 848           .
 849         continue-on-error: true
 850 
 851       - name: Package test support
 852         if: always()
 853         working-directory: build/run-test-prebuilt/test-support/
 854         run: >
 855           zip -r9
 856           "$HOME/linux-x86${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip"
 857           .
 858           -i *.jtr
 859           -i */hs_err*.log
 860           -i */replay*.log
 861         continue-on-error: true
 862 
 863       - name: Persist test results
 864         if: always()
 865         uses: actions/upload-artifact@v2
 866         with:
 867           path: ~/linux-x86${{ matrix.artifact }}_testresults_${{ env.logsuffix }}.zip
 868         continue-on-error: true
 869 
 870       - name: Persist test outputs
 871         if: always()
 872         uses: actions/upload-artifact@v2
 873         with:
 874           path: ~/linux-x86${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip
 875         continue-on-error: true
 876 
 877   windows_aarch64_build:
 878     name: Windows aarch64
 879     runs-on: "windows-2019"
 880     needs: prerequisites
 881     if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_windows_aarch64 != 'false'
 882 
 883     strategy:
 884       fail-fast: false
 885       matrix:
 886         flavor:
 887           - build debug
 888         include:
 889           - flavor: build debug
 890             flags: --enable-debug
 891             artifact: -debug
 892 
 893     env:
 894       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
 895       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
 896       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}"
 897       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}"
 898       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_SHA256 }}"
 899 
 900     steps:
 901       - name: Restore cygwin packages from cache
 902         id: cygwin
 903         uses: actions/cache@v2
 904         with:
 905           path: ~/cygwin/packages
 906           key: cygwin-packages-${{ runner.os }}-v1
 907 
 908       - name: Install cygwin
 909         run: |
 910           New-Item -Force -ItemType directory -Path "$HOME\cygwin"
 911           & curl -L "https://www.cygwin.com/setup-x86_64.exe" -o "$HOME/cygwin/setup-x86_64.exe"
 912           Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages cygwin=3.2.0-1,autoconf,make,zip,unzip --root $HOME\cygwin\cygwin64 --local-package-dir $HOME\cygwin\packages --site http://mirrors.kernel.org/sourceware/cygwin --no-desktop --no-shortcuts --no-startmenu --no-admin" -Wait -NoNewWindow
 913 
 914       - name: Checkout the source
 915         uses: actions/checkout@v2
 916         with:
 917           path: jdk
 918 
 919       - name: Restore boot JDK from cache
 920         id: bootjdk
 921         uses: actions/cache@v2
 922         with:
 923           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
 924           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
 925 
 926       - name: Download boot JDK
 927         run: |
 928           mkdir -p "$HOME\bootjdk\$env:BOOT_JDK_VERSION"
 929           & curl -L "$env:BOOT_JDK_URL" -o "$HOME/bootjdk/$env:BOOT_JDK_FILENAME"
 930           $FileHash = Get-FileHash -Algorithm SHA256 "$HOME/bootjdk/$env:BOOT_JDK_FILENAME"
 931           $FileHash.Hash -eq $env:BOOT_JDK_SHA256
 932           & tar -xf "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" -C "$HOME/bootjdk/$env:BOOT_JDK_VERSION"
 933           Get-ChildItem "$HOME\bootjdk\$env:BOOT_JDK_VERSION\*\*" | Move-Item -Destination "$HOME\bootjdk\$env:BOOT_JDK_VERSION"
 934         if: steps.bootjdk.outputs.cache-hit != 'true'
 935 
 936       - name: Ensure a specific version of MSVC is installed
 937         run: >
 938           Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe' -Wait -NoNewWindow -ArgumentList
 939           'modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" --quiet
 940           --add Microsoft.VisualStudio.Component.VC.14.29.arm64'
 941 
 942       - name: Configure
 943         run: >
 944           $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ;
 945           $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ;
 946           $env:BOOT_JDK = cygpath "$HOME/bootjdk/$env:BOOT_JDK_VERSION" ;
 947           & bash configure
 948           --with-conf-name=windows-aarch64
 949           --with-msvc-toolset-version=14.29
 950           --openjdk-target=aarch64-unknown-cygwin
 951           ${{ matrix.flags }}
 952           --with-version-opt="$env:GITHUB_ACTOR-$env:GITHUB_SHA"
 953           --with-boot-jdk="$env:BOOT_JDK"
 954           --with-default-make-target="hotspot"
 955         working-directory: jdk
 956 
 957       - name: Build
 958         run: |
 959           $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ;
 960           $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ;
 961           & make CONF_NAME=windows-aarch64
 962         working-directory: jdk
 963 
 964   windows_x64_build:
 965     name: Windows x64
 966     runs-on: "windows-2019"
 967     needs: prerequisites
 968     if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_windows_x64 != 'false'
 969 
 970     strategy:
 971       fail-fast: false
 972       matrix:
 973         flavor:
 974           - build release
 975           - build debug
 976         include:
 977           - flavor: build debug
 978             flags: --enable-debug
 979             artifact: -debug
 980 
 981     env:
 982       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
 983       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
 984       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}"
 985       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}"
 986       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_SHA256 }}"
 987 
 988     steps:
 989       - name: Restore cygwin packages from cache
 990         id: cygwin
 991         uses: actions/cache@v2
 992         with:
 993           path: ~/cygwin/packages
 994           key: cygwin-packages-${{ runner.os }}-v1
 995 
 996       - name: Install cygwin
 997         run: |
 998           New-Item -Force -ItemType directory -Path "$HOME\cygwin"
 999           & curl -L "https://www.cygwin.com/setup-x86_64.exe" -o "$HOME/cygwin/setup-x86_64.exe"
1000           Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages cygwin=3.2.0-1,autoconf,make,zip,unzip --root $HOME\cygwin\cygwin64 --local-package-dir $HOME\cygwin\packages --site http://mirrors.kernel.org/sourceware/cygwin --no-desktop --no-shortcuts --no-startmenu --no-admin" -Wait -NoNewWindow
1001 
1002       - name: Checkout the source
1003         uses: actions/checkout@v2
1004         with:
1005           path: jdk
1006 
1007       - name: Restore boot JDK from cache
1008         id: bootjdk
1009         uses: actions/cache@v2
1010         with:
1011           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
1012           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
1013 
1014       - name: Download boot JDK
1015         run: |
1016           mkdir -p "$HOME\bootjdk\$env:BOOT_JDK_VERSION"
1017           & curl -L "$env:BOOT_JDK_URL" -o "$HOME/bootjdk/$env:BOOT_JDK_FILENAME"
1018           $FileHash = Get-FileHash -Algorithm SHA256 "$HOME/bootjdk/$env:BOOT_JDK_FILENAME"
1019           $FileHash.Hash -eq $env:BOOT_JDK_SHA256
1020           & tar -xf "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" -C "$HOME/bootjdk/$env:BOOT_JDK_VERSION"
1021           Get-ChildItem "$HOME\bootjdk\$env:BOOT_JDK_VERSION\*\*" | Move-Item -Destination "$HOME\bootjdk\$env:BOOT_JDK_VERSION"
1022         if: steps.bootjdk.outputs.cache-hit != 'true'
1023 
1024       - name: Checkout gtest sources
1025         uses: actions/checkout@v2
1026         with:
1027           repository: "google/googletest"
1028           ref: "release-${{ fromJson(needs.prerequisites.outputs.dependencies).GTEST_VERSION }}"
1029           path: gtest
1030 
1031       - name: Restore jtreg artifact
1032         id: jtreg_restore
1033         uses: actions/download-artifact@v2
1034         with:
1035           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1036           path: ~/jtreg/
1037         continue-on-error: true
1038 
1039       - name: Restore jtreg artifact (retry)
1040         uses: actions/download-artifact@v2
1041         with:
1042           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1043           path: ~/jtreg/
1044         if: steps.jtreg_restore.outcome == 'failure'
1045 
1046       - name: Ensure a specific version of MSVC is installed
1047         run: >
1048           Start-Process -FilePath 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vs_installer.exe' -Wait -NoNewWindow -ArgumentList
1049           'modify --installPath "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise" --quiet
1050           --add Microsoft.VisualStudio.Component.VC.14.28.x86.x64'
1051 
1052       - name: Configure
1053         run: >
1054           $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ;
1055           $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ;
1056           $env:BOOT_JDK = cygpath "$HOME/bootjdk/$env:BOOT_JDK_VERSION" ;
1057           $env:JT_HOME = cygpath "$HOME/jtreg" ;
1058           $env:GTEST = cygpath "$env:GITHUB_WORKSPACE/gtest" ;
1059           & bash configure
1060           --with-conf-name=windows-x64
1061           --with-msvc-toolset-version=14.28
1062           ${{ matrix.flags }}
1063           --with-version-opt="$env:GITHUB_ACTOR-$env:GITHUB_SHA"
1064           --with-boot-jdk="$env:BOOT_JDK"
1065           --with-jtreg="$env:JT_HOME"
1066           --with-gtest="$env:GTEST"
1067           --with-default-make-target="product-bundles test-bundles"
1068           --enable-jtreg-failure-handler
1069         working-directory: jdk
1070 
1071       - name: Build
1072         run: |
1073           $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ;
1074           $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ;
1075           & make CONF_NAME=windows-x64
1076         working-directory: jdk
1077 
1078       - name: Persist test bundles
1079         uses: actions/upload-artifact@v2
1080         with:
1081           name: transient_jdk-windows-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
1082           path: |
1083             jdk/build/windows-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }}.zip
1084             jdk/build/windows-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin-tests${{ matrix.artifact }}.tar.gz
1085             jdk/build/windows-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }}-symbols.tar.gz
1086 
1087   windows_x64_test:
1088     name: Windows x64
1089     runs-on: "windows-2019"
1090     needs:
1091       - prerequisites
1092       - windows_x64_build
1093 
1094     strategy:
1095       fail-fast: false
1096       matrix:
1097         test:
1098           - jdk/tier1 part 1
1099           - jdk/tier1 part 2
1100           - jdk/tier1 part 3
1101           - langtools/tier1
1102           - hs/tier1 common
1103           - hs/tier1 compiler
1104           - hs/tier1 gc
1105           - hs/tier1 runtime
1106           - hs/tier1 serviceability
1107         include:
1108           - test: jdk/tier1 part 1
1109             suites: test/jdk/:tier1_part1
1110           - test: jdk/tier1 part 2
1111             suites: test/jdk/:tier1_part2
1112           - test: jdk/tier1 part 3
1113             suites: test/jdk/:tier1_part3
1114           - test: langtools/tier1
1115             suites: test/langtools/:tier1
1116           - test: hs/tier1 common
1117             suites: test/hotspot/jtreg/:tier1_common
1118             artifact: -debug
1119           - test: hs/tier1 compiler
1120             suites: test/hotspot/jtreg/:tier1_compiler
1121             artifact: -debug
1122           - test: hs/tier1 gc
1123             suites: test/hotspot/jtreg/:tier1_gc
1124             artifact: -debug
1125           - test: hs/tier1 runtime
1126             suites: test/hotspot/jtreg/:tier1_runtime
1127             artifact: -debug
1128           - test: hs/tier1 serviceability
1129             suites: test/hotspot/jtreg/:tier1_serviceability
1130             artifact: -debug
1131 
1132     env:
1133       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
1134       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
1135       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}"
1136       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}"
1137       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_SHA256 }}"
1138 
1139     steps:
1140       - name: Checkout the source
1141         uses: actions/checkout@v2
1142 
1143       - name: Restore boot JDK from cache
1144         id: bootjdk
1145         uses: actions/cache@v2
1146         with:
1147           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
1148           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
1149 
1150       - name: Download boot JDK
1151         run: |
1152           mkdir -p "$HOME\bootjdk\$env:BOOT_JDK_VERSION"
1153           & curl -L "$env:BOOT_JDK_URL" -o "$HOME/bootjdk/$env:BOOT_JDK_FILENAME"
1154           $FileHash = Get-FileHash -Algorithm SHA256 "$HOME/bootjdk/$env:BOOT_JDK_FILENAME"
1155           $FileHash.Hash -eq $env:BOOT_JDK_SHA256
1156           & tar -xf "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" -C "$HOME/bootjdk/$env:BOOT_JDK_VERSION"
1157           Get-ChildItem "$HOME\bootjdk\$env:BOOT_JDK_VERSION\*\*" | Move-Item -Destination "$HOME\bootjdk\$env:BOOT_JDK_VERSION"
1158         if: steps.bootjdk.outputs.cache-hit != 'true'
1159 
1160       - name: Restore cygwin packages from cache
1161         id: cygwin
1162         uses: actions/cache@v2
1163         with:
1164           path: ~/cygwin/packages
1165           key: cygwin-packages-${{ runner.os }}-v1
1166 
1167       - name: Install cygwin
1168         run: |
1169           New-Item -Force -ItemType directory -Path "$HOME\cygwin"
1170           & curl -L "https://www.cygwin.com/setup-x86_64.exe" -o "$HOME/cygwin/setup-x86_64.exe"
1171           Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages cygwin=3.2.0-1,autoconf,make,zip,unzip --root $HOME\cygwin\cygwin64 --local-package-dir $HOME\cygwin\packages --site http://mirrors.kernel.org/sourceware/cygwin --no-desktop --no-shortcuts --no-startmenu --no-admin" -Wait -NoNewWindow
1172 
1173       - name: Restore jtreg artifact
1174         id: jtreg_restore
1175         uses: actions/download-artifact@v2
1176         with:
1177           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1178           path: ~/jtreg/
1179         continue-on-error: true
1180 
1181       - name: Restore jtreg artifact (retry)
1182         uses: actions/download-artifact@v2
1183         with:
1184           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1185           path: ~/jtreg/
1186         if: steps.jtreg_restore.outcome == 'failure'
1187 
1188       - name: Restore build artifacts
1189         id: build_restore
1190         uses: actions/download-artifact@v2
1191         with:
1192           name: transient_jdk-windows-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
1193           path: ~/jdk-windows-x64${{ matrix.artifact }}
1194         continue-on-error: true
1195 
1196       - name: Restore build artifacts (retry)
1197         uses: actions/download-artifact@v2
1198         with:
1199           name: transient_jdk-windows-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
1200           path: ~/jdk-windows-x64${{ matrix.artifact }}
1201         if: steps.build_restore.outcome == 'failure'
1202 
1203       - name: Unpack jdk
1204         run: |
1205           mkdir -p "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }}"
1206           tar -xf "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }}.zip" -C "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }}"
1207 
1208       - name: Unpack symbols
1209         run: |
1210           mkdir -p "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }}-symbols"
1211           tar -xf "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }}-symbols.tar.gz" -C "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }}-symbols"
1212 
1213       - name: Unpack tests
1214         run: |
1215           mkdir -p "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin-tests${{ matrix.artifact }}"
1216           tar -xf "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin-tests${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin-tests${{ matrix.artifact }}"
1217 
1218       - name: Find root of jdk image dir
1219         run: echo ("imageroot=" + (Get-ChildItem -Path $HOME/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin${{ matrix.artifact }} -Filter release -Recurse -ErrorAction SilentlyContinue -Force).DirectoryName) | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
1220 
1221       - name: Run tests
1222         run: >
1223           $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ;
1224           $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ;
1225           $env:JDK_IMAGE_DIR = cygpath "${{ env.imageroot }}" ;
1226           $env:SYMBOLS_IMAGE_DIR = cygpath "${{ env.imageroot }}" ;
1227           $env:TEST_IMAGE_DIR = cygpath "$HOME/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_windows-x64_bin-tests${{ matrix.artifact }}" ;
1228           $env:BOOT_JDK = cygpath "$HOME/bootjdk/$env:BOOT_JDK_VERSION" ;
1229           $env:JT_HOME = cygpath "$HOME/jtreg" ;
1230           & make test-prebuilt
1231           CONF_NAME=run-test-prebuilt
1232           LOG_CMDLINES=true
1233           JTREG_VERBOSE=fail,error,time
1234           TEST=${{ matrix.suites }}
1235           TEST_OPTS_JAVA_OPTIONS=
1236           JTREG_KEYWORDS="!headful"
1237           JTREG="JAVA_OPTIONS=-XX:-CreateCoredumpOnCrash"
1238 
1239       - name: Check that all tests executed successfully
1240         if: always()
1241         run: >
1242           if ((Get-ChildItem -Path build\*\test-results\test-summary.txt -Recurse | Select-String -Pattern "TEST SUCCESS" ).Count -eq 0) {
1243             Get-Content -Path build\*\test-results\*\*\newfailures.txt ;
1244             Get-Content -Path build\*\test-results\*\*\other_errors.txt ;
1245             exit 1
1246           }
1247 
1248       - name: Create suitable test log artifact name
1249         if: always()
1250         run: echo ("logsuffix=" + ("${{ matrix.test }}" -replace "/", "_" -replace " ", "_")) | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
1251 
1252       - name: Package test results
1253         if: always()
1254         working-directory: build/run-test-prebuilt/test-results/
1255         run: >
1256           $env:Path = "$HOME\cygwin\cygwin64\bin;$env:Path" ;
1257           zip -r9
1258           "$HOME/windows-x64${{ matrix.artifact }}_testresults_${{ env.logsuffix }}.zip"
1259           .
1260         continue-on-error: true
1261 
1262       - name: Package test support
1263         if: always()
1264         working-directory: build/run-test-prebuilt/test-support/
1265         run: >
1266           $env:Path = "$HOME\cygwin\cygwin64\bin;$env:Path" ;
1267           zip -r9
1268           "$HOME/windows-x64${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip"
1269           .
1270           -i *.jtr
1271           -i */hs_err*.log
1272           -i */replay*.log
1273         continue-on-error: true
1274 
1275       - name: Persist test results
1276         if: always()
1277         uses: actions/upload-artifact@v2
1278         with:
1279           path: ~/windows-x64${{ matrix.artifact }}_testresults_${{ env.logsuffix }}.zip
1280         continue-on-error: true
1281 
1282       - name: Persist test outputs
1283         if: always()
1284         uses: actions/upload-artifact@v2
1285         with:
1286           path: ~/windows-x64${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip
1287         continue-on-error: true
1288 
1289   macos_x64_build:
1290     name: macOS x64
1291     runs-on: "macos-10.15"
1292     needs: prerequisites
1293     if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_macos_x64 != 'false'
1294 
1295     strategy:
1296       fail-fast: false
1297       matrix:
1298         flavor:
1299           - build release
1300           - build debug
1301         include:
1302           - flavor: build release
1303           - flavor: build debug
1304             flags: --enable-debug
1305             artifact: -debug
1306 
1307     env:
1308       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
1309       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
1310       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_FILENAME }}"
1311       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_URL }}"
1312       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_SHA256 }}"
1313 
1314     steps:
1315       - name: Checkout the source
1316         uses: actions/checkout@v2
1317         with:
1318           path: jdk
1319 
1320       - name: Restore boot JDK from cache
1321         id: bootjdk
1322         uses: actions/cache@v2
1323         with:
1324           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
1325           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
1326 
1327       - name: Download boot JDK
1328         run: |
1329           mkdir -p ${HOME}/bootjdk/${BOOT_JDK_VERSION} || true
1330           wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}"
1331           echo "${BOOT_JDK_SHA256}  ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | shasum -a 256 -c >/dev/null -
1332           tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
1333           mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"
1334         if: steps.bootjdk.outputs.cache-hit != 'true'
1335 
1336       - name: Restore jtreg artifact
1337         id: jtreg_restore
1338         uses: actions/download-artifact@v2
1339         with:
1340           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1341           path: ~/jtreg/
1342         continue-on-error: true
1343 
1344       - name: Restore jtreg artifact (retry)
1345         uses: actions/download-artifact@v2
1346         with:
1347           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1348           path: ~/jtreg/
1349         if: steps.jtreg_restore.outcome == 'failure'
1350 
1351       - name: Checkout gtest sources
1352         uses: actions/checkout@v2
1353         with:
1354           repository: "google/googletest"
1355           ref: "release-${{ fromJson(needs.prerequisites.outputs.dependencies).GTEST_VERSION }}"
1356           path: gtest
1357 
1358       - name: Install dependencies
1359         run: brew install make
1360 
1361       - name: Select Xcode version
1362         run: sudo xcode-select --switch /Applications/Xcode_11.3.1.app/Contents/Developer
1363 
1364       - name: Configure
1365         run: >
1366           bash configure
1367           --with-conf-name=macos-x64
1368           ${{ matrix.flags }}
1369           --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
1370           --with-boot-jdk=${HOME}/bootjdk/${BOOT_JDK_VERSION}/Contents/Home
1371           --with-jtreg=${HOME}/jtreg
1372           --with-gtest=${GITHUB_WORKSPACE}/gtest
1373           --with-default-make-target="product-bundles test-bundles"
1374           --with-zlib=system
1375           --enable-jtreg-failure-handler
1376         working-directory: jdk
1377 
1378       - name: Build
1379         run: make CONF_NAME=macos-x64
1380         working-directory: jdk
1381 
1382       - name: Persist test bundles
1383         uses: actions/upload-artifact@v2
1384         with:
1385           name: transient_jdk-macos-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
1386           path: |
1387             jdk/build/macos-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin${{ matrix.artifact }}.tar.gz
1388             jdk/build/macos-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin-tests${{ matrix.artifact }}.tar.gz
1389 
1390   macos_aarch64_build:
1391     name: macOS aarch64
1392     runs-on: "macos-10.15"
1393     needs: prerequisites
1394     if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_macos_aarch64 != 'false'
1395 
1396     strategy:
1397       fail-fast: false
1398       matrix:
1399         flavor:
1400           - build release
1401           - build debug
1402         include:
1403           - flavor: build release
1404           - flavor: build debug
1405             flags: --enable-debug
1406             artifact: -debug
1407 
1408     env:
1409       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
1410       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
1411       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_FILENAME }}"
1412       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_URL }}"
1413       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_SHA256 }}"
1414 
1415     steps:
1416       - name: Checkout the source
1417         uses: actions/checkout@v2
1418         with:
1419           path: jdk
1420 
1421       - name: Restore boot JDK from cache
1422         id: bootjdk
1423         uses: actions/cache@v2
1424         with:
1425           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
1426           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
1427 
1428       - name: Download boot JDK
1429         run: |
1430           mkdir -p ${HOME}/bootjdk/${BOOT_JDK_VERSION} || true
1431           wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}"
1432           echo "${BOOT_JDK_SHA256}  ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | shasum -a 256 -c >/dev/null -
1433           tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
1434           mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"
1435         if: steps.bootjdk.outputs.cache-hit != 'true'
1436 
1437       - name: Restore jtreg artifact
1438         id: jtreg_restore
1439         uses: actions/download-artifact@v2
1440         with:
1441           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1442           path: ~/jtreg/
1443         continue-on-error: true
1444 
1445       - name: Restore jtreg artifact (retry)
1446         uses: actions/download-artifact@v2
1447         with:
1448           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1449           path: ~/jtreg/
1450         if: steps.jtreg_restore.outcome == 'failure'
1451 
1452       - name: Checkout gtest sources
1453         uses: actions/checkout@v2
1454         with:
1455           repository: "google/googletest"
1456           ref: "release-${{ fromJson(needs.prerequisites.outputs.dependencies).GTEST_VERSION }}"
1457           path: gtest
1458 
1459       - name: Install dependencies
1460         run: brew install make
1461 
1462       - name: Select Xcode version
1463         run: sudo xcode-select --switch /Applications/Xcode_12.4.app/Contents/Developer
1464 
1465       - name: Configure
1466         run: >
1467           bash configure
1468           --with-conf-name=macos-aarch64
1469           --openjdk-target=aarch64-apple-darwin
1470           ${{ matrix.flags }}
1471           --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA}
1472           --with-boot-jdk=${HOME}/bootjdk/${BOOT_JDK_VERSION}/Contents/Home
1473           --with-jtreg=${HOME}/jtreg
1474           --with-gtest=${GITHUB_WORKSPACE}/gtest
1475           --with-default-make-target="product-bundles test-bundles"
1476           --with-zlib=system
1477           --enable-jtreg-failure-handler
1478         working-directory: jdk
1479 
1480       - name: Build
1481         run: make CONF_NAME=macos-aarch64
1482         working-directory: jdk
1483 
1484       - name: Persist test bundles
1485         uses: actions/upload-artifact@v2
1486         with:
1487           name: transient_jdk-macos-aarch64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
1488           path: |
1489             jdk/build/macos-aarch64/bundles/jdk-${{ env.JDK_VERSION }}-internal_macos-aarch64_bin${{ matrix.artifact }}.tar.gz
1490             jdk/build/macos-aarch64/bundles/jdk-${{ env.JDK_VERSION }}-internal_macos-aarch64_bin-tests${{ matrix.artifact }}.tar.gz
1491 
1492 
1493   macos_x64_test:
1494     name: macOS x64
1495     runs-on: "macos-10.15"
1496     needs:
1497       - prerequisites
1498       - macos_x64_build
1499 
1500     strategy:
1501       fail-fast: false
1502       matrix:
1503         test:
1504           - jdk/tier1 part 1
1505           - jdk/tier1 part 2
1506           - jdk/tier1 part 3
1507           - langtools/tier1
1508           - hs/tier1 common
1509           - hs/tier1 compiler
1510           - hs/tier1 gc
1511           - hs/tier1 runtime
1512           - hs/tier1 serviceability
1513         include:
1514           - test: jdk/tier1 part 1
1515             suites: test/jdk/:tier1_part1
1516           - test: jdk/tier1 part 2
1517             suites: test/jdk/:tier1_part2
1518           - test: jdk/tier1 part 3
1519             suites: test/jdk/:tier1_part3
1520           - test: langtools/tier1
1521             suites: test/langtools/:tier1
1522           - test: hs/tier1 common
1523             suites: test/hotspot/jtreg/:tier1_common
1524             artifact: -debug
1525           - test: hs/tier1 compiler
1526             suites: test/hotspot/jtreg/:tier1_compiler
1527             artifact: -debug
1528           - test: hs/tier1 gc
1529             suites: test/hotspot/jtreg/:tier1_gc
1530             artifact: -debug
1531           - test: hs/tier1 runtime
1532             suites: test/hotspot/jtreg/:tier1_runtime
1533             artifact: -debug
1534           - test: hs/tier1 serviceability
1535             suites: test/hotspot/jtreg/:tier1_serviceability
1536             artifact: -debug
1537 
1538     env:
1539       JDK_VERSION: "${{ needs.prerequisites.outputs.jdk_version }}"
1540       BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}"
1541       BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_FILENAME }}"
1542       BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_URL }}"
1543       BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_SHA256 }}"
1544 
1545     steps:
1546       - name: Checkout the source
1547         uses: actions/checkout@v2
1548 
1549       - name: Restore boot JDK from cache
1550         id: bootjdk
1551         uses: actions/cache@v2
1552         with:
1553           path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }}
1554           key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1
1555 
1556       - name: Download boot JDK
1557         run: |
1558           mkdir -p ${HOME}/bootjdk/${BOOT_JDK_VERSION} || true
1559           wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}"
1560           echo "${BOOT_JDK_SHA256}  ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | shasum -a 256 -c >/dev/null -
1561           tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}"
1562           mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"
1563         if: steps.bootjdk.outputs.cache-hit != 'true'
1564 
1565       - name: Restore jtreg artifact
1566         id: jtreg_restore
1567         uses: actions/download-artifact@v2
1568         with:
1569           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1570           path: ~/jtreg/
1571         continue-on-error: true
1572 
1573       - name: Restore jtreg artifact (retry)
1574         uses: actions/download-artifact@v2
1575         with:
1576           name: transient_jtreg_${{ needs.prerequisites.outputs.bundle_id }}
1577           path: ~/jtreg/
1578         if: steps.jtreg_restore.outcome == 'failure'
1579 
1580       - name: Restore build artifacts
1581         id: build_restore
1582         uses: actions/download-artifact@v2
1583         with:
1584           name: transient_jdk-macos-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
1585           path: ~/jdk-macos-x64${{ matrix.artifact }}
1586         continue-on-error: true
1587 
1588       - name: Restore build artifacts (retry)
1589         uses: actions/download-artifact@v2
1590         with:
1591           name: transient_jdk-macos-x64${{ matrix.artifact }}_${{ needs.prerequisites.outputs.bundle_id }}
1592           path: ~/jdk-macos-x64${{ matrix.artifact }}
1593         if: steps.build_restore.outcome == 'failure'
1594 
1595       - name: Unpack jdk
1596         run: |
1597           mkdir -p "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin${{ matrix.artifact }}"
1598           tar -xf "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin${{ matrix.artifact }}"
1599 
1600       - name: Unpack tests
1601         run: |
1602           mkdir -p "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin-tests${{ matrix.artifact }}"
1603           tar -xf "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin-tests${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin-tests${{ matrix.artifact }}"
1604 
1605       - name: Install dependencies
1606         run: brew install make
1607 
1608       - name: Select Xcode version
1609         run: sudo xcode-select --switch /Applications/Xcode_11.3.1.app/Contents/Developer
1610 
1611       - name: Find root of jdk image dir
1612         run: |
1613           imageroot=`find ${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin${{ matrix.artifact }} -name release -type f`
1614           echo "imageroot=`dirname ${imageroot}`" >> $GITHUB_ENV
1615 
1616       - name: Run tests
1617         run: >
1618           JDK_IMAGE_DIR=${{ env.imageroot }}
1619           TEST_IMAGE_DIR=${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal_macos-x64_bin-tests${{ matrix.artifact }}
1620           BOOT_JDK=${HOME}/bootjdk/${BOOT_JDK_VERSION}/Contents/Home
1621           JT_HOME=${HOME}/jtreg
1622           gmake test-prebuilt
1623           CONF_NAME=run-test-prebuilt
1624           LOG_CMDLINES=true
1625           JTREG_VERBOSE=fail,error,time
1626           TEST=${{ matrix.suites }}
1627           TEST_OPTS_JAVA_OPTIONS=
1628           JTREG_KEYWORDS="!headful"
1629           JTREG="JAVA_OPTIONS=-XX:-CreateCoredumpOnCrash"
1630 
1631       - name: Check that all tests executed successfully
1632         if: always()
1633         run: >
1634           if ! grep --include=test-summary.txt -lqr build/*/test-results -e "TEST SUCCESS" ; then
1635             cat build/*/test-results/*/text/newfailures.txt ;
1636             cat build/*/test-results/*/text/other_errors.txt ;
1637             exit 1 ;
1638           fi
1639 
1640       - name: Create suitable test log artifact name
1641         if: always()
1642         run: echo "logsuffix=`echo ${{ matrix.test }} | sed -e 's!/!_!'g -e 's! !_!'g`" >> $GITHUB_ENV
1643 
1644       - name: Package test results
1645         if: always()
1646         working-directory: build/run-test-prebuilt/test-results/
1647         run: >
1648           zip -r9
1649           "$HOME/macos-x64${{ matrix.artifact }}_testresults_${{ env.logsuffix }}.zip"
1650           .
1651         continue-on-error: true
1652 
1653       - name: Package test support
1654         if: always()
1655         working-directory: build/run-test-prebuilt/test-support/
1656         run: >
1657           zip -r9
1658           "$HOME/macos-x64${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip"
1659           .
1660           -i *.jtr
1661           -i */hs_err*.log
1662           -i */replay*.log
1663         continue-on-error: true
1664 
1665       - name: Persist test results
1666         if: always()
1667         uses: actions/upload-artifact@v2
1668         with:
1669           path: ~/macos-x64${{ matrix.artifact }}_testresults_${{ env.logsuffix }}.zip
1670         continue-on-error: true
1671 
1672       - name: Persist test outputs
1673         if: always()
1674         uses: actions/upload-artifact@v2
1675         with:
1676           path: ~/macos-x64${{ matrix.artifact }}_testsupport_${{ env.logsuffix }}.zip
1677         continue-on-error: true
1678 
1679   artifacts:
1680     name: Post-process artifacts
1681     runs-on: "ubuntu-20.04"
1682     if: always()
1683     continue-on-error: true
1684     needs:
1685       - prerequisites
1686       - linux_additional_build
1687       - windows_aarch64_build
1688       - linux_x64_test
1689       - linux_x86_test
1690       - windows_x64_test
1691       - macos_x64_test
1692       - macos_aarch64_build
1693 
1694     steps:
1695       - name: Determine current artifacts endpoint
1696         id: actions_runtime
1697         uses: actions/github-script@v3
1698         with:
1699           script: "return { url: process.env['ACTIONS_RUNTIME_URL'], token: process.env['ACTIONS_RUNTIME_TOKEN'] }"
1700 
1701       - name: Display current artifacts
1702         run: >
1703           curl -s -H 'Accept: application/json;api-version=6.0-preview'
1704           -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}'
1705           '${{ fromJson(steps.actions_runtime.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview'
1706 
1707       - name: Delete transient artifacts
1708         run: >
1709           for url in `
1710           curl -s -H 'Accept: application/json;api-version=6.0-preview'
1711           -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}'
1712           '${{ fromJson(steps.actions_runtime.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview' |
1713           jq -r -c '.value | map(select(.name|startswith("transient_"))) | .[].url'`; do
1714           curl -s -H 'Accept: application/json;api-version=6.0-preview'
1715           -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}'
1716           -X DELETE "${url}";
1717           done
1718 
1719       - name: Fetch remaining artifacts (test results)
1720         uses: actions/download-artifact@v2
1721         with:
1722           path: test-results
1723 
1724       - name: Delete remaining artifacts
1725         run: >
1726           for url in `
1727           curl -s -H 'Accept: application/json;api-version=6.0-preview'
1728           -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}'
1729           '${{ fromJson(steps.actions_runtime.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview' |
1730           jq -r -c '.value | .[].url'`; do
1731           curl -s -H 'Accept: application/json;api-version=6.0-preview'
1732           -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}'
1733           -X DELETE "${url}";
1734           done
1735 
1736       - name: Upload a combined test results artifact
1737         uses: actions/upload-artifact@v2
1738         with:
1739           name: test-results_${{ needs.prerequisites.outputs.bundle_id }}
1740           path: test-results