Skip to content

Commit 117fcb7

Browse files
committed
support Scala 2.13, update deps, change organization/package to fork owner
1 parent cb45578 commit 117fcb7

31 files changed

+422
-343
lines changed

.github/workflows/ci.yml

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
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+
matrix:
30+
os: [ubuntu-22.04]
31+
scala: [2.12]
32+
java: [temurin@8]
33+
runs-on: ${{ matrix.os }}
34+
timeout-minutes: 60
35+
steps:
36+
- name: Checkout current branch (full)
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
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
48+
with:
49+
distribution: temurin
50+
java-version: 8
51+
cache: sbt
52+
53+
- name: sbt update
54+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
55+
run: sbt +update
56+
57+
- name: Check that workflows are up to date
58+
run: sbt githubWorkflowCheck
59+
60+
- name: Check formatting
61+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
62+
run: sbt '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck
63+
64+
- name: Check scalafix lints
65+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
66+
run: sbt '++ ${{ matrix.scala }}' 'scalafixAll --check'
67+
68+
- name: Test
69+
run: sbt '++ ${{ matrix.scala }}' test
70+
71+
- name: Generate API documentation
72+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
73+
run: sbt '++ ${{ matrix.scala }}' doc
74+
75+
- name: Make target directories
76+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
77+
run: mkdir -p target project/target
78+
79+
- name: Compress target directories
80+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
81+
run: tar cf targets.tar target project/target
82+
83+
- name: Upload target directories
84+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
88+
path: targets.tar
89+
90+
publish:
91+
name: Publish Artifacts
92+
needs: [build]
93+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
94+
strategy:
95+
matrix:
96+
os: [ubuntu-22.04]
97+
java: [temurin@8]
98+
runs-on: ${{ matrix.os }}
99+
steps:
100+
- name: Checkout current branch (full)
101+
uses: actions/checkout@v4
102+
with:
103+
fetch-depth: 0
104+
105+
- name: Setup sbt
106+
uses: sbt/setup-sbt@v1
107+
108+
- name: Setup Java (temurin@8)
109+
id: setup-java-temurin-8
110+
if: matrix.java == 'temurin@8'
111+
uses: actions/setup-java@v4
112+
with:
113+
distribution: temurin
114+
java-version: 8
115+
cache: sbt
116+
117+
- name: sbt update
118+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
119+
run: sbt +update
120+
121+
- name: Download target directories (2.12)
122+
uses: actions/download-artifact@v4
123+
with:
124+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12
125+
126+
- name: Inflate target directories (2.12)
127+
run: |
128+
tar xf targets.tar
129+
rm targets.tar
130+
131+
- name: Import signing key
132+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
133+
env:
134+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
135+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
136+
run: echo $PGP_SECRET | base64 -d -i - | gpg --import
137+
138+
- name: Import signing key and strip passphrase
139+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
140+
env:
141+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
142+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
143+
run: |
144+
echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg
145+
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
146+
(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)
147+
148+
- name: Publish
149+
env:
150+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
151+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
152+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
153+
run: sbt tlCiRelease
154+
155+
dependency-submission:
156+
name: Submit Dependencies
157+
if: github.event.repository.fork == false && github.event_name != 'pull_request'
158+
strategy:
159+
matrix:
160+
os: [ubuntu-22.04]
161+
java: [temurin@8]
162+
runs-on: ${{ matrix.os }}
163+
steps:
164+
- name: Checkout current branch (full)
165+
uses: actions/checkout@v4
166+
with:
167+
fetch-depth: 0
168+
169+
- name: Setup sbt
170+
uses: sbt/setup-sbt@v1
171+
172+
- name: Setup Java (temurin@8)
173+
id: setup-java-temurin-8
174+
if: matrix.java == 'temurin@8'
175+
uses: actions/setup-java@v4
176+
with:
177+
distribution: temurin
178+
java-version: 8
179+
cache: sbt
180+
181+
- name: sbt update
182+
if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false'
183+
run: sbt +update
184+
185+
- name: Submit Dependencies
186+
uses: scalacenter/sbt-dependency-submission@v2
187+
with:
188+
configs-ignore: test scala-tool scala-doc-tool test-internal

.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

.github/workflows/dependency-graph.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/scala.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ lib_managed/
1212
src_managed/
1313
project/boot/
1414
project/plugins/project/
15+
project/project
1516

1617
# Scala-IDE specific
1718
.scala_dependencies
@@ -22,5 +23,6 @@ project/plugins/project/
2223
.bloop
2324
.bsp
2425
.vscode
26+
metals.sbt
2527
.DS_Store
2628
```

.scalafix.conf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
rules = [OrganizeImports]
2-
3-
OrganizeImports.removeUnused = false
1+
rules = [RemoveUnused]

.scalafmt.conf

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = 3.7.17
1+
version = 3.9.9
22

33
runner.dialect = scala3
44

@@ -48,11 +48,26 @@ trailingCommas = never
4848

4949
rewrite {
5050
// RedundantBraces honestly just doesn't work, otherwise I'd love to use it
51-
rules = [PreferCurlyFors, RedundantParens, SortImports]
51+
rules = [PreferCurlyFors, RedundantBraces, RedundantParens, SortImports]
52+
53+
imports {
54+
sort = scalastyle
55+
groups = [
56+
["nl.thijsbroersen*\\..*"]
57+
["[a-z0-9]*\\..*"]
58+
["cats\\..*"]
59+
["cats\\..*"]
60+
["scala\\..*"]
61+
["java\\..*"]
62+
]
63+
}
5264

5365
redundantBraces {
54-
maxLines = 1
66+
# maxLines = 1
5567
stringInterpolation = true
68+
generalExpressions = true
69+
ifElseExpressions = true
70+
methodBodies = true
5671
}
5772
}
5873

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2024, gmkumar2005
3+
Copyright (c) 2024, thijsbroersen
44

55
Redistribution and use in source and binary forms, with or without
66
modification, are permitted provided that the following conditions are met:

0 commit comments

Comments
 (0)