Skip to content

Commit 05d35fe

Browse files
authored
Merge pull request #306 from http4s/central-portal
Publish to Central Portal
2 parents 7da0e08 + 9817540 commit 05d35fe

12 files changed

Lines changed: 640 additions & 222 deletions

File tree

.github/workflows/ci.yml

Lines changed: 316 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,316 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Continuous Integration
9+
10+
on:
11+
pull_request:
12+
branches: ['**', '!update/**', '!pr/**']
13+
push:
14+
branches: ['**', '!update/**', '!pr/**']
15+
tags: [v*]
16+
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
20+
21+
concurrency:
22+
group: ${{ github.workflow }} @ ${{ github.ref }}
23+
cancel-in-progress: true
24+
25+
jobs:
26+
build:
27+
name: Test
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
os: [ubuntu-22.04]
32+
scala: [2.13, 2.12]
33+
java: [temurin@8, temurin@11, temurin@17]
34+
exclude:
35+
- scala: 2.12
36+
java: temurin@11
37+
- scala: 2.12
38+
java: temurin@17
39+
runs-on: ${{ matrix.os }}
40+
timeout-minutes: 60
41+
steps:
42+
- name: Checkout current branch (full)
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 0
46+
47+
- name: Setup sbt
48+
uses: sbt/setup-sbt@v1
49+
50+
- name: Setup Java (temurin@8)
51+
id: setup-java-temurin-8
52+
if: matrix.java == 'temurin@8'
53+
uses: actions/setup-java@v4
54+
with:
55+
distribution: temurin
56+
java-version: 8
57+
cache: sbt
58+
59+
- name: sbt update
60+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
61+
run: sbt +update
62+
63+
- name: Setup Java (temurin@11)
64+
id: setup-java-temurin-11
65+
if: matrix.java == 'temurin@11'
66+
uses: actions/setup-java@v4
67+
with:
68+
distribution: temurin
69+
java-version: 11
70+
cache: sbt
71+
72+
- name: sbt update
73+
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
74+
run: sbt +update
75+
76+
- name: Setup Java (temurin@17)
77+
id: setup-java-temurin-17
78+
if: matrix.java == 'temurin@17'
79+
uses: actions/setup-java@v4
80+
with:
81+
distribution: temurin
82+
java-version: 17
83+
cache: sbt
84+
85+
- name: sbt update
86+
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
87+
run: sbt +update
88+
89+
- name: Check that workflows are up to date
90+
run: sbt githubWorkflowCheck
91+
92+
- name: Check headers and formatting
93+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
94+
run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
95+
96+
- name: Test
97+
run: sbt '++ ${{ matrix.scala }}' test
98+
99+
- name: Check binary compatibility
100+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
101+
run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues
102+
103+
- name: Generate API documentation
104+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
105+
run: sbt '++ ${{ matrix.scala }}' doc
106+
107+
- name: Check scalafix lints
108+
if: matrix.java == 'temurin@8' && !startsWith(matrix.scala, '3')
109+
run: sbt '++ ${{ matrix.scala }}' 'scalafixAll --check'
110+
111+
- name: Check unused compile dependencies
112+
if: matrix.java == 'temurin@8'
113+
run: sbt '++ ${{ matrix.scala }}' unusedCompileDependenciesTest
114+
115+
- name: Make target directories
116+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
117+
run: mkdir -p target project/target
118+
119+
- name: Compress target directories
120+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
121+
run: tar cf targets.tar target project/target
122+
123+
- name: Upload target directories
124+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
128+
path: targets.tar
129+
130+
publish:
131+
name: Publish Artifacts
132+
needs: [build]
133+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
134+
strategy:
135+
matrix:
136+
os: [ubuntu-22.04]
137+
java: [temurin@8]
138+
runs-on: ${{ matrix.os }}
139+
steps:
140+
- name: Checkout current branch (full)
141+
uses: actions/checkout@v4
142+
with:
143+
fetch-depth: 0
144+
145+
- name: Setup sbt
146+
uses: sbt/setup-sbt@v1
147+
148+
- name: Setup Java (temurin@8)
149+
id: setup-java-temurin-8
150+
if: matrix.java == 'temurin@8'
151+
uses: actions/setup-java@v4
152+
with:
153+
distribution: temurin
154+
java-version: 8
155+
cache: sbt
156+
157+
- name: sbt update
158+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
159+
run: sbt +update
160+
161+
- name: Setup Java (temurin@11)
162+
id: setup-java-temurin-11
163+
if: matrix.java == 'temurin@11'
164+
uses: actions/setup-java@v4
165+
with:
166+
distribution: temurin
167+
java-version: 11
168+
cache: sbt
169+
170+
- name: sbt update
171+
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
172+
run: sbt +update
173+
174+
- name: Setup Java (temurin@17)
175+
id: setup-java-temurin-17
176+
if: matrix.java == 'temurin@17'
177+
uses: actions/setup-java@v4
178+
with:
179+
distribution: temurin
180+
java-version: 17
181+
cache: sbt
182+
183+
- name: sbt update
184+
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
185+
run: sbt +update
186+
187+
- name: Download target directories (2.13)
188+
uses: actions/download-artifact@v4
189+
with:
190+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13
191+
192+
- name: Inflate target directories (2.13)
193+
run: |
194+
tar xf targets.tar
195+
rm targets.tar
196+
197+
- name: Download target directories (2.12)
198+
uses: actions/download-artifact@v4
199+
with:
200+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12
201+
202+
- name: Inflate target directories (2.12)
203+
run: |
204+
tar xf targets.tar
205+
rm targets.tar
206+
207+
- name: Import signing key
208+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
209+
env:
210+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
211+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
212+
run: echo $PGP_SECRET | base64 -d -i - | gpg --import
213+
214+
- name: Import signing key and strip passphrase
215+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
216+
env:
217+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
218+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
219+
run: |
220+
echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg
221+
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
222+
(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)
223+
224+
- name: Publish
225+
env:
226+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
227+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
228+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
229+
run: sbt tlCiRelease
230+
231+
dependency-submission:
232+
name: Submit Dependencies
233+
if: github.event.repository.fork == false && github.event_name != 'pull_request'
234+
strategy:
235+
matrix:
236+
os: [ubuntu-22.04]
237+
java: [temurin@8]
238+
runs-on: ${{ matrix.os }}
239+
steps:
240+
- name: Checkout current branch (full)
241+
uses: actions/checkout@v4
242+
with:
243+
fetch-depth: 0
244+
245+
- name: Setup sbt
246+
uses: sbt/setup-sbt@v1
247+
248+
- name: Setup Java (temurin@8)
249+
id: setup-java-temurin-8
250+
if: matrix.java == 'temurin@8'
251+
uses: actions/setup-java@v4
252+
with:
253+
distribution: temurin
254+
java-version: 8
255+
cache: sbt
256+
257+
- name: sbt update
258+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
259+
run: sbt +update
260+
261+
- name: Setup Java (temurin@11)
262+
id: setup-java-temurin-11
263+
if: matrix.java == 'temurin@11'
264+
uses: actions/setup-java@v4
265+
with:
266+
distribution: temurin
267+
java-version: 11
268+
cache: sbt
269+
270+
- name: sbt update
271+
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false'
272+
run: sbt +update
273+
274+
- name: Setup Java (temurin@17)
275+
id: setup-java-temurin-17
276+
if: matrix.java == 'temurin@17'
277+
uses: actions/setup-java@v4
278+
with:
279+
distribution: temurin
280+
java-version: 17
281+
cache: sbt
282+
283+
- name: sbt update
284+
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
285+
run: sbt +update
286+
287+
- name: Submit Dependencies
288+
uses: scalacenter/sbt-dependency-submission@v2
289+
with:
290+
modules-ignore: sbt-http4s-org-scalafix-internal_2.13 sbt-http4s-org-scalafix-internal_2.12
291+
configs-ignore: test scala-tool scala-doc-tool test-internal
292+
293+
validate-steward:
294+
name: Validate Steward Config
295+
strategy:
296+
matrix:
297+
os: [ubuntu-22.04]
298+
java: [temurin@11]
299+
runs-on: ${{ matrix.os }}
300+
steps:
301+
- name: Checkout current branch (fast)
302+
uses: actions/checkout@v4
303+
304+
- name: Setup Java (temurin@11)
305+
id: setup-java-temurin-11
306+
if: matrix.java == 'temurin@11'
307+
uses: actions/setup-java@v4
308+
with:
309+
distribution: temurin
310+
java-version: 11
311+
312+
- uses: coursier/setup-action@v1
313+
with:
314+
apps: scala-steward
315+
316+
- run: scala-steward validate-repo-config .scala-steward.conf

.github/workflows/clean.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Clean
9+
10+
on: push
11+
12+
jobs:
13+
delete-artifacts:
14+
name: Delete Artifacts
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- name: Delete artifacts
20+
run: |
21+
# Customize those three lines with your repository and credentials:
22+
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
23+
24+
# A shortcut to call GitHub API.
25+
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
26+
27+
# A temporary file which receives HTTP response headers.
28+
TMPFILE=/tmp/tmp.$$
29+
30+
# An associative array, key: artifact name, value: number of artifacts of that name.
31+
declare -A ARTCOUNT
32+
33+
# Process all artifacts on this repository, loop on returned "pages".
34+
URL=$REPO/actions/artifacts
35+
while [[ -n "$URL" ]]; do
36+
37+
# Get current page, get response headers in a temporary file.
38+
JSON=$(ghapi --dump-header $TMPFILE "$URL")
39+
40+
# Get URL of next page. Will be empty if we are at the last page.
41+
URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*<//' -e 's/>.*//')
42+
rm -f $TMPFILE
43+
44+
# Number of artifacts on this page:
45+
COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') ))
46+
47+
# Loop on all artifacts on this page.
48+
for ((i=0; $i < $COUNT; i++)); do
49+
50+
# Get name of artifact and count instances of this name.
51+
name=$(jq <<<$JSON -r ".artifacts[$i].name?")
52+
ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1))
53+
54+
id=$(jq <<<$JSON -r ".artifacts[$i].id?")
55+
size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") ))
56+
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
57+
ghapi -X DELETE $REPO/actions/artifacts/$id
58+
done
59+
done

0 commit comments

Comments
 (0)