-
Notifications
You must be signed in to change notification settings - Fork 40
80 lines (76 loc) · 2.74 KB
/
gradle.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
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: The common Java CI with Gradle
on:
workflow_call:
inputs:
branch:
description: 'The branch to run the job on'
default: main
required: false
type: string
badge_branch:
description: 'The branch which contains the jacoco badge for above branch'
default: badge_main
required: false
type: string
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['21']
name: Java ${{ matrix.Java }} build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout badges branch to a badges directory nested inside first checkout
uses: actions/checkout@v2
with:
ref: ${{ inputs.badge_branch }}
path: badges
- name: Setup java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean installDist check test --info
- name: Run Test Coverage
run: ./gradlew jacocoTestReport
- name: Generate JaCoCo Badge
id: jacoco
uses: cicirello/[email protected]
with:
badges-directory: badges
jacoco-csv-file: build/reports/jacoco/test/jacocoTestReport.csv
- name: Log coverage percentage
run: |
echo "coverage = ${{ steps.jacoco.outputs.coverage }}"
echo "branch coverage = ${{ steps.jacoco.outputs.branches }}"
- name: Commit and push badge
if: ${{ github.event_name != 'pull_request' }}
run: |
cd badges
if [[ `git status --porcelain *.svg` ]]; then
git config --global user.name github_actions
git add *.svg
git commit -m "Autogenerated JaCoCo coverage badge" *.svg
git push
fi
cd ..
- name: Upload JaCoCo coverage report
uses: actions/upload-artifact@v4
with:
name: jacoco-report
path: build/reports/jacoco/
- name: Yelp Reviews Perf test
run: ./gradlew clean installDist :test -PincludePerfTests=* --tests "com.yelp.nrtsearch.yelp_reviews.YelpReviewsTest.runYelpReviews" --info
- name: Merge behavior tests
run: ./gradlew clean installDist :test -PincludePerfTests=* --tests "com.yelp.nrtsearch.server.grpc.MergeBehaviorTests" --info
- name: Long running tests
run: ./gradlew clean installDist :test -PlongRunningTestsOnly=* --info
- name: Run Tests For Example Plugin
run: example-plugin/gradlew -p example-plugin clean test