Skip to content

Commit 9548f86

Browse files
authored
Merge pull request #418 from armanbilge/topic/sbt-typelevel
Setup sbt-typelevel
2 parents 8a2454a + 219dd62 commit 9548f86

26 files changed

+1761
-1506
lines changed

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# Scala Steward: Reformat with scalafmt 3.6.1
22
aa7db3a42121f78a5b3bed3658786c1cef83efe8
3+
4+
# Enable scalafmt for Scala 3
5+
64df4ae51873593a789af5848bd225c14d0baf8a

.github/workflows/ci.yml

Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
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+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
19+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
20+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
21+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
22+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
25+
jobs:
26+
build:
27+
name: Build and Test
28+
strategy:
29+
matrix:
30+
os: [ubuntu-latest]
31+
scala: [2.12.17, 2.13.10, 3.2.1]
32+
java: [temurin@11]
33+
project: [rootJS, rootJVM, rootNative]
34+
exclude:
35+
- scala: 3.2.1
36+
project: rootJVM
37+
runs-on: ${{ matrix.os }}
38+
steps:
39+
- name: Checkout current branch (full)
40+
uses: actions/checkout@v2
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Download Java (temurin@11)
45+
id: download-java-temurin-11
46+
if: matrix.java == 'temurin@11'
47+
uses: typelevel/download-java@v1
48+
with:
49+
distribution: temurin
50+
java-version: 11
51+
52+
- name: Setup Java (temurin@11)
53+
if: matrix.java == 'temurin@11'
54+
uses: actions/setup-java@v2
55+
with:
56+
distribution: jdkfile
57+
java-version: 11
58+
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}
59+
60+
- name: Cache sbt
61+
uses: actions/cache@v2
62+
with:
63+
path: |
64+
~/.sbt
65+
~/.ivy2/cache
66+
~/.coursier/cache/v1
67+
~/.cache/coursier/v1
68+
~/AppData/Local/Coursier/Cache/v1
69+
~/Library/Caches/Coursier/v1
70+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
71+
72+
- name: Check that workflows are up to date
73+
run: sbt githubWorkflowCheck
74+
75+
- name: Check formatting
76+
if: matrix.java == 'temurin@11'
77+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck
78+
79+
- name: scalaJSLink
80+
if: matrix.project == 'rootJS'
81+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult
82+
83+
- name: nativeLink
84+
if: matrix.project == 'rootNative'
85+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/nativeLink
86+
87+
- name: Test
88+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test
89+
90+
- name: Check binary compatibility
91+
if: matrix.java == 'temurin@11'
92+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues
93+
94+
- name: Generate API documentation
95+
if: matrix.java == 'temurin@11'
96+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc
97+
98+
- name: Make target directories
99+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
100+
run: mkdir -p target .js/target core/native/target tzdb/js/target core/js/target core/jvm/target tests/js/target .jvm/target .native/target demo/jvm/target tests/jvm/target demo/native/target tzdb/jvm/target tzdb/native/target tests/native/target demo/js/target project/target
101+
102+
- name: Compress target directories
103+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
104+
run: tar cf targets.tar target .js/target core/native/target tzdb/js/target core/js/target core/jvm/target tests/js/target .jvm/target .native/target demo/jvm/target tests/jvm/target demo/native/target tzdb/jvm/target tzdb/native/target tests/native/target demo/js/target project/target
105+
106+
- name: Upload target directories
107+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
108+
uses: actions/upload-artifact@v2
109+
with:
110+
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
111+
path: targets.tar
112+
113+
publish:
114+
name: Publish Artifacts
115+
needs: [build]
116+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master')
117+
strategy:
118+
matrix:
119+
os: [ubuntu-latest]
120+
scala: [2.13.10]
121+
java: [temurin@11]
122+
runs-on: ${{ matrix.os }}
123+
steps:
124+
- name: Checkout current branch (full)
125+
uses: actions/checkout@v2
126+
with:
127+
fetch-depth: 0
128+
129+
- name: Download Java (temurin@11)
130+
id: download-java-temurin-11
131+
if: matrix.java == 'temurin@11'
132+
uses: typelevel/download-java@v1
133+
with:
134+
distribution: temurin
135+
java-version: 11
136+
137+
- name: Setup Java (temurin@11)
138+
if: matrix.java == 'temurin@11'
139+
uses: actions/setup-java@v2
140+
with:
141+
distribution: jdkfile
142+
java-version: 11
143+
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}
144+
145+
- name: Cache sbt
146+
uses: actions/cache@v2
147+
with:
148+
path: |
149+
~/.sbt
150+
~/.ivy2/cache
151+
~/.coursier/cache/v1
152+
~/.cache/coursier/v1
153+
~/AppData/Local/Coursier/Cache/v1
154+
~/Library/Caches/Coursier/v1
155+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
156+
157+
- name: Download target directories (2.12.17, rootJS)
158+
uses: actions/download-artifact@v2
159+
with:
160+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJS
161+
162+
- name: Inflate target directories (2.12.17, rootJS)
163+
run: |
164+
tar xf targets.tar
165+
rm targets.tar
166+
167+
- name: Download target directories (2.12.17, rootJVM)
168+
uses: actions/download-artifact@v2
169+
with:
170+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootJVM
171+
172+
- name: Inflate target directories (2.12.17, rootJVM)
173+
run: |
174+
tar xf targets.tar
175+
rm targets.tar
176+
177+
- name: Download target directories (2.12.17, rootNative)
178+
uses: actions/download-artifact@v2
179+
with:
180+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17-rootNative
181+
182+
- name: Inflate target directories (2.12.17, rootNative)
183+
run: |
184+
tar xf targets.tar
185+
rm targets.tar
186+
187+
- name: Download target directories (2.13.10, rootJS)
188+
uses: actions/download-artifact@v2
189+
with:
190+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJS
191+
192+
- name: Inflate target directories (2.13.10, rootJS)
193+
run: |
194+
tar xf targets.tar
195+
rm targets.tar
196+
197+
- name: Download target directories (2.13.10, rootJVM)
198+
uses: actions/download-artifact@v2
199+
with:
200+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJVM
201+
202+
- name: Inflate target directories (2.13.10, rootJVM)
203+
run: |
204+
tar xf targets.tar
205+
rm targets.tar
206+
207+
- name: Download target directories (2.13.10, rootNative)
208+
uses: actions/download-artifact@v2
209+
with:
210+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootNative
211+
212+
- name: Inflate target directories (2.13.10, rootNative)
213+
run: |
214+
tar xf targets.tar
215+
rm targets.tar
216+
217+
- name: Download target directories (3.2.1, rootJS)
218+
uses: actions/download-artifact@v2
219+
with:
220+
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootJS
221+
222+
- name: Inflate target directories (3.2.1, rootJS)
223+
run: |
224+
tar xf targets.tar
225+
rm targets.tar
226+
227+
- name: Download target directories (3.2.1, rootNative)
228+
uses: actions/download-artifact@v2
229+
with:
230+
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootNative
231+
232+
- name: Inflate target directories (3.2.1, rootNative)
233+
run: |
234+
tar xf targets.tar
235+
rm targets.tar
236+
237+
- name: Import signing key
238+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
239+
run: echo $PGP_SECRET | base64 -di | gpg --import
240+
241+
- name: Import signing key and strip passphrase
242+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
243+
run: |
244+
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
245+
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
246+
(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)
247+
248+
- name: Publish
249+
run: sbt '++ ${{ matrix.scala }}' tlRelease

.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/release.yml

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

.github/workflows/scala.yml

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

.scalafmt.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,8 @@ rewrite.neverInfix.excludeFilters = [until
4242
theSameElementsAs]
4343

4444
runner.dialect = scala213
45+
fileOverride {
46+
"glob:**/scala-3/**" {
47+
runner.dialect = scala3
48+
}
49+
}

0 commit comments

Comments
 (0)