From 6b688b4d232c185ca61d394996198513437ddbab Mon Sep 17 00:00:00 2001 From: szymonrybczak Date: Wed, 1 Nov 2023 13:15:43 +0100 Subject: [PATCH] ci: properly cache gradle --- .github/workflows/test.yml | 5 +++++ __e2e__/root.test.ts | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0573578a7..1a4859f82 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,12 +49,17 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: 17 cache: 'gradle' + - uses: gradle/gradle-build-action@v2 + with: + gradle-version: 8.0.1 + - uses: ruby/setup-ruby@v1 if: runner.os == 'macOS' with: diff --git a/__e2e__/root.test.ts b/__e2e__/root.test.ts index a3253d8c9..e296c2d9e 100644 --- a/__e2e__/root.test.ts +++ b/__e2e__/root.test.ts @@ -40,7 +40,7 @@ afterAll(() => { cleanup(cwd); }); -test('works when Gradle is run outside of the project hierarchy', () => { +test('works when Gradle is run outside of the project hierarchy', async () => { /** * Location of Android project */ @@ -53,6 +53,15 @@ test('works when Gradle is run outside of the project hierarchy', () => { */ const gradleWrapper = path.join(androidProjectRoot, 'gradlew'); + // Make sure that we use `-bin` distribution of Gradle + await spawnScript( + gradleWrapper, + ['wrapper', '--gradle-version=8.0.1', '--distribution-type', 'bin'], + { + cwd: androidProjectRoot, + }, + ); + // Execute `gradle` with `-p` flag and `cwd` outside of project hierarchy const {stdout} = spawnScript(gradleWrapper, ['-p', androidProjectRoot], { cwd: '/',