-
Notifications
You must be signed in to change notification settings - Fork 134
125 lines (120 loc) · 3.57 KB
/
gradle-build.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Gradle Build and Compare Package
on:
push:
branches: [main, support/5.x.x]
pull_request:
branches: [main, support/5.x.x]
workflow_dispatch:
jobs:
build-java-latest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: Detect secrets
run: |
pip install detect-secrets
git ls-files -z | xargs -0 detect-secrets-hook --baseline .secrets.baseline
- name: Grant Execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- name: Upload Unit Test Results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: UnitTests
path: |
build/reports/tests/test/**
build/test-results/**
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: drop
path: |
**/libs/*
build/generated-pom.xml
build/generated-pom.xml.asc
build.gradle
gradlew
gradlew.bat
settings.gradle
gradle.properties
**/gradle/**
scripts/**
build-java-8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 8
distribution: 'temurin'
cache: gradle
- name: Grant Execute permission for gradlew
run: chmod +x gradlew
- name: Build with Java 8
working-directory: ./java-8
run: .././gradlew build
build:
needs: [build-java-latest, build-java-8]
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Determine build status
run: |
if [ "${{ needs.build-java-latest.result }}" == "success" ] && [ "${{ needs.build-java-8.result }}" == "success" ]; then
exit 0
else
exit 1
fi
compare-packages:
needs: build
runs-on: ubuntu-latest
env:
CURRENT_PKG_DIFF: ./artifacts/current/build/libs/msgraph-sdk-java.jar
PRIOR_PKG_DIFF: ./artifacts/previous/build/libs/msgraph-sdk-java.jar
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
cache: gradle
- name: Download Current Build
uses: actions/download-artifact@v4
with:
name: drop
path: artifacts/current/
- name: Get latest release tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "BRANCH=$(gh release list -L 1 --json tagName --jq '.[0] | .tagName')" >> $GITHUB_ENV
- name: Download Last Successful Build
uses: dawidd6/action-download-artifact@v6
with:
workflow: preview-and-release.yml
workflow_conclusion: success
branch: ${{ env.BRANCH }}
event: push
name: drop
path: artifacts/previous/
- name: Run PKG Diff
continue-on-error: true
run: |
sudo apt install pkgdiff
pkgdiff -hide-unchanged ${{ env.PRIOR_PKG_DIFF }} ${{ env.CURRENT_PKG_DIFF }}
- name: Upload Diff Artifact
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: diff
path: |
./pkgdiff_reports/**