Skip to content

Commit

Permalink
Forcing Gradle's toolchain to use setup-java's JDKs (#820)
Browse files Browse the repository at this point in the history
  • Loading branch information
meiao authored Apr 14, 2022
1 parent d362f48 commit cb52695
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 21 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/AITs-Basic-Features-Special-JREs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ jobs:
</toolchains>
EOF
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV

## End JDK Install

# Check ENV variables
Expand Down Expand Up @@ -240,7 +244,7 @@ jobs:
echo "JAVA_HOME=${ORG_GRADLE_PROJECT_jdk8}" >> $GITHUB_ENV
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: Check disk space
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/AITs-Basic-Features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk17=${JAVA_HOME}" >> $GITHUB_ENV
# Install 18 EA
# Install 18
- name: Set up Java 18
uses: actions/setup-java@v2
with:
Expand Down Expand Up @@ -225,6 +225,10 @@ jobs:
</toolchains>
EOF
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV

## End JDK Install

# Check ENV variables
Expand Down Expand Up @@ -254,7 +258,7 @@ jobs:
echo "JAVA_HOME=${ORG_GRADLE_PROJECT_jdk8}" >> $GITHUB_ENV
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: Check disk space
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/AITs-Datastores.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk8=${JAVA_HOME}" >> $GITHUB_ENV
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV

## End JDK Install

# Check ENV variables
Expand Down Expand Up @@ -182,7 +186,7 @@ jobs:
echo "JAVA_HOME=${ORG_GRADLE_PROJECT_jdk8}" >> $GITHUB_ENV
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: CD to agent-integration-tests dir.
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/AITs-Frameworks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk17=${JAVA_HOME}" >> $GITHUB_ENV
# Install 18 EA
# Install 18
- name: Set up Java 18
uses: actions/setup-java@v2
with:
Expand All @@ -164,6 +164,10 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk8=${JAVA_HOME}" >> $GITHUB_ENV
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV

## End JDK Install

# Check ENV variables
Expand Down Expand Up @@ -193,7 +197,7 @@ jobs:
echo "JAVA_HOME=${ORG_GRADLE_PROJECT_jdk8}" >> $GITHUB_ENV
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: CD to agent-integration-tests dir.
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/AITs-Security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk17=${JAVA_HOME}" >> $GITHUB_ENV
# Install 18 EA
# Install 18
- name: Set up Java 18
uses: actions/setup-java@v2
with:
Expand All @@ -163,6 +163,10 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk8=${JAVA_HOME}" >> $GITHUB_ENV
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV

## End JDK Install

# Check ENV variables
Expand Down Expand Up @@ -192,7 +196,7 @@ jobs:
echo "JAVA_HOME=${ORG_GRADLE_PROJECT_jdk8}" >> $GITHUB_ENV
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: CD to agent-integration-tests dir.
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/AITs-Servers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk17=${JAVA_HOME}" >> $GITHUB_ENV
# Install 18 EA
# Install 18
- name: Set up Java 18
uses: actions/setup-java@v2
with:
Expand All @@ -165,6 +165,10 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk8=${JAVA_HOME}" >> $GITHUB_ENV
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV

## End JDK Install

# Check ENV variables
Expand Down Expand Up @@ -194,7 +198,7 @@ jobs:
echo "JAVA_HOME=${ORG_GRADLE_PROJECT_jdk8}" >> $GITHUB_ENV
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: CD to agent-integration-tests dir.
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/AITs-Traces.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk17=${JAVA_HOME}" >> $GITHUB_ENV
# Install 18 EA
# Install 18
- name: Set up Java 18
uses: actions/setup-java@v2
with:
Expand All @@ -158,6 +158,10 @@ jobs:
run: |
echo "ORG_GRADLE_PROJECT_jdk8=${JAVA_HOME}" >> $GITHUB_ENV
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV

## End JDK Install

# Check ENV variables
Expand Down Expand Up @@ -187,7 +191,7 @@ jobs:
echo "JAVA_HOME=${ORG_GRADLE_PROJECT_jdk8}" >> $GITHUB_ENV
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: CD to agent-integration-tests dir.
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/X-Reusable-Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,15 @@ jobs:
java-version: 18

# Save new JDK variable
- name: Save JAVA_HOME as JDK18ea for later usage
- name: Save JAVA_HOME as JDK18 for later usage
run: |
echo "Current JAVA_HOME = ${JAVA_HOME}"
echo "ORG_GRADLE_PROJECT_jdk18=$JAVA_HOME" >> $GITHUB_ENV
# Needed for toolchains and GHA.
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV

# Check ENV variables
- name: Check environmental variables
run: printenv | sort -f
Expand Down Expand Up @@ -134,7 +138,7 @@ jobs:
echo "REVIEW ANY NEW ITEMS IN WORKSPACE"
ls -la
cat settings.gradle
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
- name: Build newrelicJar w/o GE
Expand All @@ -145,7 +149,7 @@ jobs:
echo "*** NOT PUBLISHING BUILD SCANS ***"
ls -la
cat settings.gradle
./gradlew clean jar --parallel
./gradlew $GRADLE_OPTIONS clean jar --parallel
ls -la newrelic-agent/build/
# GHA run instrumentation tests
Expand Down Expand Up @@ -174,7 +178,7 @@ jobs:
LANGUAGE: java
TEST_TYPE: instrumentation
run: |
./gradlew --console=plain :instrumentation:test -Ptest${{ inputs.jre }} --continue
./gradlew $GRADLE_OPTIONS --console=plain :instrumentation:test -Ptest${{ inputs.jre }} --continue
# Run the build without Gradle Enterprise
- name: Run instrumentation tests for Java ${{ inputs.jre }} w/o GE
Expand All @@ -183,7 +187,7 @@ jobs:
JAVA_HOME: ${{ env.ORG_GRADLE_PROJECT_jdk8 }}
run: |
echo "*** NOT PUBLISHING BUILD SCANS OR CACHE ***"
./gradlew --console=plain :instrumentation:test -Ptest${{ inputs.jre }} --continue
./gradlew $GRADLE_OPTIONS --console=plain :instrumentation:test -Ptest${{ inputs.jre }} --continue
# Capture HTML build result in artifacts
- name: Capture build reports
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_main_snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ jobs:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew publish -x :newrelic-scala-api:publish -x :newrelic-scala-cats-api:publish -x :newrelic-cats-effect3-api:publish -x :newrelic-scala-zio-api:publish
run: ./gradlew $GRADLE_OPTIONS publish -x :newrelic-scala-api:publish -x :newrelic-scala-cats-api:publish -x :newrelic-cats-effect3-api:publish -x :newrelic-scala-zio-api:publish
- name: Publish snapshot apis
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew :newrelic-scala-api:publish :newrelic-scala-cats-api:publish :newrelic-cats-effect3-api:publish :newrelic-scala-zio-api:publish
run: ./gradlew $GRADLE_OPTIONS :newrelic-scala-api:publish :newrelic-scala-cats-api:publish :newrelic-cats-effect3-api:publish :newrelic-scala-zio-api:publish


7 changes: 5 additions & 2 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ jobs:
$ORG_GRADLE_PROJECT_jdk11/bin/java -version
- name: correct JAVA_HOME
run: echo "JAVA_HOME=$ORG_GRADLE_PROJECT_jdk8" >> $GITHUB_ENV
# these options are required so toolchain only uses the JDKs we specified
- name: setup gradle options
run: echo "GRADLE_OPTIONS=-Porg.gradle.java.installations.auto-detect=false -Porg.gradle.java.installations.fromEnv=ORG_GRADLE_PROJECT_jdk8,ORG_GRADLE_PROJECT_jdk11" >> $GITHUB_ENV
# Restore the gradle cache
- uses: actions/cache@v2
with:
Expand Down Expand Up @@ -73,12 +76,12 @@ jobs:
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew publish -x :newrelic-scala-api:publish -x :newrelic-scala-cats-api:publish -x :newrelic-cats-effect3-api:publish -x :newrelic-scala-zio-api:publish -Prelease=true
run: ./gradlew $GRADLE_OPTIONS publish -x :newrelic-scala-api:publish -x :newrelic-scala-cats-api:publish -x :newrelic-cats-effect3-api:publish -x :newrelic-scala-zio-api:publish -Prelease=true
- name: Publish release apis
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEY_ID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
run: ./gradlew :newrelic-scala-api:publish :newrelic-scala-cats-api:publish :newrelic-cats-effect3-api:publish :newrelic-scala-zio-api:publish -Prelease=true
run: ./gradlew $GRADLE_OPTIONS :newrelic-scala-api:publish :newrelic-scala-cats-api:publish :newrelic-cats-effect3-api:publish :newrelic-scala-zio-api:publish -Prelease=true

0 comments on commit cb52695

Please sign in to comment.