-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (62 loc) · 1.89 KB
/
common.workflow.libs.backend.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
on:
workflow_call:
inputs:
sonar-enabled:
type: boolean
description: "Whether to run SonarQube analysis or not."
required: false
default: true
working-directory:
type: string
description: "The working directory for the job, e.g. libs/commands (without leading/trailing slash)."
required: true
secrets:
NAV_TOKEN:
required: true
SONAR_TOKEN:
required: true
jobs:
start:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: "Logging"
run: |
echo "branch: ${{ github.ref }}"
echo "inputs: ${{ toJSON(inputs) }}"
echo "env: ${{ toJSON(env) }}"
echo "commit: ${{ github.event.head.commit_message }}"
outputs:
artifact: ${{ github.run_id }}-failure
build:
needs: start
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: "Setup"
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: "Gradle"
id: gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false
- name: "Build"
working-directory: ${{ inputs.working-directory }}
run: ./gradlew build ${{ inputs.sonar-enabled && 'jacocoTestReport sonar -Dsonar.gradle.skipCompile=true' || '' }} --scan
env:
NAV_TOKEN: ${{ secrets.NAV_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: "Reporting"
if: failure() && steps.gradle.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.start.outputs.artifact}}
path: ${{ inputs.working-directory }}/build/reports
retention-days: 7