Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better local caching via burrunan/gradle-cache-action #1054

Merged
merged 5 commits into from
Aug 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,14 @@ jobs:
with:
java-version: 11

- name: Cache gradle dependencies
- name: Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While we're here how about Test on ${{matrix.java}}?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have in job name. Isn't it enough?

uses: burrunan/gradle-cache-action@v1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like gradle-caching-runner or the like will be a good name. Not surprising to see the best caching comes with having full visibility to Gradle.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming is hard :)
Thanks for the suggestion.

I see JUnit team uses the following, and it can't be folded to a single command, so I'm exploring ways to allow multiple (Gradle? Shell?) commands to be executed (to avoid copy-paste the boring uses:...)

run: |
  ./gradlew --version
  ./gradlew build

with:
job-id: jdk${{ matrix.java }}

- name: Test with Gradle
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 testJava${{ matrix.java }} --stacktrace
timeout_minutes: 60
max_attempts: 3
job-id: jdk${{ matrix.java }}
arguments: testJava${{ matrix.java }} --stacktrace -Dorg.gradle.caching.debug=true

- name: Aggregate test reports with ciMate
if: always()
Expand All @@ -63,20 +57,14 @@ jobs:
with:
java-version: 11

- name: Cache gradle dependencies
- name: Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly how about Test latest deps?

uses: burrunan/gradle-cache-action@v1
with:
job-id: latestDepTest

- name: Test with Gradle
uses: nick-invision/retry@v1
arguments: test -PtestLatestDeps=true --stacktrace
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()
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,11 @@ jobs:
with:
java-version: 11

- name: Cache gradle dependencies
- name: Test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

uses: burrunan/gradle-cache-action@v1
with:
job-id: jdk${{ matrix.java }}

- name: Test with Gradle
uses: nick-invision/retry@v1
with:
command: ./gradlew testJava${{ matrix.java }} --stacktrace
timeout_minutes: 60
max_attempts: 3
arguments: testJava${{ matrix.java }} --stacktrace

- name: Aggregate test reports with ciMate
if: always()
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ buildCache {
remote(com.github.burrunan.s3cache.AwsS3BuildCache) {
region = 'us-west-2'
bucket = 'opentelemetry-java-instrumentation-gradle-test1'
push = System.getenv('S3_BUILD_CACHE_ACCESS_KEY_ID') != null
push = isCI && !System.getenv('S3_BUILD_CACHE_ACCESS_KEY_ID')?.isBlank()
}
}

Expand Down