Skip to content

Commit 8ae65d4

Browse files
committed
CI workflow
1 parent 373d431 commit 8ae65d4

File tree

1 file changed

+150
-80
lines changed

1 file changed

+150
-80
lines changed

.github/workflows/ci.yml

Lines changed: 150 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -9,175 +9,245 @@ name: Continuous Integration
99

1010
on:
1111
pull_request:
12-
branches: ['**']
12+
branches: ['**', '!update/**', '!pr/**']
1313
push:
14-
branches: ['**']
14+
branches: ['**', '!update/**', '!pr/**']
1515
tags: [v*]
1616

1717
env:
1818
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19-
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
20-
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
21-
PGP_SECRET: ${{ secrets.PGP_SECRET }}
19+
20+
21+
concurrency:
22+
group: ${{ github.workflow }} @ ${{ github.ref }}
23+
cancel-in-progress: true
2224

2325
jobs:
2426
build:
25-
name: Build and Test
27+
name: Test
2628
strategy:
2729
matrix:
28-
os: [ubuntu-latest]
29-
scala: [2.13.8, 3.2.2, 2.12.14]
30-
java: [temurin@11]
30+
os: [ubuntu-22.04]
31+
scala: [2.13, 3, 2.12]
32+
java: [temurin@8]
3133
runs-on: ${{ matrix.os }}
34+
timeout-minutes: 60
3235
steps:
3336
- name: Checkout current branch (full)
34-
uses: actions/checkout@v2
37+
uses: actions/checkout@v4
3538
with:
3639
fetch-depth: 0
3740

38-
- name: Setup Java (temurin@11)
39-
if: matrix.java == 'temurin@11'
40-
uses: actions/setup-java@v2
41+
- name: Setup sbt
42+
uses: sbt/setup-sbt@v1
43+
44+
- name: Setup Java (temurin@8)
45+
id: setup-java-temurin-8
46+
if: matrix.java == 'temurin@8'
47+
uses: actions/setup-java@v4
4148
with:
4249
distribution: temurin
43-
java-version: 11
50+
java-version: 8
51+
cache: sbt
4452

45-
- name: Cache sbt
46-
uses: actions/cache@v2
47-
with:
48-
path: |
49-
~/.sbt
50-
~/.ivy2/cache
51-
~/.coursier/cache/v1
52-
~/.cache/coursier/v1
53-
~/AppData/Local/Coursier/Cache/v1
54-
~/Library/Caches/Coursier/v1
55-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
53+
- name: sbt update
54+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
55+
run: sbt +update
5656

5757
- name: Check that workflows are up to date
58-
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
58+
run: sbt githubWorkflowCheck
5959

60-
- run: sbt ++${{ matrix.scala }} ci
60+
- name: Check headers and formatting
61+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
62+
run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
63+
64+
- name: Test
65+
run: sbt '++ ${{ matrix.scala }}' test
66+
67+
- name: Check binary compatibility
68+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
69+
run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues
70+
71+
- name: Generate API documentation
72+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
73+
run: sbt '++ ${{ matrix.scala }}' doc
6174

6275
- if: matrix.scala == '2.13.8'
63-
run: sbt ++${{ matrix.scala }} docs/mdoc
76+
run: sbt '++ ${{ matrix.scala }}' docs/mdoc
77+
78+
- name: Make target directories
79+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
80+
run: mkdir -p modules/core/.native/target modules/core/.js/target modules/core/.jvm/target project/target
6481

6582
- name: Compress target directories
66-
run: tar cf targets.tar target modules/core/.native/target modules/core/.js/target modules/core/.jvm/target project/target
83+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
84+
run: tar cf targets.tar modules/core/.native/target modules/core/.js/target modules/core/.jvm/target project/target
6785

6886
- name: Upload target directories
69-
uses: actions/upload-artifact@v2
87+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
88+
uses: actions/upload-artifact@v4
7089
with:
71-
name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }}
90+
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
7291
path: targets.tar
7392

7493
publish:
7594
name: Publish Artifacts
7695
needs: [build]
77-
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
96+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
7897
strategy:
7998
matrix:
80-
os: [ubuntu-latest]
81-
scala: [2.13.8]
82-
java: [temurin@11]
99+
os: [ubuntu-22.04]
100+
java: [temurin@8]
83101
runs-on: ${{ matrix.os }}
84102
steps:
85103
- name: Checkout current branch (full)
86-
uses: actions/checkout@v2
104+
uses: actions/checkout@v4
87105
with:
88106
fetch-depth: 0
89107

90-
- name: Setup Java (temurin@11)
91-
if: matrix.java == 'temurin@11'
92-
uses: actions/setup-java@v2
108+
- name: Setup sbt
109+
uses: sbt/setup-sbt@v1
110+
111+
- name: Setup Java (temurin@8)
112+
id: setup-java-temurin-8
113+
if: matrix.java == 'temurin@8'
114+
uses: actions/setup-java@v4
93115
with:
94116
distribution: temurin
95-
java-version: 11
117+
java-version: 8
118+
cache: sbt
96119

97-
- name: Cache sbt
98-
uses: actions/cache@v2
99-
with:
100-
path: |
101-
~/.sbt
102-
~/.ivy2/cache
103-
~/.coursier/cache/v1
104-
~/.cache/coursier/v1
105-
~/AppData/Local/Coursier/Cache/v1
106-
~/Library/Caches/Coursier/v1
107-
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
108-
109-
- name: Download target directories (2.13.8)
110-
uses: actions/download-artifact@v2
120+
- name: sbt update
121+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
122+
run: sbt +update
123+
124+
- name: Download target directories (2.13)
125+
uses: actions/download-artifact@v4
111126
with:
112-
name: target-${{ matrix.os }}-2.13.8-${{ matrix.java }}
127+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13
113128

114-
- name: Inflate target directories (2.13.8)
129+
- name: Inflate target directories (2.13)
115130
run: |
116131
tar xf targets.tar
117132
rm targets.tar
118133
119-
- name: Download target directories (3.2.2)
120-
uses: actions/download-artifact@v2
134+
- name: Download target directories (3)
135+
uses: actions/download-artifact@v4
121136
with:
122-
name: target-${{ matrix.os }}-3.2.2-${{ matrix.java }}
137+
name: target-${{ matrix.os }}-${{ matrix.java }}-3
123138

124-
- name: Inflate target directories (3.2.2)
139+
- name: Inflate target directories (3)
125140
run: |
126141
tar xf targets.tar
127142
rm targets.tar
128143
129-
- name: Download target directories (2.12.14)
130-
uses: actions/download-artifact@v2
144+
- name: Download target directories (2.12)
145+
uses: actions/download-artifact@v4
131146
with:
132-
name: target-${{ matrix.os }}-2.12.14-${{ matrix.java }}
147+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12
133148

134-
- name: Inflate target directories (2.12.14)
149+
- name: Inflate target directories (2.12)
135150
run: |
136151
tar xf targets.tar
137152
rm targets.tar
138153
139154
- name: Import signing key
140-
run: echo $PGP_SECRET | base64 -d | gpg --import
155+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
156+
env:
157+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
158+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
159+
run: echo $PGP_SECRET | base64 -d -i - | gpg --import
160+
161+
- name: Import signing key and strip passphrase
162+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
163+
env:
164+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
165+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
166+
run: |
167+
echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg
168+
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
169+
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
170+
171+
- name: Publish
172+
env:
173+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
174+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
175+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
176+
run: sbt tlCiRelease
141177

142-
- run: sbt ++${{ matrix.scala }} release
178+
dependency-submission:
179+
name: Submit Dependencies
180+
if: github.event.repository.fork == false && github.event_name != 'pull_request'
181+
strategy:
182+
matrix:
183+
os: [ubuntu-22.04]
184+
java: [temurin@8]
185+
runs-on: ${{ matrix.os }}
186+
steps:
187+
- name: Checkout current branch (full)
188+
uses: actions/checkout@v4
189+
with:
190+
fetch-depth: 0
191+
192+
- name: Setup sbt
193+
uses: sbt/setup-sbt@v1
194+
195+
- name: Setup Java (temurin@8)
196+
id: setup-java-temurin-8
197+
if: matrix.java == 'temurin@8'
198+
uses: actions/setup-java@v4
199+
with:
200+
distribution: temurin
201+
java-version: 8
202+
cache: sbt
203+
204+
- name: sbt update
205+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
206+
run: sbt +update
207+
208+
- name: Submit Dependencies
209+
uses: scalacenter/sbt-dependency-submission@v2
210+
with:
211+
modules-ignore: root_2.13 root_3 root_2.12 docs_2.13 docs_3 docs_2.12
212+
configs-ignore: test scala-tool scala-doc-tool test-internal
143213

144214
docs:
145215
name: Deploy docs
146216
needs: [publish]
147217
if: always() && needs.build.result == 'success' && (needs.publish.result == 'success' || github.ref == 'refs/heads/docs-deploy')
148218
strategy:
149219
matrix:
150-
os: [ubuntu-latest]
220+
os: [ubuntu-22.04]
151221
scala: [2.13.8]
152-
java: [temurin@11]
222+
java: [temurin@8]
153223
runs-on: ${{ matrix.os }}
154224
steps:
155-
- name: Download target directories (2.13.8)
156-
uses: actions/download-artifact@v2
225+
- name: Download target directories (2.13)
226+
uses: actions/download-artifact@v4
157227
with:
158-
name: target-${{ matrix.os }}-2.13.8-${{ matrix.java }}
228+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13
159229

160-
- name: Inflate target directories (2.13.8)
230+
- name: Inflate target directories (2.13)
161231
run: |
162232
tar xf targets.tar
163233
rm targets.tar
164234
165-
- name: Download target directories (3.2.2)
166-
uses: actions/download-artifact@v2
235+
- name: Download target directories (3)
236+
uses: actions/download-artifact@v4
167237
with:
168-
name: target-${{ matrix.os }}-3.2.2-${{ matrix.java }}
238+
name: target-${{ matrix.os }}-${{ matrix.java }}-3
169239

170-
- name: Inflate target directories (3.2.2)
240+
- name: Inflate target directories (3)
171241
run: |
172242
tar xf targets.tar
173243
rm targets.tar
174244
175-
- name: Download target directories (2.12.14)
176-
uses: actions/download-artifact@v2
245+
- name: Download target directories (2.12)
246+
uses: actions/download-artifact@v4
177247
with:
178-
name: target-${{ matrix.os }}-2.12.14-${{ matrix.java }}
248+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12
179249

180-
- name: Inflate target directories (2.12.14)
250+
- name: Inflate target directories (2.12)
181251
run: |
182252
tar xf targets.tar
183253
rm targets.tar

0 commit comments

Comments
 (0)