Skip to content

Commit 94cfaf2

Browse files
committed
feat: use gradle-build-action
1 parent b7bd04f commit 94cfaf2

File tree

1 file changed

+25
-18
lines changed

1 file changed

+25
-18
lines changed

action.yml

+25-18
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ description: |
66
This actions will also annotate the PR or commit with the failed tests.
77
88
inputs:
9-
execution-only-caches:
10-
description: |
11-
Activates only the caches that are relevant for executing gradle command.
12-
This is helpful when build job executes multiple gradle commands sequentially.
13-
Then the caching is implemented in the very first one, and the subsequent should be marked
14-
with execution-only-caches: true
15-
required: false
16-
default: 'false'
179
gradle-properties:
1810
description: Content of a gradle.properties file that will be passed to the gradle runner.
1911
required: false
@@ -23,12 +15,10 @@ inputs:
2315
Defaults to the root project.
2416
required: true
2517
default: "."
26-
gradle-dependencies-cache-key:
27-
description: Extra files to take into account for ~/.gradle/caches dependencies
18+
read-only-cache:
19+
description: If set to true, the action will only read from the cache and will not write to it.
2820
required: true
29-
default: |
30-
buildSrc/**/Dependencies.kt
31-
gradle/libs.versions.toml
21+
default: "true"
3222
report-retention-days:
3323
description: Duration in days to preserve reports.
3424
required: true
@@ -66,15 +56,32 @@ runs:
6656
fi
6757
echo "artifact-path=$ARTIFACT_PATH" >> $GITHUB_OUTPUT
6858
59+
- name: Process gradle properties
60+
id: gradle-properties
61+
shell: python
62+
env:
63+
GRADLE_PROPERTIES: ${{ inputs.gradle-properties }}
64+
run: |
65+
import os
66+
67+
properties_list: list[str] = [line for line in (line.strip() for line in os.environ.get('GRADLE_PROPERTIES').splitlines()) if line]
68+
properties = list(map(lambda x: f'-P{x}' if not x.startswith('-P') else x, properties_list))
69+
70+
with open(os.environ.get('GITHUB_OUTPUT'), 'a') as output_file:
71+
output_file.write('gradle-properties=')
72+
output_file.write(' '.join(properties))
73+
output_file.write('\n')
74+
6975
- name: Run tests
70-
uses: burrunan/gradle-cache-action@v1
76+
uses: gradle/gradle-build-action@v2
7177
with:
7278
gradle-version: wrapper
7379
build-root-directory: ${{ inputs.working-directory }}
74-
gradle-dependencies-cache-key: ${{ inputs.gradle-dependencies-cache-key }}
75-
arguments: -p ${{ inputs.gradle-project-path }} ci-${{ inputs.task-name }}
76-
properties: ${{ inputs.gradle-properties }}
77-
execution-only-caches: ${{ inputs.execution-only-caches }}
80+
cache-read-only: ${{ inputs.read-only-cache }}
81+
arguments: |
82+
-p ${{ inputs.gradle-project-path }}
83+
ci-${{ inputs.task-name }}
84+
${{ steps.gradle-properties.outputs.gradle-properties }}
7885
7986
- name: Upload report
8087
uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)