Skip to content

Commit

Permalink
Merge pull request #34597 from quarkusio/build-cache
Browse files Browse the repository at this point in the history
Enable Gradle Enterprise build cache
  • Loading branch information
gsmet authored Aug 24, 2023
2 parents b254b4c + 081a367 commit 3666595
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 46 deletions.
61 changes: 56 additions & 5 deletions .github/workflows/ci-actions-incremental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ jobs:
gib_impacted: ${{ steps.get-gib-impacted.outputs.impacted_modules }}
m2-cache-key: ${{ steps.m2-cache-key.outputs.key }}
steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-11" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=Initial JDK 11 Build" >> "$GITHUB_ENV"
- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down Expand Up @@ -160,7 +165,7 @@ jobs:
id: get-gib-impacted
# mvnw just for creating gib-impacted.log ("validate" should not waste much time if not incremental at all, e.g. on main)
run: |
./mvnw -q -T1C $COMMON_MAVEN_ARGS -Dtcks -Dquickly-ci ${{ steps.get-gib-args.outputs.gib_args }} -Dgib.logImpactedTo=gib-impacted.log validate
./mvnw -q -T1C $COMMON_MAVEN_ARGS -Dscan=false -Dtcks -Dquickly-ci ${{ steps.get-gib-args.outputs.gib_args }} -Dgib.logImpactedTo=gib-impacted.log validate
if [ -f gib-impacted.log ]
then
GIB_IMPACTED=$(cat gib-impacted.log)
Expand Down Expand Up @@ -192,6 +197,7 @@ jobs:
name: "build-reports-Initial JDK 11 Build"
path: |
target/build-report.json
target/gradle-build-scan-url.txt
LICENSE.txt
retention-days: 2

Expand Down Expand Up @@ -273,8 +279,12 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.calculate-test-jobs.outputs.jvm_matrix) }}


steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-${{matrix.java.name}}" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=JVM Tests - JDK ${{matrix.java.name}}" >> "$GITHUB_ENV"
- name: Stop mysql
if: "!startsWith(matrix.java.os-name, 'windows') && !startsWith(matrix.java.os-name, 'macos')"
shell: bash
Expand Down Expand Up @@ -348,6 +358,7 @@ jobs:
path: |
**/target/*-reports/TEST-*.xml
target/build-report.json
target/gradle-build-scan-url.txt
LICENSE.txt
retention-days: 2
- name: Upload gc.log
Expand Down Expand Up @@ -391,6 +402,11 @@ jobs:
os-name: "windows-latest"
}
steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-${{matrix.java.name}}" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=Maven Tests - JDK ${{matrix.java.name}}" >> "$GITHUB_ENV"
- name: Support longpaths on Windows
if: "startsWith(matrix.java.os-name, 'windows')"
run: git config --global core.longpaths true
Expand Down Expand Up @@ -444,6 +460,7 @@ jobs:
path: |
**/target/*-reports/TEST-*.xml
target/build-report.json
target/gradle-build-scan-url.txt
LICENSE.txt
retention-days: 2

Expand Down Expand Up @@ -472,6 +489,11 @@ jobs:
os-name: "windows-latest"
}
steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-${{matrix.java.name}}" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=Gradle Tests - JDK ${{matrix.java.name}}" >> "$GITHUB_ENV"
- name: Support longpaths on Windows
if: "startsWith(matrix.java.os-name, 'windows')"
run: git config --global core.longpaths true
Expand Down Expand Up @@ -500,7 +522,7 @@ jobs:
# runs on Windows as well but would require newline conversion, not worth it
if: "!startsWith(matrix.java.os-name, 'windows')"
shell: bash
run: ./integration-tests/gradle/update-dependencies.sh $COMMON_MAVEN_ARGS
run: ./integration-tests/gradle/update-dependencies.sh $COMMON_MAVEN_ARGS -Dscan=false
- name: Build
shell: bash
# Important: keep -pl ... in sync with "Calculate run flags"!
Expand All @@ -514,6 +536,7 @@ jobs:
**/build/test-results/test/TEST-*.xml
**/target/*-reports/TEST-*.xml
target/build-report.json
target/gradle-build-scan-url.txt
LICENSE.txt
retention-days: 2

Expand Down Expand Up @@ -544,6 +567,11 @@ jobs:
os-name: "windows-latest"
}
steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-${{matrix.java.name}}" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=Devtools Tests - JDK ${{matrix.java.name}}" >> "$GITHUB_ENV"
- name: Support longpaths on Windows
if: "startsWith(matrix.java.os-name, 'windows')"
run: git config --global core.longpaths true
Expand Down Expand Up @@ -589,6 +617,7 @@ jobs:
path: |
**/target/*-reports/TEST-*.xml
target/build-report.json
target/gradle-build-scan-url.txt
LICENSE.txt
retention-days: 2

Expand All @@ -609,6 +638,11 @@ jobs:
os-name: "ubuntu-latest"
}
steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-${{matrix.java.name}}" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=Quickstarts Compilation - JDK ${{matrix.java.name}}" >> "$GITHUB_ENV"
- uses: actions/checkout@v3
- name: Restore Maven Repository
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -656,6 +690,11 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.calculate-test-jobs.outputs.virtual_threads_matrix) }}
steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-${{matrix.java.name}}" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=Virtual Thread Support Tests Native - ${{matrix.category}}" >> "$GITHUB_ENV"
- uses: actions/checkout@v3
- name: Restore Maven Repository
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -696,6 +735,7 @@ jobs:
path: |
integration-tests/virtual-threads/**/target/*-reports/TEST-*.xml
integration-tests/virtual-threads/target/build-report.json
integration-tests/virtual-threads/target/gradle-build-scan-url.txt
retention-days: 2
tcks-test:
name: MicroProfile TCKs Tests
Expand All @@ -706,6 +746,11 @@ jobs:
timeout-minutes: 150

steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-11" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=MicroProfile TCKs Tests" >> "$GITHUB_ENV"
- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand Down Expand Up @@ -760,6 +805,7 @@ jobs:
path: |
**/target/*-reports/TEST-*.xml
target/build-report.json
target/gradle-build-scan-url.txt
LICENSE.txt
retention-days: 2

Expand All @@ -779,6 +825,11 @@ jobs:
fail-fast: false
matrix: ${{ fromJson(needs.calculate-test-jobs.outputs.native_matrix) }}
steps:
- name: Gradle Enterprise environment
shell: bash
run: |
echo "GE_TAGS=jdk-${{matrix.java.name}}" >> "$GITHUB_ENV"
echo "GE_CUSTOM_VALUES=gh-job-name=Native Tests - ${{matrix.category}}" >> "$GITHUB_ENV"
- name: Support longpaths on Windows
if: "startsWith(matrix.os-name, 'windows')"
run: git config --global core.longpaths true
Expand Down Expand Up @@ -849,14 +900,15 @@ jobs:
**/target/*-reports/TEST-*.xml
**/build/test-results/test/TEST-*.xml
target/build-report.json
target/gradle-build-scan-url.txt
LICENSE.txt
retention-days: 2

build-report:
runs-on: ubuntu-latest
name: Build report
needs: [build-jdk11,jvm-tests,maven-tests,gradle-tests,devtools-tests,quickstarts-tests,tcks-test,native-tests,virtual-thread-native-tests]
if: always() && github.repository != 'quarkusio/quarkus'
if: always()
steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -871,4 +923,3 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
build-reports-artifacts-path: build-reports-artifacts
forks-only: true
4 changes: 2 additions & 2 deletions .mvn/extensions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<extension>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<version>1.18</version>
<version>1.18.1</version>
</extension>
<extension>
<groupId>com.gradle</groupId>
<artifactId>common-custom-user-data-maven-extension</artifactId>
<version>1.12</version>
<version>1.12.2</version>
</extension>
</extensions>
59 changes: 49 additions & 10 deletions .mvn/gradle-enterprise-custom-user-data.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
// Configure build scan publication
boolean publish = true
if(session?.getRequest()?.getBaseDirectory() != null) {
def testBuildPaths = [ '/target/codestart-test/', '/target/it/', '/target/test-classes/', '/target/test-project/']
def testBuildPaths = [
File.separator + 'target' + File.separator + 'codestart-test' + File.separator,
File.separator + 'target' + File.separator + 'it' + File.separator,
File.separator + 'target' + File.separator + 'test-classes' + File.separator,
File.separator + 'target' + File.separator + 'test-project' + File.separator
]
publish = testBuildPaths.every {testBuildPath -> !session.getRequest().getBaseDirectory().contains(testBuildPath) }
if(!publish) {
// do not publish a build scan for test builds
Expand All @@ -21,24 +26,58 @@ if (System.env.MAVEN_CMD_LINE_ARGS) {

//Add github action information
if (System.env.GITHUB_ACTIONS) {
def jobName = System.env.GITHUB_JOB
def jobId = System.env.GITHUB_JOB

buildScan.value('gh-job-name', jobName)
buildScan.value('gh-job-id', jobId)
buildScan.value('gh-event-name', System.env.GITHUB_EVENT_NAME)
buildScan.value('gh-ref-name', System.env.GITHUB_REF_NAME)
buildScan.value('gh-actor', System.env.GITHUB_ACTOR)
buildScan.value('gh-workflow', System.env.GITHUB_WORKFLOW)
String jobCustomValues = System.env.GE_CUSTOM_VALUES
if (jobCustomValues != null && !jobCustomValues.isBlank()) {
for (String jobCustomValue : jobCustomValues.split(",")) {
int index = jobCustomValue.indexOf('=')
if (index <= 0) {
continue
}
buildScan.value(jobCustomValue.substring(0, index).trim(), jobCustomValue.substring(index + 1).trim())
}
}

buildScan.tag(jobId)
buildScan.tag(System.env.GITHUB_EVENT_NAME)
buildScan.tag(System.env.GITHUB_WORKFLOW)
String jobTags = System.env.GE_TAGS
if (jobTags != null && !jobTags.isBlank()) {
for (String tag : jobTags.split(",")) {
buildScan.tag(tag.trim())
}
}

buildScan.link('Workflow run', System.env.GITHUB_SERVER_URL + '/' + System.env.GITHUB_REPOSITORY + '/actions/runs/' + System.env.GITHUB_RUN_ID)

def prNumber = System.env.PULL_REQUEST_NUMBER
if (prNumber != null) {
buildScan.value('gh-pr', prNumber)
buildScan.tag('pr-' + prNumber)

def prnumber = System.env.PULL_REQUEST_NUMBER
if (prnumber != null) {
buildScan.value('gh-pr', prnumber)
buildScan.tag('pr-' + prnumber)
buildScan.link('Pull request', System.env.GITHUB_SERVER_URL + '/' + System.env.GITHUB_REPOSITORY + '/pull/' + prNumber )
}

buildScan.buildScanPublished { publishedBuildScan ->
new File(System.env.GITHUB_STEP_SUMMARY).withWriterAppend { out ->
out.println("\n[Build scan for '${mvnCommand}' in ${jobName}](${publishedBuildScan.buildScanUri})\n")
buildScan.buildScanPublished { publishedBuildScan -> {
File target = new File("target")
if (!target.exists()) {
target.mkdir()
}
File gradleBuildScanUrlFile = new File("target/gradle-build-scan-url.txt")
if (!gradleBuildScanUrlFile.exists()) {
gradleBuildScanUrlFile.withWriter { out ->
out.print(publishedBuildScan.buildScanUri)
}
}
new File(System.env.GITHUB_STEP_SUMMARY).withWriterAppend { out ->
out.println("\n[Build scan](${publishedBuildScan.buildScanUri})\n<sup>`${mvnCommand}`</sup>\n\n")
}
}
}
}
Expand Down
20 changes: 14 additions & 6 deletions .mvn/gradle-enterprise.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<gradleEnterprise>
<server>
<url>https://ge.quarkus.io</url>
<allowUntrusted>false</allowUntrusted>
</server>
<url>https://ge.quarkus.io</url>
<allowUntrusted>false</allowUntrusted>
</server>
<buildScan>
<!-- adjust conditions ?
mvn gradle-enterprise:provision-access-key
Expand All @@ -22,8 +22,16 @@
<backgroundBuildScanUpload>#{env['CI'] == null}</backgroundBuildScanUpload>
</buildScan>
<buildCache>
<local><enabled>false</enabled></local>
<remote><enabled>false</enabled></remote>
<local>
<enabled>false</enabled>
</local>
<remote>
<server>
<url>https://ge.quarkus.io/cache/main/</url>
<allowUntrusted>true</allowUntrusted>
</server>
<enabled>true</enabled>
<storeEnabled>#{env['CI'] != null}</storeEnabled>
</remote>
</buildCache>
</gradleEnterprise>

16 changes: 0 additions & 16 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -771,22 +771,6 @@
</executions>
</plugin>

<plugin>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<configuration>
<gradleEnterprise>
<normalization>
<systemProperties>
<ignoredKeys>
<ignore>maven.repo.local</ignore>
</ignoredKeys>
</systemProperties>
</normalization>
</gradleEnterprise>
</configuration>
</plugin>

</plugins>
</pluginManagement>
</build>
Expand Down
Loading

0 comments on commit 3666595

Please sign in to comment.