-
Notifications
You must be signed in to change notification settings - Fork 65
106 lines (93 loc) · 3.16 KB
/
s4hana-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
101
102
103
104
105
106
name: 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: Get Ballerina Version
run: |
BAL_VERSION=$(grep -w 'ballerinaLangVersion' gradle.properties | cut -d= -f2 | rev | cut --complement -d- -f1 | rev)
if [ -z "$BAL_VERSION" ]; then
BAL_VERSION="latest"
fi
echo "BAL_VERSION=$BAL_VERSION" >> $GITHUB_ENV
echo "Ballerina Version: $BAL_VERSION"
- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@v1.1.0
with:
version: ${{ env.BAL_VERSION }}
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 21.0.3
- 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 21
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 21.0.3
- 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
- name: Upload coverage reports
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.directory }}
path: ballerina/**/coverage-report.xml
upload-codcov:
name: Upload Codecov
runs-on: ubuntu-latest
needs: build-connectors
steps:
- name: Download coverage reports
uses: actions/download-artifact@v4
- name: Generate Codecov Report
uses: codecov/codecov-action@v3