Skip to content

Commit aa02b8b

Browse files
committed
Initial commit
0 parents  commit aa02b8b

38 files changed

Lines changed: 2837 additions & 0 deletions

.github/workflows/ci.yml

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

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

.scalafix.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
rules = [OrganizeImports]
2+
3+
OrganizeImports {
4+
blankLines = Auto
5+
coalesceToWildcardImportThreshold = null
6+
expandRelative = true
7+
groupExplicitlyImportedImplicitsSeparately = true
8+
groupedImports = Explode
9+
groups = ["*"]
10+
importSelectorsOrder = Ascii
11+
importsOrder = Ascii
12+
removeUnused = true
13+
targetDialect = Scala3
14+
}

.scalafmt.conf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
align = none
2+
align.arrowEnumeratorGenerator = false
3+
align.openParenCallSite = false
4+
align.openParenDefnSite = false
5+
align.tokens = []
6+
assumeStandardLibraryStripMargin = true
7+
binPack.literalArgumentLists = true
8+
continuationIndent.callSite = 2
9+
continuationIndent.defnSite = 2
10+
continuationIndent.extendSite = 2
11+
danglingParentheses.exclude = []
12+
docstrings = ScalaDoc
13+
docstrings.blankFirstLine = true
14+
docstrings.wrap = false
15+
encoding = "UTF-8"
16+
includeCurlyBraceInSelectChains = true
17+
lineEndings = unix
18+
maxColumn = 110
19+
newlines.alwaysBeforeElseAfterCurlyIf = false
20+
newlines.implicitParamListModifierForce = [before]
21+
optIn.breakChainOnFirstMethodDot = true
22+
project.git = true
23+
newlines.afterCurlyLambdaParams = squash
24+
rewrite.redundantBraces.generalExpressions = true
25+
rewrite.redundantBraces.ifElseExpressions = true
26+
rewrite.redundantBraces.stringInterpolation = true
27+
rewrite.redundantBraces.includeUnitMethods = false
28+
rewrite.rules = [PreferCurlyFors, RedundantBraces, RedundantParens]
29+
rewrite.trailingCommas.style = keep
30+
runner.dialect = scala3
31+
version = 3.9.3
32+
verticalMultiline.arityThreshold = 3
33+
verticalMultiline.atDefnSite = true
34+
verticalMultiline.newlineAfterOpenParen = true

0 commit comments

Comments
 (0)