Skip to content

fix: reworked sonar cloud stuff #1

fix: reworked sonar cloud stuff

fix: reworked sonar cloud stuff #1

Workflow file for this run

name: Build and test
on:
workflow_call:
inputs:
gradle-module:
required: false
type: string
description: "Name of the gradle module being tested"
sonar-cloud:
required: false
type: boolean
description: 'Does this project use sonar cloud?'
default: false
secrets:
GHL_USERNAME:
required: true
description: "Github Username (Gradle plugin)"
GHL_PASSWORD:
required: true
description: "Github Password (Gradle plugin)"
SLACK_APP_TOKEN:
required: false
description: "Slack app token (Optional, won't publish to slack if not present)"
GITHUB_TOKEN:

Check failure on line 24 in .github/workflows/pull-request.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/pull-request.yaml

Invalid workflow file

secret name `GITHUB_TOKEN` within `workflow_call` can not be used since it would collide with system reserved name
required: false
description: "Github token (Required for publishing test results for sonar cloud)"
SONAR_TOKEN:
required: false
description: "Sonar token (Optional, won't publish to sonar if not present)"
jobs:
pr_title_checker:
name: PR title checker
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: Slashgear/[email protected]
with:
regexp: '^(\[(develop|development|staging)\]\s)?(build|chore|ci|docs|feat|feature|fix|perf|refactor|revert|style|test|release|ignore)(\([\w\- ]+\))?: (.+)'
helpMessage: "Example: 'feat(app-api): Add new vehicle integration (SERVER-123)'"
test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: 'corretto'
java-version: '17'
cache: 'gradle'
- name: Test project
env:
GHL_USERNAME: ${{ secrets.GHL_USERNAME }}
GHL_PASSWORD: ${{ secrets.GHL_PASSWORD }}
GRADLE_MODULE: ${{ inputs.gradle-module }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
if [ ! -z "$SONAR_TOKEN" ]; then
EXTRA_ARGS='sonar --info'
else
EXTRA_ARGS=''
fi
if [ -z "$GRADLE_MODULE" ]; then
./gradlew --no-daemon test $EXTRA_ARGS
else
./gradlew --no-daemon $GRADLE_MODULE:test $EXTRA_ARGS
fi
shell: bash
- name: Upload test results
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test-result
path: |
**/reports/tests/test
/home/runner/.gradle/daemon/**/daemon-*.out.log
retention-days: 2
- name: add coverage to PR
id: jacoco
uses: madrapps/[email protected]
with:
paths: ${{ github.workspace }}/**/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 70
min-coverage-changed-files: 70
title: Code Coverage ${{ inputs.gradle-module }}
update-comment: true