-
Notifications
You must be signed in to change notification settings - Fork 6
69 lines (58 loc) · 1.84 KB
/
Copy pathbuild.yml
File metadata and controls
69 lines (58 loc) · 1.84 KB
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
name: Sift CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ '8', '11', '17', '21' ]
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up JDKs
uses: actions/setup-java@v5
with:
java-version: |
${{ matrix.java }}
17
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and Run Tests
env:
MATRIX_JAVA_VERSION: ${{ matrix.java }}
run: ./gradlew build jacocoTestReport
- name: Upload SBOM artifacts
if: ${{ matrix.java == '17' }}
uses: actions/upload-artifact@v7
with:
name: sbom-reports
path: |
*/build/reports/cyclonedx-direct/bom.*
- name: Generate Jacoco Badge
if: ${{ matrix.java == '17' }}
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: sift-core/build/reports/jacoco/test/jacocoTestReport.csv sift-annotations/build/reports/jacoco/test/jacocoTestReport.csv
badges-directory: .github/badges
generate-branches-badge: false
- name: Commit and Push Badge
if: ${{ github.event_name == 'push' && matrix.java == '17' }}
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git add .github/badges/
if [ -n "$(git status --porcelain)" ]; then
git commit -m "chore: update coverage badge [skip ci]"
git push
else
echo "Coverage unchanged. No badge update needed."
fi