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