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