Skip to content

Commit e644ae5

Browse files
committed
Bootstrap
1 parent d245b6f commit e644ae5

File tree

9 files changed

+484
-1
lines changed

9 files changed

+484
-1
lines changed

.github/workflows/ci.yml

+295
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
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: Build and Test
28+
strategy:
29+
matrix:
30+
os: [ubuntu-latest]
31+
scala: [2.12, 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@v3
39+
with:
40+
fetch-depth: 0
41+
42+
- name: Download Java (temurin@17)
43+
id: download-java-temurin-17
44+
if: matrix.java == 'temurin@17'
45+
uses: typelevel/download-java@v2
46+
with:
47+
distribution: temurin
48+
java-version: 17
49+
50+
- name: Setup Java (temurin@17)
51+
id: setup-java-temurin-17
52+
if: matrix.java == 'temurin@17'
53+
uses: actions/setup-java@v3
54+
with:
55+
distribution: jdkfile
56+
java-version: 17
57+
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}
58+
cache: sbt
59+
60+
- name: sbt update
61+
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
62+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' reload +update
63+
64+
- name: Check that workflows are up to date
65+
run: sbt githubWorkflowCheck
66+
67+
- name: Check headers and formatting
68+
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
69+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
70+
71+
- name: scalaJSLink
72+
if: matrix.project == 'rootJS'
73+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult
74+
75+
- name: nativeLink
76+
if: matrix.project == 'rootNative'
77+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/nativeLink
78+
79+
- name: Test
80+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test
81+
82+
- name: Check binary compatibility
83+
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
84+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues
85+
86+
- name: Generate API documentation
87+
if: matrix.java == 'temurin@17' && matrix.os == 'ubuntu-latest'
88+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc
89+
90+
- name: Make target directories
91+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
92+
run: mkdir -p toolkit/js/target target toolkit/native/target .js/target toolkit/jvm/target .jvm/target .native/target project/target
93+
94+
- name: Compress target directories
95+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
96+
run: tar cf targets.tar toolkit/js/target target toolkit/native/target .js/target toolkit/jvm/target .jvm/target .native/target project/target
97+
98+
- name: Upload target directories
99+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
100+
uses: actions/upload-artifact@v3
101+
with:
102+
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
103+
path: targets.tar
104+
105+
publish:
106+
name: Publish Artifacts
107+
needs: [build]
108+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
109+
strategy:
110+
matrix:
111+
os: [ubuntu-latest]
112+
scala: [3.2.2]
113+
java: [temurin@17]
114+
runs-on: ${{ matrix.os }}
115+
steps:
116+
- name: Checkout current branch (full)
117+
uses: actions/checkout@v3
118+
with:
119+
fetch-depth: 0
120+
121+
- name: Download Java (temurin@17)
122+
id: download-java-temurin-17
123+
if: matrix.java == 'temurin@17'
124+
uses: typelevel/download-java@v2
125+
with:
126+
distribution: temurin
127+
java-version: 17
128+
129+
- name: Setup Java (temurin@17)
130+
id: setup-java-temurin-17
131+
if: matrix.java == 'temurin@17'
132+
uses: actions/setup-java@v3
133+
with:
134+
distribution: jdkfile
135+
java-version: 17
136+
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}
137+
cache: sbt
138+
139+
- name: sbt update
140+
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
141+
run: sbt '++ ${{ matrix.scala }}' reload +update
142+
143+
- name: Download target directories (2.12, rootJS)
144+
uses: actions/download-artifact@v3
145+
with:
146+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJS
147+
148+
- name: Inflate target directories (2.12, rootJS)
149+
run: |
150+
tar xf targets.tar
151+
rm targets.tar
152+
153+
- name: Download target directories (2.12, rootJVM)
154+
uses: actions/download-artifact@v3
155+
with:
156+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJVM
157+
158+
- name: Inflate target directories (2.12, rootJVM)
159+
run: |
160+
tar xf targets.tar
161+
rm targets.tar
162+
163+
- name: Download target directories (2.12, rootNative)
164+
uses: actions/download-artifact@v3
165+
with:
166+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootNative
167+
168+
- name: Inflate target directories (2.12, rootNative)
169+
run: |
170+
tar xf targets.tar
171+
rm targets.tar
172+
173+
- name: Download target directories (2.13, rootJS)
174+
uses: actions/download-artifact@v3
175+
with:
176+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJS
177+
178+
- name: Inflate target directories (2.13, rootJS)
179+
run: |
180+
tar xf targets.tar
181+
rm targets.tar
182+
183+
- name: Download target directories (2.13, rootJVM)
184+
uses: actions/download-artifact@v3
185+
with:
186+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJVM
187+
188+
- name: Inflate target directories (2.13, rootJVM)
189+
run: |
190+
tar xf targets.tar
191+
rm targets.tar
192+
193+
- name: Download target directories (2.13, rootNative)
194+
uses: actions/download-artifact@v3
195+
with:
196+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootNative
197+
198+
- name: Inflate target directories (2.13, rootNative)
199+
run: |
200+
tar xf targets.tar
201+
rm targets.tar
202+
203+
- name: Download target directories (3, rootJS)
204+
uses: actions/download-artifact@v3
205+
with:
206+
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS
207+
208+
- name: Inflate target directories (3, rootJS)
209+
run: |
210+
tar xf targets.tar
211+
rm targets.tar
212+
213+
- name: Download target directories (3, rootJVM)
214+
uses: actions/download-artifact@v3
215+
with:
216+
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM
217+
218+
- name: Inflate target directories (3, rootJVM)
219+
run: |
220+
tar xf targets.tar
221+
rm targets.tar
222+
223+
- name: Download target directories (3, rootNative)
224+
uses: actions/download-artifact@v3
225+
with:
226+
name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootNative
227+
228+
- name: Inflate target directories (3, rootNative)
229+
run: |
230+
tar xf targets.tar
231+
rm targets.tar
232+
233+
- name: Import signing key
234+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
235+
env:
236+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
237+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
238+
run: echo $PGP_SECRET | base64 -di | gpg --import
239+
240+
- name: Import signing key and strip passphrase
241+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
242+
env:
243+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
244+
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
245+
run: |
246+
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
247+
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
248+
(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)
249+
250+
- name: Publish
251+
env:
252+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
253+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
254+
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
255+
run: sbt '++ ${{ matrix.scala }}' tlRelease
256+
257+
dependency-submission:
258+
name: Submit Dependencies
259+
if: github.event_name != 'pull_request'
260+
strategy:
261+
matrix:
262+
os: [ubuntu-latest]
263+
scala: [3.2.2]
264+
java: [temurin@17]
265+
runs-on: ${{ matrix.os }}
266+
steps:
267+
- name: Checkout current branch (full)
268+
uses: actions/checkout@v3
269+
with:
270+
fetch-depth: 0
271+
272+
- name: Download Java (temurin@17)
273+
id: download-java-temurin-17
274+
if: matrix.java == 'temurin@17'
275+
uses: typelevel/download-java@v2
276+
with:
277+
distribution: temurin
278+
java-version: 17
279+
280+
- name: Setup Java (temurin@17)
281+
id: setup-java-temurin-17
282+
if: matrix.java == 'temurin@17'
283+
uses: actions/setup-java@v3
284+
with:
285+
distribution: jdkfile
286+
java-version: 17
287+
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}
288+
cache: sbt
289+
290+
- name: sbt update
291+
if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false'
292+
run: sbt '++ ${{ matrix.scala }}' reload +update
293+
294+
- name: Submit Dependencies
295+
uses: scalacenter/sbt-dependency-submission@v2

.github/workflows/clean.yml

+59
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

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# sbt
2+
target/
3+
project/plugins/project/
4+
boot/
5+
lib_managed/
6+
src_managed/
7+
8+
# vim
9+
*.sw?
10+
11+
# intellij
12+
.idea/
13+
14+
# ignore [ce]tags files
15+
tags
16+
17+
# metals
18+
.metals/
19+
.bsp/
20+
.bloop/
21+
metals.sbt
22+
.vscode
23+
24+
# npm
25+
node_modules/

0 commit comments

Comments
 (0)