-
Notifications
You must be signed in to change notification settings - Fork 3
240 lines (212 loc) · 6.37 KB
/
ci.yml
File metadata and controls
240 lines (212 loc) · 6.37 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
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
name: CI
on:
pull_request:
types:
- "opened"
- "reopened"
- "synchronize"
workflow_dispatch:
jobs:
test:
name: Test
permissions:
contents: read
strategy:
fail-fast: false
matrix:
java-version:
- 17
- 21
- 25
scala-version:
- '2.12.x'
- '2.13.x'
- '3.x'
os:
- ubuntu-latest
- windows-latest
runs-on: ${{ matrix.os }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Java/SBT
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
uses: actions/cache@v5
with:
path: |
~/.sbt/
~/.cache/
key: setup-java-${{ matrix.java-version }}-${{ runner.os }}-${{ runner.arch }}-sbt-${{ matrix.scala-version }}-${{ hashFiles('build.sbt') }}
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
check-latest: true
- name: Set up sbt
uses: sbt/setup-sbt@v1
- name: Test
env:
SCALA_VERSION: ${{ matrix.scala-version }}
shell: bash
run: sbt ++"$SCALA_VERSION" test
build:
name: Build
timeout-minutes: 2
needs:
- test
runs-on: ubuntu-latest
steps:
- name: CI Passed
run: echo CI Passed | tee -a "$GITHUB_STEP_SUMMARY"
coverage:
name: Code Coverage
timeout-minutes: 10
needs:
- test
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
java-version:
- 25
scala-version:
- '3.x'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Java/SBT
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
uses: actions/cache@v5
with:
path: |
~/.sbt/
~/.cache/
key: setup-java-${{ matrix.java-version }}-${{ runner.os }}-${{ runner.arch }}-sbt-${{ matrix.scala-version }}-${{ hashFiles('build.sbt') }}
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
check-latest: true
- name: Set up sbt
uses: sbt/setup-sbt@v1
- name: Generate Code Coverage Reports
shell: bash
run: sbt "clean; coverage; test; coverageReport"
- name: Extract and display coverage report summary
shell: bash
run: |
perl -ne 'if(!$overview) { if(/<div class="overview">/){$overview = 1};next};s/^\s+//;print;last if m{</table>}' target/scala-*/scoverage-report/overview.html >> "$GITHUB_STEP_SUMMARY"
- name: Zip coverage report
shell: bash
run: |
find target/scala-*/*coverage-report -type f | zip /tmp/scoverage.zip -@
- name: Upload coverage report
uses: actions/upload-artifact@v7
with:
name: scoverage
path: /tmp/scoverage.zip
artifact:
name: Upload JAR
timeout-minutes: 5
needs:
- test
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
java-version:
- 25
scala-version:
- '2.12.x'
- '2.13.x'
- '3.x'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Java/SBT
if: github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name
uses: actions/cache@v5
with:
path: |
~/.sbt/
~/.cache/
key: setup-java-${{ matrix.java-version }}-${{ runner.os }}-${{ runner.arch }}-sbt-${{ matrix.scala-version }}-${{ hashFiles('build.sbt') }}
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
check-latest: true
- name: Set up sbt
uses: sbt/setup-sbt@v1
- name: Package JAR
env:
SCALA_VERSION: "${{ matrix.scala-version }}"
run: sbt ++"$SCALA_VERSION" package
- name: Find JAR
id: find-jar-path
env:
SCALA_VERSION: ${{ matrix.scala-version }}
shell: bash
run: |
: Find JAR
jar_path=$(find target/scala-${SCALA_VERSION%.x}* -name "*.jar")
echo "jar_path=$jar_path" >> $GITHUB_OUTPUT
- name: Upload JAR artifact
uses: actions/upload-artifact@v7
env:
JAR_PATH: ${{ steps.find-jar-path.outputs.jar_path }}
SCALA_VERSION: ${{ matrix.scala-version }}
ARTIFACT_NAME: "test-charged-${{ matrix.scala-version }}"
with:
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.JAR_PATH }}
maven-central:
name: Maven Central
timeout-minutes: 35
needs:
- test
permissions:
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
java-version:
- 25
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- uses: garnercorp/build-actions/needs@main
with:
needs-json: ${{ toJSON(needs) }}
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java-version }}
uses: actions/setup-java@v5
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
# Do not use a cache for publishing, it is dangerous.
check-latest: true
- name: Set up sbt
uses: sbt/setup-sbt@v1
- name: Release
shell: bash
env:
SONATYPE_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
PGP_SECRET: ${{ secrets.GPG_SIGNING_KEY }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
run: |
: Release
(
umask 0077
mkdir -p ~/.gnupg/private-keys-v1.d
)
export GPG_TTY=$(tty)
echo "$PGP_SECRET" | base64 -d | gpg --batch --allow-secret-key-import --import
sbt "+publishSigned; sonatypeBundleRelease"