-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (121 loc) · 4.59 KB
/
on-pull-request.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: Build Project
on:
pull_request:
push:
branches:
- master
- main
- trunk
- develop
- maine
- mane
schedule:
- cron: '0 3 * * 1,4'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 20
- uses: gradle/wrapper-validation-action@v1
- uses: gradle/gradle-build-action@v2
with:
dependency-graph: generate-and-submit
- run: ./gradlew projectCodestyle --scan
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-codestyle
- run: ./gradlew assemble --scan
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-assemble
- run: ./gradlew check --scan
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-check
- run: ./gradlew projectCoverage --scan
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-coverage
- run: ./gradlew publishToMavenLocal
env:
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-publish
- run: git diff --exit-code
- uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
- uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: test-results
path: "${{ github.workspace }}/**/build/reports/tests"
- uses: actions/upload-artifact@v3
with:
name: jacoco-report
path: "${{ github.workspace }}/**/build/reports/jacoco"
- name: Unwrap GPG key
env:
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
run: sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
- run: ./gradlew publishToMavenLocal
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
- run: git diff --exit-code
- uses: actions/cache@v3
name: Upload base
if: github.event_name != 'pull_request'
with:
path: diffuse-source-file
key: diffuse-${{ github.sha }}
- run: find . -regex ".*issuechecker/build/libs/issuechecker-[0-9SNAPSHOT\.-]*\.jar" -print | xargs -n 1 -I % cp % diffuse-source-file
if: github.event_name != 'pull_request'
shell: bash
- uses: actions/cache@v3
name: Download base
if: github.event_name == 'pull_request'
with:
path: diffuse-source-file
key: diffuse-${{ github.event.pull_request.base.sha }}
- run: find . -regex ".*issuechecker/build/libs/issuechecker-[0-9SNAPSHOT\.-]*\.jar" -print | xargs -n 1 -I % cp % pull-request-artifact.jar
if: github.event_name == 'pull_request'
shell: bash
- id: diffuse
if: github.event_name == 'pull_request'
uses: usefulness/[email protected]
with:
old-file-path: diffuse-source-file
new-file-path: pull-request-artifact.jar
- uses: peter-evans/find-comment@v2
if: github.event_name == 'pull_request'
id: find_comment
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: Diffuse output
- uses: peter-evans/create-or-update-comment@v3
if: ${{ steps.diffuse.outputs.diff-raw != null || steps.find_comment.outputs.comment-id != null }}
with:
body: |
### Jar size:
Jar size change: ${{ steps.diffuse.outputs.size-diff-comment_style_1 }}
### Diffuse output:
${{ steps.diffuse.outputs.diff-gh-comment }}
edit-mode: replace
comment-id: ${{ steps.find_comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
if: github.event_name == 'pull_request'
with:
name: diffuse-output
path: ${{ steps.diffuse.outputs.diff-file }}