Review our usage of gradle cache (#1474)

* Experiments

* Experiments

* Experiments

* Update nightly.yaml

Trying to populate remote cache

* Experiments

* Better cache and snapshot publishing in GHA

* Read-only remote cache for PRs
This commit is contained in:
Nikita Salnikov-Tarnovski 2020-10-25 22:06:21 +02:00 committed by GitHub
parent f6ad05b8e3
commit d033ed594f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 110 additions and 20 deletions

View File

@ -7,11 +7,47 @@ on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11 for running checks
uses: actions/setup-java@v1
with:
java-version: 11
- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
with:
job-id: jdk11
- name: Build
uses: nick-invision/retry@v1
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
with:
command: ./gradlew build --stacktrace
timeout_minutes: 90
max_attempts: 3
- name: Aggregate test reports with ciMate
if: always()
continue-on-error: true
env:
CIMATE_PROJECT_ID: mz1jo49x
CIMATE_CI_KEY: "PR / jdk11"
run: |
wget -q https://get.cimate.io/release/linux/cimate
chmod +x cimate
./cimate -v "**/TEST-*.xml"
test:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11, 15]
java: [ 8, 15 ]
fail-fast: false
steps:
- uses: actions/checkout@v2
@ -23,19 +59,25 @@ jobs:
run: echo JAVA_${{ matrix.java }}_HOME=${{ env.JAVA_HOME }} >> $GITHUB_ENV
- name: Set up JDK 11 for running Gradle
if: matrix.java != 11
if: matrix.java == 8
uses: actions/setup-java@v1
with:
java-version: 11
- name: Test
- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
with:
job-id: jdk${{ matrix.java }}
- name: Test
uses: nick-invision/retry@v1
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
with:
job-id: jdk${{ matrix.java }}
arguments: testJava${{ matrix.java }} --stacktrace -Dorg.gradle.caching.debug=true
command: ./gradlew testJava${{ matrix.java }} --stacktrace
timeout_minutes: 90
max_attempts: 3
- name: Aggregate test reports with ciMate
if: always()
@ -57,14 +99,20 @@ jobs:
with:
java-version: 11
- name: Test
- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
with:
job-id: latestDepTest
arguments: test -PtestLatestDeps=true --stacktrace
- name: Test
uses: nick-invision/retry@v1
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
with:
command: ./gradlew test -PtestLatestDeps=true --stacktrace
timeout_minutes: 60
max_attempts: 3
- name: Aggregate test reports with ciMate
if: always()
@ -77,9 +125,32 @@ jobs:
chmod +x cimate
./cimate -v "**/TEST-*.xml"
snapshot:
runs-on: ubuntu-latest
needs: [ build, test, testLatestDep ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11 for running checks
uses: actions/setup-java@v1
with:
java-version: 11
- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
with:
job-id: jdk11
- name: Publish snapshot
env:
S3_BUILD_CACHE_ACCESS_KEY_ID: ${{ secrets.S3_BUILD_CACHE_ACCESS_KEY_ID }}
S3_BUILD_CACHE_SECRET_KEY: ${{ secrets.S3_BUILD_CACHE_SECRET_KEY }}
run: ./gradlew snapshot --stacktrace
issue:
name: Open issue on failure
needs: [test, testLatestDep]
needs: [ build, test, testLatestDep, snapshot ]
runs-on: ubuntu-latest
if: always()
steps:

View File

@ -13,11 +13,17 @@ jobs:
with:
java-version: 11
- name: Build
- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
with:
job-id: jdk11
arguments: build --stacktrace -x :smoke-tests:test
- name: Build
uses: nick-invision/retry@v1
with:
command: ./gradlew check --stacktrace -x :smoke-tests:test
timeout_minutes: 90
max_attempts: 3
- name: Aggregate test reports with ciMate
if: always()
@ -50,11 +56,17 @@ jobs:
with:
java-version: 11
- name: Test
- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
with:
job-id: jdk${{ matrix.java }}
arguments: testJava${{ matrix.java }} --stacktrace -x :smoke-tests:test
- name: Test
uses: nick-invision/retry@v1
with:
command: ./gradlew testJava${{ matrix.java }} --stacktrace -x :smoke-tests:test
timeout_minutes: 90
max_attempts: 3
- name: Aggregate test reports with ciMate
if: always()
@ -77,11 +89,17 @@ jobs:
with:
java-version: 11
- name: Test
- name: Restore cache
uses: burrunan/gradle-cache-action@v1.5
with:
job-id: jdk11
arguments: :smoke-tests:test
job-id: smokeTests
- name: Test
uses: nick-invision/retry@v1
with:
command: ./gradlew :smoke-tests:test
timeout_minutes: 90
max_attempts: 3
- name: Aggregate test reports with ciMate
if: always()

View File

@ -1,13 +1,13 @@
apply from: "$rootDir/gradle/instrumentation.gradle"
apply from: "$rootDir/gradle/test-with-scala.gradle"
apply plugin: 'org.unbroken-dome.test-sets'
ext {
// TODO remove once Scala/akka supports Java 15
// https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html
maxJavaVersionForTests = JavaVersion.VERSION_14
}
apply from: "$rootDir/gradle/instrumentation.gradle"
apply from: "$rootDir/gradle/test-with-scala.gradle"
apply plugin: 'org.unbroken-dome.test-sets'
testSets {
version101Test {
dirName = 'test'

View File

@ -24,8 +24,9 @@ def awsAccessKeyId = System.getenv("S3_BUILD_CACHE_ACCESS_KEY_ID")
buildCache {
remote(com.github.burrunan.s3cache.AwsS3BuildCache) {
region = 'us-west-2'
bucket = 'opentelemetry-java-instrumentation-gradle-test1'
bucket = 'opentelemetry-java-instrumentation-gradle-cache'
push = isCI && awsAccessKeyId != null && !awsAccessKeyId.isEmpty()
lookupDefaultAwsCredentials = true
}
}