Skip to content

Commit ee95ea6

Browse files
authored
Merge pull request #297 from gnieh/scala-native
Compile for scala native
2 parents 773f268 + afdc732 commit ee95ea6

File tree

72 files changed

+1647
-693
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1647
-693
lines changed

.github/workflows/ci.yml

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

.sbtopts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
-J-Xms2g
2+
-J-Xmx4g
3+
-J-XX:MaxMetaspaceSize=512m

.scalafmt.conf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
version = "3.5.9"
2+
maxColumn = 120
3+
danglingParentheses.preset = false
4+
align.preset = some
5+
align.openParenCallSite = true
6+
align.openParenDefnSite = true
7+
newlines.penalizeSingleSelectMultiArgList = false
8+
literals.long = Upper
9+
literals.float = Upper
10+
literals.double = Upper
11+
docstrings.style = keep
12+
13+
rewrite.rules = [
14+
prefercurlyfors
15+
]
16+
17+
runner.dialect = scala213
18+
fileOverride {
19+
"glob:**/src/*/scala-3/**" {
20+
runner.dialect = scala3
21+
}
22+
}

0 commit comments

Comments
 (0)