From 840aa2b79e6cbf26d1bee5297b12d2a5988ffd7b Mon Sep 17 00:00:00 2001 From: Robin Westberg Date: Mon, 28 Sep 2020 09:31:51 +0000 Subject: [PATCH] 8253424: Add support for running pre-submit testing using GitHub Actions Reviewed-by: ehelin, erikj --- .github/workflows/submit.yml | 861 +++++++++++++++++++++++++++++++++++ make/conf/test-dependencies | 43 ++ 2 files changed, 904 insertions(+) create mode 100644 .github/workflows/submit.yml create mode 100644 make/conf/test-dependencies diff --git a/.github/workflows/submit.yml b/.github/workflows/submit.yml new file mode 100644 index 00000000000..f29a401a129 --- /dev/null +++ b/.github/workflows/submit.yml @@ -0,0 +1,861 @@ +name: Pre-submit tests + +on: + push: + branches-ignore: + - master + workflow_dispatch: + inputs: + platforms: + description: "Platform(s) to execute on" + required: true + default: "Linux x64, Windows x64, macOS x64" + +jobs: + prerequisites: + name: Prerequisites + runs-on: "ubuntu-latest" + outputs: + should_run: ${{ steps.check_submit.outputs.should_run }} + platform_linux_x64: ${{ steps.check_platforms.outputs.platform_linux_x64 }} + platform_windows_x64: ${{ steps.check_platforms.outputs.platform_windows_x64 }} + platform_macos_x64: ${{ steps.check_platforms.outputs.platform_macos_x64 }} + dependencies: ${{ steps.check_deps.outputs.dependencies }} + + steps: + - name: Check if submit tests should actually run depending on secrets and manual triggering + id: check_submit + run: echo "::set-output name=should_run::${{ github.event.inputs.platforms != '' || (!secrets.JDK_SUBMIT_FILTER || startsWith(github.ref, 'refs/heads/submit/')) }}" + + - name: Check which platforms should be included + id: check_platforms + run: | + 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'))) }}" + 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'))) }}" + 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'))) }}" + if: steps.check_submit.outputs.should_run != 'false' + + - name: Determine unique bundle identifier + run: echo "::set-env name=bundleid::${GITHUB_ACTOR}_${GITHUB_SHA:0:8}" + if: steps.check_submit.outputs.should_run != 'false' + + - name: Checkout the source + uses: actions/checkout@v2 + with: + path: jdk + if: steps.check_submit.outputs.should_run != 'false' + + - name: Determine versions and locations to be used for dependencies + id: check_deps + run: "echo ::set-output name=dependencies::`cat make/autoconf/version-numbers make/conf/test-dependencies | sed -e '1i {' -e 's/#.*//g' -e 's/\"//g' -e 's/\\(.*\\)=\\(.*\\)/\"\\1\": \"\\2\",/g' -e '$s/,\\s\\{0,\\}$/\\}/'`" + working-directory: jdk + if: steps.check_submit.outputs.should_run != 'false' + + - name: Print extracted dependencies to the log + run: "echo '${{ steps.check_deps.outputs.dependencies }}'" + if: steps.check_submit.outputs.should_run != 'false' + + - name: Determine the jtreg ref to checkout + run: "echo ::set-env name=JTREG_REF::jtreg${{ fromJson(steps.check_deps.outputs.dependencies).JTREG_VERSION }}-${{ fromJson(steps.check_deps.outputs.dependencies).JTREG_BUILD }}" + if: steps.check_submit.outputs.should_run != 'false' + + - name: Check if a jtreg image is present in the cache + id: jtreg + uses: actions/cache@v2 + with: + path: ~/jtreg/ + key: jtreg-${{ env.JTREG_REF }}-v1 + if: steps.check_submit.outputs.should_run != 'false' + + - name: Checkout the jtreg source + uses: actions/checkout@v2 + with: + repository: "openjdk/jtreg" + ref: ${{ env.JTREG_REF }} + path: jtreg + if: steps.check_submit.outputs.should_run != 'false' && steps.jtreg.outputs.cache-hit != 'true' + + - name: Build jtreg + run: sh make/build-all.sh ${JAVA_HOME} + working-directory: jtreg + if: steps.check_submit.outputs.should_run != 'false' && steps.jtreg.outputs.cache-hit != 'true' + + - name: Move jtreg image to destination folder + run: mv build/images/jtreg ~/ + working-directory: jtreg + if: steps.check_submit.outputs.should_run != 'false' && steps.jtreg.outputs.cache-hit != 'true' + + - name: Store jtreg for use by later steps + uses: actions/upload-artifact@v2 + with: + name: transient_jtreg_${{ env.bundleid }} + path: ~/jtreg/ + if: steps.check_submit.outputs.should_run != 'false' + + linux_x64_build: + name: Linux x64 + runs-on: "ubuntu-latest" + needs: prerequisites + if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_linux_x64 != 'false' + + strategy: + fail-fast: false + matrix: + flavor: + - build release + - build debug + - build hotspot no-pch + include: + - flavor: build debug + flags: --enable-debug + artifact: -debug + - flavor: build hotspot no-pch + flags: --disable-precompiled-headers + build-target: hotspot + + env: + JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" + BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}" + BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}" + BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_SHA256 }}" + + steps: + - name: Determine unique bundle identifier + run: echo "::set-env name=bundleid::${GITHUB_ACTOR}_${GITHUB_SHA:0:8}" + + - name: Checkout the source + uses: actions/checkout@v2 + with: + path: jdk + + - name: Restore boot JDK from cache + id: bootjdk + uses: actions/cache@v2 + with: + path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }} + key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1 + + - name: Download boot JDK + run: | + mkdir -p "${HOME}/bootjdk/${BOOT_JDK_VERSION}" + wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}" + echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | sha256sum -c >/dev/null - + tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}" + mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/" + if: steps.bootjdk.outputs.cache-hit != 'true' + + - name: Restore jtreg artifact + uses: actions/download-artifact@v2 + with: + name: transient_jtreg_${{ env.bundleid }} + path: ~/jtreg/ + + - name: Checkout gtest sources + uses: actions/checkout@v2 + with: + repository: "google/googletest" + ref: "release-${{ fromJson(needs.prerequisites.outputs.dependencies).GTEST_VERSION }}" + path: gtest + + - name: Install dependencies + run: sudo apt-get install libxrandr-dev libxtst-dev libcups2-dev libasound2-dev + + - name: Configure + run: > + bash configure + --with-conf-name=linux-x64 + ${{ matrix.flags }} + --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA} + --with-version-build=0 + --with-boot-jdk=${HOME}/bootjdk/${BOOT_JDK_VERSION} + --with-jtreg=${HOME}/jtreg + --with-gtest=${GITHUB_WORKSPACE}/gtest + --with-default-make-target="product-bundles test-bundles" + --with-zlib=system + --enable-jtreg-failure-handler + working-directory: jdk + + - name: Build + run: make CONF_NAME=linux-x64 ${{ matrix.build-target }} + working-directory: jdk + + - name: Persist test bundles + uses: actions/upload-artifact@v2 + with: + name: transient_jdk-linux-x64${{ matrix.artifact }}_${{ env.bundleid }} + path: | + jdk/build/linux-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin${{ matrix.artifact }}.tar.gz + jdk/build/linux-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin-tests${{ matrix.artifact }}.tar.gz + if: matrix.build-target == false + + linux_x64_test: + name: Linux x64 + runs-on: "ubuntu-latest" + needs: + - prerequisites + - linux_x64_build + + strategy: + fail-fast: false + matrix: + test: + - jdk/tier1 part 1 + - jdk/tier1 part 2 + - jdk/tier1 part 3 + - langtools/tier1 + - hs/tier1 common + - hs/tier1 compiler + - hs/tier1 gc + - hs/tier1 runtime + - hs/tier1 serviceability + include: + - test: jdk/tier1 part 1 + suites: test/jdk/:tier1_part1 + - test: jdk/tier1 part 2 + suites: test/jdk/:tier1_part2 + - test: jdk/tier1 part 3 + suites: test/jdk/:tier1_part3 + - test: langtools/tier1 + suites: test/langtools/:tier1 + - test: hs/tier1 common + suites: test/hotspot/jtreg/:tier1_common + artifact: -debug + - test: hs/tier1 compiler + suites: test/hotspot/jtreg/:tier1_compiler + artifact: -debug + - test: hs/tier1 gc + suites: test/hotspot/jtreg/:tier1_gc + artifact: -debug + - test: hs/tier1 runtime + suites: test/hotspot/jtreg/:tier1_runtime + artifact: -debug + - test: hs/tier1 serviceability + suites: test/hotspot/jtreg/:tier1_serviceability + artifact: -debug + + env: + JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" + BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_FILENAME }}" + BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_URL }}" + BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).LINUX_X64_BOOT_JDK_SHA256 }}" + + steps: + - name: Determine unique bundle identifier + run: echo "::set-env name=bundleid::${GITHUB_ACTOR}_${GITHUB_SHA:0:8}" + + - name: Checkout the source + uses: actions/checkout@v2 + + - name: Restore boot JDK from cache + id: bootjdk + uses: actions/cache@v2 + with: + path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }} + key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1 + + - name: Download boot JDK + run: | + mkdir -p "${HOME}/bootjdk/${BOOT_JDK_VERSION}" + wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}" + echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | sha256sum -c >/dev/null - + tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}" + mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/" + if: steps.bootjdk.outputs.cache-hit != 'true' + + - name: Restore jtreg artifact + uses: actions/download-artifact@v2 + with: + name: transient_jtreg_${{ env.bundleid }} + path: ~/jtreg/ + + - name: Restore build artifacts + uses: actions/download-artifact@v2 + with: + name: transient_jdk-linux-x64${{ matrix.artifact }}_${{ env.bundleid }} + path: ~/jdk-linux-x64${{ matrix.artifact }} + + - name: Unpack jdk + run: | + mkdir -p "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin${{ matrix.artifact }}" + tar -xf "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin${{ matrix.artifact }}" + + - name: Unpack tests + run: | + mkdir -p "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin-tests${{ matrix.artifact }}" + tar -xf "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin-tests${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin-tests${{ matrix.artifact }}" + + - name: Find root of jdk image dir + run: | + imageroot=`find ${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin${{ matrix.artifact }} -name release -type f` + echo "::set-env name=imageroot::`dirname ${imageroot}`" + + - name: Run tests + run: > + JDK_IMAGE_DIR=${{ env.imageroot }} + TEST_IMAGE_DIR=${HOME}/jdk-linux-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_linux-x64_bin-tests${{ matrix.artifact }} + BOOT_JDK=${HOME}/bootjdk/${BOOT_JDK_VERSION} + JT_HOME=${HOME}/jtreg + make test-prebuilt + CONF_NAME=run-test-prebuilt + LOG_CMDLINES=true + JTREG_VERBOSE=fail,error,time + TEST="${{ matrix.suites }}" + TEST_OPTS_JAVA_OPTIONS= + JTREG_KEYWORDS="!headful" + + - name: Create suitable test log artifact name + if: always() + run: echo "::set-env name=logsuffix::`echo ${{ matrix.test }} | sed -e 's!/!_!'g -e 's! !_!'g`" + + - name: Persist test logs + if: always() + uses: actions/upload-artifact@v2 + with: + name: linux-x64${{ matrix.artifact }}_testlogs_${{ env.logsuffix }} + path: build/*/test-results + continue-on-error: true + + windows_x64_build: + name: Windows x64 + runs-on: "windows-latest" + needs: prerequisites + if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_windows_x64 != 'false' + + strategy: + fail-fast: false + matrix: + flavor: + - build release + - build debug + include: + - flavor: build debug + flags: --enable-debug + artifact: -debug + + env: + JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" + BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}" + BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}" + BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_SHA256 }}" + + steps: + - name: Determine unique bundle identifier + run: echo ("::set-env name=bundleid::$env:GITHUB_ACTOR" + "_" + (-join "$env:GITHUB_SHA"[0..7])) + + - name: Restore cygwin packages from cache + id: cygwin + uses: actions/cache@v2 + with: + path: ~/cygwin/packages + key: cygwin-packages-${{ runner.os }}-v1 + + - name: Install cygwin + run: | + New-Item -Force -ItemType directory -Path "$HOME\cygwin" + & curl -L "https://www.cygwin.com/setup-x86_64.exe" -o "$HOME/cygwin/setup-x86_64.exe" + Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages 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 + + - name: Checkout the source + uses: actions/checkout@v2 + with: + path: jdk + + - name: Restore boot JDK from cache + id: bootjdk + uses: actions/cache@v2 + with: + path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }} + key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1 + + - name: Download boot JDK + run: | + mkdir -p "$HOME\bootjdk\$env:BOOT_JDK_VERSION" + & curl -L "$env:BOOT_JDK_URL" -o "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" + $FileHash = Get-FileHash -Algorithm SHA256 "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" + $FileHash.Hash -eq $env:BOOT_JDK_SHA256 + & tar -xf "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" -C "$HOME/bootjdk/$env:BOOT_JDK_VERSION" + Get-ChildItem "$HOME\bootjdk\$env:BOOT_JDK_VERSION\*\*" | Move-Item -Destination "$HOME\bootjdk\$env:BOOT_JDK_VERSION" + if: steps.bootjdk.outputs.cache-hit != 'true' + + - name: Checkout gtest sources + uses: actions/checkout@v2 + with: + repository: "google/googletest" + ref: "release-${{ fromJson(needs.prerequisites.outputs.dependencies).GTEST_VERSION }}" + path: gtest + + - name: Restore jtreg artifact + uses: actions/download-artifact@v2 + with: + name: transient_jtreg_${{ env.bundleid }} + path: ~/jtreg/ + + - name: Configure + run: > + $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ; + $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ; + & bash configure + --with-conf-name=windows-x64 + ${{ matrix.flags }} + --with-version-opt="$env:GITHUB_ACTOR-$env:GITHUB_SHA" + --with-version-build=0 + --with-boot-jdk="$HOME/bootjdk/$env:BOOT_JDK_VERSION" + --with-jtreg="$HOME/jtreg" + --with-gtest="$env:GITHUB_WORKSPACE/gtest" + --with-default-make-target="product-bundles test-bundles" + --enable-jtreg-failure-handler + working-directory: jdk + + - name: Build + run: | + $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ; + $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ; + & make CONF_NAME=windows-x64 ${{ matrix.build-target }} + working-directory: jdk + + - name: Persist test bundles + uses: actions/upload-artifact@v2 + with: + name: transient_jdk-windows-x64${{ matrix.artifact }}_${{ env.bundleid }} + path: | + jdk/build/windows-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }}.zip + jdk/build/windows-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin-tests${{ matrix.artifact }}.tar.gz + jdk/build/windows-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }}-symbols.tar.gz + if: matrix.build-target == false + + windows_x64_test: + name: Windows x64 + runs-on: "windows-latest" + needs: + - prerequisites + - windows_x64_build + + strategy: + fail-fast: false + matrix: + test: + - jdk/tier1 part 1 + - jdk/tier1 part 2 + - jdk/tier1 part 3 + - langtools/tier1 + - hs/tier1 common + - hs/tier1 compiler + - hs/tier1 gc + - hs/tier1 runtime + - hs/tier1 serviceability + include: + - test: jdk/tier1 part 1 + suites: test/jdk/:tier1_part1 + - test: jdk/tier1 part 2 + suites: test/jdk/:tier1_part2 + - test: jdk/tier1 part 3 + suites: test/jdk/:tier1_part3 + - test: langtools/tier1 + suites: test/langtools/:tier1 + - test: hs/tier1 common + suites: test/hotspot/jtreg/:tier1_common + artifact: -debug + - test: hs/tier1 compiler + suites: test/hotspot/jtreg/:tier1_compiler + artifact: -debug + - test: hs/tier1 gc + suites: test/hotspot/jtreg/:tier1_gc + artifact: -debug + - test: hs/tier1 runtime + suites: test/hotspot/jtreg/:tier1_runtime + artifact: -debug + - test: hs/tier1 serviceability + suites: test/hotspot/jtreg/:tier1_serviceability + artifact: -debug + + env: + JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" + BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_FILENAME }}" + BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_URL }}" + BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).WINDOWS_X64_BOOT_JDK_SHA256 }}" + + steps: + - name: Determine unique bundle identifier + run: echo ("::set-env name=bundleid::$env:GITHUB_ACTOR" + "_" + (-join "$env:GITHUB_SHA"[0..7])) + + - name: Checkout the source + uses: actions/checkout@v2 + + - name: Restore boot JDK from cache + id: bootjdk + uses: actions/cache@v2 + with: + path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }} + key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1 + + - name: Download boot JDK + run: | + mkdir -p "$HOME\bootjdk\$env:BOOT_JDK_VERSION" + & curl -L "$env:BOOT_JDK_URL" -o "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" + $FileHash = Get-FileHash -Algorithm SHA256 "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" + $FileHash.Hash -eq $env:BOOT_JDK_SHA256 + & tar -xf "$HOME/bootjdk/$env:BOOT_JDK_FILENAME" -C "$HOME/bootjdk/$env:BOOT_JDK_VERSION" + Get-ChildItem "$HOME\bootjdk\$env:BOOT_JDK_VERSION\*\*" | Move-Item -Destination "$HOME\bootjdk\$env:BOOT_JDK_VERSION" + if: steps.bootjdk.outputs.cache-hit != 'true' + + - name: Restore cygwin packages from cache + id: cygwin + uses: actions/cache@v2 + with: + path: ~/cygwin/packages + key: cygwin-packages-${{ runner.os }}-v1 + + - name: Install cygwin + run: | + New-Item -Force -ItemType directory -Path "$HOME\cygwin" + & curl -L "https://www.cygwin.com/setup-x86_64.exe" -o "$HOME/cygwin/setup-x86_64.exe" + Start-Process -FilePath "$HOME\cygwin\setup-x86_64.exe" -ArgumentList "--quiet-mode --packages 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 + + - name: Restore jtreg artifact + uses: actions/download-artifact@v2 + with: + name: transient_jtreg_${{ env.bundleid }} + path: ~/jtreg/ + + - name: Restore build artifacts + uses: actions/download-artifact@v2 + with: + name: transient_jdk-windows-x64${{ matrix.artifact }}_${{ env.bundleid }} + path: ~/jdk-windows-x64${{ matrix.artifact }} + + - name: Unpack jdk + run: | + mkdir -p "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }}" + tar -xf "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }}.zip" -C "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }}" + + - name: Unpack symbols + run: | + mkdir -p "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }}-symbols" + tar -xf "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }}-symbols.tar.gz" -C "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }}-symbols" + + - name: Unpack tests + run: | + mkdir -p "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin-tests${{ matrix.artifact }}" + tar -xf "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin-tests${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin-tests${{ matrix.artifact }}" + + - name: Find root of jdk image dir + run: echo ("::set-env name=imageroot::" + (Get-ChildItem -Path $HOME/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin${{ matrix.artifact }} -Filter release -Recurse -ErrorAction SilentlyContinue -Force).DirectoryName) + + - name: Run tests + run: > + $env:Path = "$HOME\cygwin\cygwin64\bin;$HOME\cygwin\cygwin64\bin;$env:Path" ; + $env:Path = $env:Path -split ";" -match "C:\\Windows|PowerShell|cygwin" -join ";" ; + $env:JDK_IMAGE_DIR = cygpath "${{ env.imageroot }}" ; + $env:SYMBOLS_IMAGE_DIR = cygpath "${{ env.imageroot }}" ; + $env:TEST_IMAGE_DIR = cygpath "$HOME/jdk-windows-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_windows-x64_bin-tests${{ matrix.artifact }}" ; + $env:BOOT_JDK = cygpath "$HOME/bootjdk/$env:BOOT_JDK_VERSION" ; + $env:JT_HOME = cygpath "$HOME/jtreg" ; + & make test-prebuilt + CONF_NAME=run-test-prebuilt + LOG_CMDLINES=true + JTREG_VERBOSE=fail,error,time + TEST=${{ matrix.suites }} + TEST_OPTS_JAVA_OPTIONS= + JTREG_KEYWORDS="!headful" + + - name: Create suitable test log artifact name + if: always() + run: echo ("::set-env name=logsuffix::" + ("${{ matrix.test }}" -replace "/", "_" -replace " ", "_")) + + - name: Persist test logs + if: always() + uses: actions/upload-artifact@v2 + with: + name: windows-x64${{ matrix.artifact }}_testlogs_${{ env.logsuffix }} + path: build/*/test-results + continue-on-error: true + + macos_x64_build: + name: macOS x64 + runs-on: "macos-latest" + needs: prerequisites + if: needs.prerequisites.outputs.should_run != 'false' && needs.prerequisites.outputs.platform_macos_x64 != 'false' + + strategy: + fail-fast: false + matrix: + flavor: + - build release + - build debug + include: + - flavor: build release + - flavor: build debug + flags: --enable-debug + artifact: -debug + + env: + JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" + BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_FILENAME }}" + BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_URL }}" + BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_SHA256 }}" + + steps: + - name: Determine unique bundle identifier + run: echo "::set-env name=bundleid::${GITHUB_ACTOR}_${GITHUB_SHA:0:8}" + + - name: Checkout the source + uses: actions/checkout@v2 + with: + path: jdk + + - name: Restore boot JDK from cache + id: bootjdk + uses: actions/cache@v2 + with: + path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }} + key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1 + + - name: Download boot JDK + run: | + mkdir -p ${HOME}/bootjdk/${BOOT_JDK_VERSION} || true + wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}" + echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | shasum -a 256 -c >/dev/null - + tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}" + mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/" + if: steps.bootjdk.outputs.cache-hit != 'true' + + - name: Restore jtreg artifact + uses: actions/download-artifact@v2 + with: + name: transient_jtreg_${{ env.bundleid }} + path: ~/jtreg/ + + - name: Checkout gtest sources + uses: actions/checkout@v2 + with: + repository: "google/googletest" + ref: "release-${{ fromJson(needs.prerequisites.outputs.dependencies).GTEST_VERSION }}" + path: gtest + + - name: Install dependencies + run: brew install make + + - name: Configure + run: > + bash configure + --with-conf-name=macos-x64 + ${{ matrix.flags }} + --with-version-opt=${GITHUB_ACTOR}-${GITHUB_SHA} + --with-version-build=0 + --with-boot-jdk=${HOME}/bootjdk/${BOOT_JDK_VERSION}/Contents/Home + --with-jtreg=${HOME}/jtreg + --with-gtest=${GITHUB_WORKSPACE}/gtest + --with-default-make-target="product-bundles test-bundles" + --with-zlib=system + --enable-jtreg-failure-handler + working-directory: jdk + + - name: Build + run: make CONF_NAME=macos-x64 ${{ matrix.build-target }} + working-directory: jdk + + - name: Persist test bundles + uses: actions/upload-artifact@v2 + with: + name: transient_jdk-macos-x64${{ matrix.artifact }}_${{ env.bundleid }} + path: | + jdk/build/macos-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin${{ matrix.artifact }}.tar.gz + jdk/build/macos-x64/bundles/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin-tests${{ matrix.artifact }}.tar.gz + if: matrix.build-target == false + + macos_x64_test: + name: macOS x64 + runs-on: "macos-latest" + needs: + - prerequisites + - macos_x64_build + + strategy: + fail-fast: false + matrix: + test: + - jdk/tier1 part 1 + - jdk/tier1 part 2 + - jdk/tier1 part 3 + - langtools/tier1 + - hs/tier1 common + - hs/tier1 compiler + - hs/tier1 gc + - hs/tier1 runtime + - hs/tier1 serviceability + include: + - test: jdk/tier1 part 1 + suites: test/jdk/:tier1_part1 + - test: jdk/tier1 part 2 + suites: test/jdk/:tier1_part2 + - test: jdk/tier1 part 3 + suites: test/jdk/:tier1_part3 + - test: langtools/tier1 + suites: test/langtools/:tier1 + - test: hs/tier1 common + suites: test/hotspot/jtreg/:tier1_common + artifact: -debug + - test: hs/tier1 compiler + suites: test/hotspot/jtreg/:tier1_compiler + artifact: -debug + - test: hs/tier1 gc + suites: test/hotspot/jtreg/:tier1_gc + artifact: -debug + - test: hs/tier1 runtime + suites: test/hotspot/jtreg/:tier1_runtime + artifact: -debug + - test: hs/tier1 serviceability + suites: test/hotspot/jtreg/:tier1_serviceability + artifact: -debug + + env: + JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).DEFAULT_VERSION_FEATURE }}" + BOOT_JDK_VERSION: "${{ fromJson(needs.prerequisites.outputs.dependencies).BOOT_JDK_VERSION }}" + BOOT_JDK_FILENAME: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_FILENAME }}" + BOOT_JDK_URL: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_URL }}" + BOOT_JDK_SHA256: "${{ fromJson(needs.prerequisites.outputs.dependencies).MACOS_X64_BOOT_JDK_SHA256 }}" + + steps: + - name: Determine unique bundle identifier + run: echo "::set-env name=bundleid::${GITHUB_ACTOR}_${GITHUB_SHA:0:8}" + + - name: Checkout the source + uses: actions/checkout@v2 + + - name: Restore boot JDK from cache + id: bootjdk + uses: actions/cache@v2 + with: + path: ~/bootjdk/${{ env.BOOT_JDK_VERSION }} + key: bootjdk-${{ runner.os }}-${{ env.BOOT_JDK_VERSION }}-${{ env.BOOT_JDK_SHA256 }}-v1 + + - name: Download boot JDK + run: | + mkdir -p ${HOME}/bootjdk/${BOOT_JDK_VERSION} || true + wget -O "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" "${BOOT_JDK_URL}" + echo "${BOOT_JDK_SHA256} ${HOME}/bootjdk/${BOOT_JDK_FILENAME}" | shasum -a 256 -c >/dev/null - + tar -xf "${HOME}/bootjdk/${BOOT_JDK_FILENAME}" -C "${HOME}/bootjdk/${BOOT_JDK_VERSION}" + mv "${HOME}/bootjdk/${BOOT_JDK_VERSION}/"*/* "${HOME}/bootjdk/${BOOT_JDK_VERSION}/" + if: steps.bootjdk.outputs.cache-hit != 'true' + + - name: Restore jtreg artifact + uses: actions/download-artifact@v2 + with: + name: transient_jtreg_${{ env.bundleid }} + path: ~/jtreg/ + + - name: Restore build artifacts + uses: actions/download-artifact@v2 + with: + name: transient_jdk-macos-x64${{ matrix.artifact }}_${{ env.bundleid }} + path: ~/jdk-macos-x64${{ matrix.artifact }} + + - name: Unpack jdk + run: | + mkdir -p "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin${{ matrix.artifact }}" + tar -xf "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin${{ matrix.artifact }}" + + - name: Unpack tests + run: | + mkdir -p "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin-tests${{ matrix.artifact }}" + tar -xf "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin-tests${{ matrix.artifact }}.tar.gz" -C "${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin-tests${{ matrix.artifact }}" + + - name: Install dependencies + run: brew install make + + - name: Find root of jdk image dir + run: | + imageroot=`find ${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin${{ matrix.artifact }} -name release -type f` + echo "::set-env name=imageroot::`dirname ${imageroot}`" + + - name: Run tests + run: > + JDK_IMAGE_DIR=${{ env.imageroot }} + TEST_IMAGE_DIR=${HOME}/jdk-macos-x64${{ matrix.artifact }}/jdk-${{ env.JDK_VERSION }}-internal+0_osx-x64_bin-tests${{ matrix.artifact }} + BOOT_JDK=${HOME}/bootjdk/${BOOT_JDK_VERSION}/Contents/Home + JT_HOME=${HOME}/jtreg + gmake test-prebuilt + CONF_NAME=run-test-prebuilt + LOG_CMDLINES=true + JTREG_VERBOSE=fail,error,time + TEST=${{ matrix.suites }} + TEST_OPTS_JAVA_OPTIONS= + JTREG_KEYWORDS="!headful" + + - name: Create suitable test log artifact name + if: always() + run: echo "::set-env name=logsuffix::`echo ${{ matrix.test }} | sed -e 's!/!_!'g -e 's! !_!'g`" + + - name: Persist test logs + if: always() + uses: actions/upload-artifact@v2 + with: + name: macos-x64${{ matrix.artifact }}_testlogs_${{ env.logsuffix }} + path: build/*/test-results + continue-on-error: true + + artifacts: + name: Post-process artifacts + runs-on: "ubuntu-latest" + if: always() + continue-on-error: true + needs: + - linux_x64_test + - windows_x64_test + - macos_x64_test + + steps: + - name: Determine current artifacts endpoint + id: actions_runtime + uses: actions/github-script@v3 + with: + script: "return { url: process.env['ACTIONS_RUNTIME_URL'], token: process.env['ACTIONS_RUNTIME_TOKEN'] }" + + - name: Display current artifacts + run: > + curl -s -H 'Accept: application/json;api-version=6.0-preview' + -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}' + '${{ fromJson(steps.actions_runtime.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview' + + - name: Delete transient artifacts + run: > + for url in ` + curl -s -H 'Accept: application/json;api-version=6.0-preview' + -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}' + '${{ fromJson(steps.actions_runtime.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview' | + jq -r -c '.value | map(select(.name|startswith("transient_"))) | .[].url'`; do + curl -s -H 'Accept: application/json;api-version=6.0-preview' + -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}' + -X DELETE "${url}"; + done + + - name: Fetch remaining artifacts (test results) + uses: actions/download-artifact@v2 + with: + path: test-results + + - name: Delete remaining artifacts + run: > + for url in ` + curl -s -H 'Accept: application/json;api-version=6.0-preview' + -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}' + '${{ fromJson(steps.actions_runtime.outputs.result).url }}_apis/pipelines/workflows/${{ github.run_id }}/artifacts?api-version=6.0-preview' | + jq -r -c '.value | .[].url'`; do + curl -s -H 'Accept: application/json;api-version=6.0-preview' + -H 'Authorization: Bearer ${{ fromJson(steps.actions_runtime.outputs.result).token }}' + -X DELETE "${url}"; + done + + - name: Determine unique bundle identifier + run: echo "::set-env name=bundleid::${GITHUB_ACTOR}_${GITHUB_SHA:0:8}" + + - name: Upload a combined test results artifact + uses: actions/upload-artifact@v2 + with: + name: test-results_${{ env.bundleid }} + path: test-results diff --git a/make/conf/test-dependencies b/make/conf/test-dependencies new file mode 100644 index 00000000000..4cc4610daed --- /dev/null +++ b/make/conf/test-dependencies @@ -0,0 +1,43 @@ +# +# Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Versions and download locations for dependencies used by pre-submit testing. + +BOOT_JDK_VERSION=15 +JTREG_VERSION=5.1 +JTREG_BUILD=b01 +GTEST_VERSION=1.8.1 + +LINUX_X64_BOOT_JDK_FILENAME=openjdk-15_linux-x64_bin.tar.gz +LINUX_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_linux-x64_bin.tar.gz +LINUX_X64_BOOT_JDK_SHA256=bb67cadee687d7b486583d03c9850342afea4593be4f436044d785fba9508fb7 + +WINDOWS_X64_BOOT_JDK_FILENAME=openjdk-15_windows-x64_bin.zip +WINDOWS_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_windows-x64_bin.zip +WINDOWS_X64_BOOT_JDK_SHA256=764e39a71252a9791118a31ae56a4247c049463bda5eb72497122ec50b1d07f8 + +MACOS_X64_BOOT_JDK_FILENAME=openjdk-115_osx-x64_bin.tar.gz +MACOS_X64_BOOT_JDK_URL=https://download.java.net/java/GA/jdk15/779bf45e88a44cbd9ea6621d33e33db1/36/GPL/openjdk-15_osx-x64_bin.tar.gz +MACOS_X64_BOOT_JDK_SHA256=ab842c8c0953b816be308c098c1a021177a4776bef24da85b6bafbbd657c7e1a