-
Notifications
You must be signed in to change notification settings - Fork 3
103 lines (90 loc) · 3.18 KB
/
gradle.yaml
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#
# Copyright contributors to the Galasa project
#
# SPDX-License-Identifier: EPL-2.0
#
name: Gradle Main Build
on:
workflow_call:
inputs:
jacoco_enabled:
description: 'True if Jacoco code coverage should be enabled (set to "false" for release builds)'
required: false
default: 'true'
type: string
sign_artifacts:
description: 'True if the artifacts built should be signed (set to "false" for development branch builds)'
required: false
default: 'true'
type: string
env:
BRANCH: ${{ github.ref_name }}
jobs:
log-github-ref:
name: Log the GitHub ref this workflow is running on (Branch or tag that received dispatch)
runs-on: ubuntu-latest
steps:
- name: Log GitHub ref of workflow
run: |
echo "This workflow is running on GitHub ref ${{ env.BRANCH }}"
build-gradle:
name: Build 'gradle' source code
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'semeru'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: 8.9
cache-disabled: true
- name: Download platform from this workflow
id: download-platform
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: platform
path: modules/artifacts
- name: Build Gradle source code
working-directory: modules/gradle
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEYID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
run: |
set -o pipefail
gradle check publish --info \
--no-daemon --console plain \
-PsourceMaven=${{ github.workspace }}/modules/artifacts \
-PcentralMaven=https://repo.maven.apache.org/maven2/ \
-PtargetMaven=${{ github.workspace }}/modules/gradle/repo \
-PjacocoEnabled=${{ inputs.jacoco_enabled }} \
-PisMainOrRelease=${{ inputs.sign_artifacts }} 2>&1 | tee build.log
- name: Upload Gradle build log
if: failure()
uses: actions/upload-artifact@v4
with:
name: gradle-gradle-build-log
path: modules/gradle/build.log
- name: Upload gradle artifacts
uses: actions/upload-artifact@v4
with:
name: gradle
path: modules/gradle/repo
report-failure:
name: Report failure in workflow
runs-on: ubuntu-latest
needs: [log-github-ref, build-gradle]
if: failure()
steps:
- name: Report failure in workflow to Slack
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
run : |
docker run --rm ghcr.io/galasa-dev/galasabld-ibm:main slackpost workflows --repo "galasa" --module "gradle" --workflowName "${{ github.workflow }}" --workflowRunNum "${{ github.run_id }}" --ref "${{ env.BRANCH }}" --hook "${{ env.SLACK_WEBHOOK }}"