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

Use gradle/gradle-build-action #6121

Merged
merged 2 commits into from Nov 4, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 6 additions & 12 deletions .github/workflows/ci-examples.yml
Expand Up @@ -24,12 +24,8 @@ jobs:
with:
java-version: '8.0.302'
distribution: temurin
- name: Cache Gradle Home files
uses: actions/cache@v3.0.11
continue-on-error: true
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-home-testmatrix-examples-${{ hashFiles('**/*.gradle') }}
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
- id: set-matrix
working-directory: ./examples/
env:
Expand All @@ -52,14 +48,12 @@ jobs:
with:
java-version: '8.0.302'
distribution: temurin
- name: Cache Gradle Home files
uses: actions/cache@v3.0.11
continue-on-error: true
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-home-examples-${{matrix.gradle_args}}_check-${{ hashFiles('**/*.gradle') }}
- name: Clear existing docker image cache
run: docker image prune -af
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-cleanup: true
Copy link
Member

Choose a reason for hiding this comment

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

I had to look up the effect of it because I think the name is confusing but it looks like a good idea. I wonder why it is not a default?

https://github.com/gradle/gradle-build-action#removing-unused-files-from-gradle-user-home-before-saving-to-cache

Copy link
Member Author

Choose a reason for hiding this comment

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

it is experimental but what can go wrong? 🤷🏽‍♂️

- name: Build and test Examples with Gradle (${{matrix.gradle_args}})
working-directory: ./examples/
run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/ci-rootless.yml
Expand Up @@ -33,5 +33,7 @@ jobs:
PATH=$HOME/bin:$PATH dockerd-rootless.sh --experimental --storage-driver vfs &
sleep 1
DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock docker info || ls -la $XDG_RUNTIME_DIR
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
- name: Build with Gradle
run: ./gradlew --no-daemon --scan testcontainers:test --tests '*GenericContainerRuleTest'
21 changes: 10 additions & 11 deletions .github/workflows/ci.yml
Expand Up @@ -24,11 +24,8 @@ jobs:
with:
java-version: '8.0.302'
distribution: temurin
- name: Cache Gradle Home files
uses: actions/cache@v3.0.11
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-home-testmatrix-${{ hashFiles('**/*.gradle') }}
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
- id: set-matrix
env:
# Since we override the tests executor,
Expand All @@ -50,14 +47,16 @@ jobs:
with:
java-version: '8.0.302'
distribution: temurin
- name: Cache Gradle Home files
uses: actions/cache@v3.0.11
continue-on-error: true
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-home-${{matrix.gradle_args}}_check-${{ hashFiles('**/*.gradle') }}
- name: Clear existing docker image cache
run: docker image prune -af
- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2
with:
gradle-home-cache-includes: |
caches
notifications
jdks
gradle-home-cache-cleanup: true
- name: Build and test with Gradle (${{matrix.gradle_args}})
run: |
./gradlew --no-daemon --continue --scan ${{matrix.gradle_args}}
3 changes: 3 additions & 0 deletions .github/workflows/release.yml
Expand Up @@ -23,6 +23,9 @@ jobs:
- name: Clear existing docker image cache
run: docker image prune -af

- name: Setup Gradle Build Action
uses: gradle/gradle-build-action@v2

- name: Run Gradle Build
run: ./gradlew build --scan --no-daemon -i -x test

Comment on lines +26 to 31
Copy link
Member

Choose a reason for hiding this comment

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

We can also switch to using the gradle-build-action for execution, but it probably changes nothing.

https://github.com/gradle/gradle-build-action#gradle-execution

Copy link
Member Author

Choose a reason for hiding this comment

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

that's useful when testing with different gradle versions. In our case would not help that much given we use gradle wrapper

Expand Down