Skip to content

Commit

Permalink
Merge pull request #11 from equisoft-actions/dev/QCTECH-422
Browse files Browse the repository at this point in the history
feat: use gradle-build-action
  • Loading branch information
meriouma authored Nov 14, 2023
2 parents b7bd04f + 94cfaf2 commit 2275ce0
Showing 1 changed file with 25 additions and 18 deletions.
43 changes: 25 additions & 18 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ description: |
This actions will also annotate the PR or commit with the failed tests.
inputs:
execution-only-caches:
description: |
Activates only the caches that are relevant for executing gradle command.
This is helpful when build job executes multiple gradle commands sequentially.
Then the caching is implemented in the very first one, and the subsequent should be marked
with execution-only-caches: true
required: false
default: 'false'
gradle-properties:
description: Content of a gradle.properties file that will be passed to the gradle runner.
required: false
Expand All @@ -23,12 +15,10 @@ inputs:
Defaults to the root project.
required: true
default: "."
gradle-dependencies-cache-key:
description: Extra files to take into account for ~/.gradle/caches dependencies
read-only-cache:
description: If set to true, the action will only read from the cache and will not write to it.
required: true
default: |
buildSrc/**/Dependencies.kt
gradle/libs.versions.toml
default: "true"
report-retention-days:
description: Duration in days to preserve reports.
required: true
Expand Down Expand Up @@ -66,15 +56,32 @@ runs:
fi
echo "artifact-path=$ARTIFACT_PATH" >> $GITHUB_OUTPUT
- name: Process gradle properties
id: gradle-properties
shell: python
env:
GRADLE_PROPERTIES: ${{ inputs.gradle-properties }}
run: |
import os
properties_list: list[str] = [line for line in (line.strip() for line in os.environ.get('GRADLE_PROPERTIES').splitlines()) if line]
properties = list(map(lambda x: f'-P{x}' if not x.startswith('-P') else x, properties_list))
with open(os.environ.get('GITHUB_OUTPUT'), 'a') as output_file:
output_file.write('gradle-properties=')
output_file.write(' '.join(properties))
output_file.write('\n')
- name: Run tests
uses: burrunan/gradle-cache-action@v1
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
build-root-directory: ${{ inputs.working-directory }}
gradle-dependencies-cache-key: ${{ inputs.gradle-dependencies-cache-key }}
arguments: -p ${{ inputs.gradle-project-path }} ci-${{ inputs.task-name }}
properties: ${{ inputs.gradle-properties }}
execution-only-caches: ${{ inputs.execution-only-caches }}
cache-read-only: ${{ inputs.read-only-cache }}
arguments: |
-p ${{ inputs.gradle-project-path }}
ci-${{ inputs.task-name }}
${{ steps.gradle-properties.outputs.gradle-properties }}
- name: Upload report
uses: actions/upload-artifact@v3
Expand Down

0 comments on commit 2275ce0

Please sign in to comment.