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