1+ name : Build and Test User Behavior Insights
2+ on :
3+ push :
4+ branches :
5+ - " *"
6+ pull_request :
7+ branches :
8+ - " *"
9+ jobs :
10+ Get-CI-Image-Tag :
11+ uses : opensearch-project/opensearch-build/.github/workflows/get-ci-image-tag.yml@main
12+ with :
13+ product : opensearch
14+
15+ Check-ubi-linux :
16+ needs : Get-CI-Image-Tag
17+ strategy :
18+ matrix :
19+ java : [21, 24]
20+ os : [ubuntu-latest]
21+
22+ name : Gradle Check Linux
23+ runs-on : ${{ matrix.os }}
24+ container :
25+ # using the same image which is used by opensearch-build team to build the OpenSearch Distribution
26+ # this image tag is subject to change as more dependencies and updates will arrive over time
27+ image : ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
28+ # need to switch to root so that github actions can install runner binary on container without permission issues.
29+ options : ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
30+
31+ steps :
32+ - name : Run start commands
33+ run : ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
34+
35+ - uses : actions/checkout@v4
36+
37+ - name : Setup Java ${{ matrix.java }}
38+ uses : actions/setup-java@v4
39+ with :
40+ distribution : ' temurin'
41+ java-version : ${{ matrix.java }}
42+
43+ - name : Run build
44+ run : |
45+ chown -R 1000:1000 `pwd`
46+ su `id -un 1000` -c "./gradlew check"
47+
48+ - name : Upload Coverage Report
49+ if : ${{ !cancelled() }}
50+ uses : codecov/codecov-action@v5
51+ with :
52+ token : ${{ secrets.CODECOV_TOKEN }}
53+
54+ Check-ubi-windows :
55+ strategy :
56+ matrix :
57+ java : [21, 24]
58+ os : [windows-latest]
59+
60+ name : Gradle Check Windows
61+ runs-on : ${{ matrix.os }}
62+
63+ steps :
64+ - uses : actions/checkout@v4
65+
66+ - name : Setup Java ${{ matrix.java }}
67+ uses : actions/setup-java@v4
68+ with :
69+ distribution : ' temurin'
70+ java-version : ${{ matrix.java }}
71+
72+ - name : Run build
73+ run : |
74+ ./gradlew check
75+
76+ Precommit-ubi-linux :
77+ needs : Get-CI-Image-Tag
78+ strategy :
79+ matrix :
80+ java : [21, 24]
81+ os : [ubuntu-latest]
82+
83+ name : Pre-commit Linux
84+ runs-on : ${{ matrix.os }}
85+ container :
86+ # using the same image which is used by opensearch-build team to build the OpenSearch Distribution
87+ # this image tag is subject to change as more dependencies and updates will arrive over time
88+ image : ${{ needs.Get-CI-Image-Tag.outputs.ci-image-version-linux }}
89+ # need to switch to root so that github actions can install runner binary on container without permission issues.
90+ options : ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-options }}
91+
92+ steps :
93+ - name : Run start commands
94+ run : ${{ needs.Get-CI-Image-Tag.outputs.ci-image-start-command }}
95+
96+ - uses : actions/checkout@v4
97+
98+ - name : Setup Java ${{ matrix.java }}
99+ uses : actions/setup-java@v4
100+ with :
101+ distribution : ' temurin'
102+ java-version : ${{ matrix.java }}
103+
104+ - name : Run build
105+ run : |
106+ chown -R 1000:1000 `pwd`
107+ su `id -un 1000` -c "./gradlew precommit --parallel && ./gradlew jacocoTestReport && cp -v build/reports/jacoco/test/jacocoTestReport.xml ./jacocoTestReport.xml"
108+
109+ - uses : actions/upload-artifact@v4
110+ if : ${{ matrix.os }} == "ubuntu-latest"
111+ with :
112+ name : coverage-report-${{ matrix.os }}-${{ matrix.java }}
113+ path : ./jacocoTestReport.xml
114+
115+ Precommit-codecov :
116+ needs : Precommit-ubi-linux
117+ strategy :
118+ matrix :
119+ java : [21, 24]
120+ os : [ubuntu-latest]
121+ runs-on : ${{ matrix.os }}
122+ steps :
123+ - uses : actions/download-artifact@v4
124+ with :
125+ name : coverage-report-${{ matrix.os }}-${{ matrix.java }}
126+ path : ./
127+ - name : Upload Coverage Report
128+ uses : codecov/codecov-action@v5
129+ with :
130+ token : ${{ secrets.CODECOV_TOKEN }}
0 commit comments