forked from ballerina-platform/ballerina-library
-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (90 loc) · 3.06 KB
/
s4hana-daily-build-connector-template.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
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
name: Daily Build (S/4 HANA Connector)
on:
workflow_call:
inputs:
hana-connector-group:
required: true
type: string
jobs:
build-examples:
name: Build Examples
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: latest
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17.0.7
- name: Build the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew :${{ inputs.hana-connector-group }}-examples:build :${{ inputs.hana-connector-group }}-sanitation:build -x :${{ inputs.hana-connector-group }}-ballerina:build
generate-matrix:
name: Generate Matrix
runs-on: ubuntu-latest
outputs:
directories: ${{ steps.set-matrix.outputs.directories }}
steps:
- name: Checkout the Repository
uses: actions/checkout@v3
- name: Set matrix for build
id: set-matrix
run: |
folders=()
cd ballerina
for dir in $(find . -type d -maxdepth 1 -mindepth 1 | cut -c3-); do
if [[ "$dir" == resources ]]; then
continue
fi
folders+=("$dir");
done
echo "directories=$(jq -nc --args '$ARGS.positional' ${folders[@]})" >> $GITHUB_OUTPUT
build-connectors:
name: Build Connectors
runs-on: ubuntu-latest
needs: generate-matrix
strategy:
matrix:
directory: ${{ fromJSON(needs.generate-matrix.outputs.directories) }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17.0.7
- name: Build the Package
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: |
./gradlew :${{ inputs.hana-connector-group }}-ballerina:${{ matrix.directory }}:build -x test -PbuildUsingDocker=nightly
./gradlew :${{ inputs.hana-connector-group }}-ballerina:${{ matrix.directory }}:test -PbuildUsingDocker=nightly
send-notification:
name: Send Failure Notification
runs-on: ubuntu-latest
needs: [ build-examples, build-connectors ]
if: ${{ failure() }}
steps:
# Send notification when build fails
- name: Notify failure
run: |
curl -X POST \
'https://api.github.com/repos/ballerina-platform/ballerina-release/dispatches' \
-H 'Accept: application/vnd.github.v3+json' \
-H 'Authorization: Bearer ${{ secrets.BALLERINA_BOT_TOKEN }}' \
--data "{
\"event_type\": \"notify-build-failure\",
\"client_payload\": {
\"repoName\": \"module-ballerinax-sap.s4hana.${{ inputs.hana-connector-group }}\"
}
}"