Skip to content

Commit 778cd17

Browse files
committed
Initial commit
0 parents  commit 778cd17

File tree

17 files changed

+953
-0
lines changed

17 files changed

+953
-0
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.github/workflows/ci.yml

+255
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
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.13.10, 3.2.1]
32+
java: [temurin@8]
33+
project: [rootJS, rootJVM]
34+
runs-on: ${{ matrix.os }}
35+
steps:
36+
- name: Checkout current branch (full)
37+
uses: actions/checkout@v3
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@v2
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@v3
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@v3
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' && matrix.os == 'ubuntu-latest'
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: Test
81+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test
82+
83+
- name: Check binary compatibility
84+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
85+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues
86+
87+
- name: Generate API documentation
88+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
89+
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc
90+
91+
- name: Make target directories
92+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
93+
run: mkdir -p target .js/target site/target core/.js/target core/.jvm/target .jvm/target .native/target project/target
94+
95+
- name: Compress target directories
96+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
97+
run: tar cf targets.tar target .js/target site/target core/.js/target core/.jvm/target .jvm/target .native/target project/target
98+
99+
- name: Upload target directories
100+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
101+
uses: actions/upload-artifact@v3
102+
with:
103+
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
104+
path: targets.tar
105+
106+
publish:
107+
name: Publish Artifacts
108+
needs: [build]
109+
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
110+
strategy:
111+
matrix:
112+
os: [ubuntu-latest]
113+
scala: [2.13.10]
114+
java: [temurin@8]
115+
runs-on: ${{ matrix.os }}
116+
steps:
117+
- name: Checkout current branch (full)
118+
uses: actions/checkout@v3
119+
with:
120+
fetch-depth: 0
121+
122+
- name: Download Java (temurin@8)
123+
id: download-java-temurin-8
124+
if: matrix.java == 'temurin@8'
125+
uses: typelevel/download-java@v2
126+
with:
127+
distribution: temurin
128+
java-version: 8
129+
130+
- name: Setup Java (temurin@8)
131+
if: matrix.java == 'temurin@8'
132+
uses: actions/setup-java@v3
133+
with:
134+
distribution: jdkfile
135+
java-version: 8
136+
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
137+
138+
- name: Cache sbt
139+
uses: actions/cache@v3
140+
with:
141+
path: |
142+
~/.sbt
143+
~/.ivy2/cache
144+
~/.coursier/cache/v1
145+
~/.cache/coursier/v1
146+
~/AppData/Local/Coursier/Cache/v1
147+
~/Library/Caches/Coursier/v1
148+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
149+
150+
- name: Download target directories (2.13.10, rootJS)
151+
uses: actions/download-artifact@v3
152+
with:
153+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJS
154+
155+
- name: Inflate target directories (2.13.10, rootJS)
156+
run: |
157+
tar xf targets.tar
158+
rm targets.tar
159+
160+
- name: Download target directories (2.13.10, rootJVM)
161+
uses: actions/download-artifact@v3
162+
with:
163+
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.10-rootJVM
164+
165+
- name: Inflate target directories (2.13.10, rootJVM)
166+
run: |
167+
tar xf targets.tar
168+
rm targets.tar
169+
170+
- name: Download target directories (3.2.1, rootJS)
171+
uses: actions/download-artifact@v3
172+
with:
173+
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootJS
174+
175+
- name: Inflate target directories (3.2.1, rootJS)
176+
run: |
177+
tar xf targets.tar
178+
rm targets.tar
179+
180+
- name: Download target directories (3.2.1, rootJVM)
181+
uses: actions/download-artifact@v3
182+
with:
183+
name: target-${{ matrix.os }}-${{ matrix.java }}-3.2.1-rootJVM
184+
185+
- name: Inflate target directories (3.2.1, rootJVM)
186+
run: |
187+
tar xf targets.tar
188+
rm targets.tar
189+
190+
- name: Import signing key
191+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
192+
run: echo $PGP_SECRET | base64 -di | gpg --import
193+
194+
- name: Import signing key and strip passphrase
195+
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
196+
run: |
197+
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
198+
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
199+
(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)
200+
201+
- name: Publish
202+
run: sbt '++ ${{ matrix.scala }}' tlCiRelease
203+
204+
site:
205+
name: Generate Site
206+
strategy:
207+
matrix:
208+
os: [ubuntu-latest]
209+
scala: [2.13.10]
210+
java: [temurin@8]
211+
runs-on: ${{ matrix.os }}
212+
steps:
213+
- name: Checkout current branch (full)
214+
uses: actions/checkout@v3
215+
with:
216+
fetch-depth: 0
217+
218+
- name: Download Java (temurin@8)
219+
id: download-java-temurin-8
220+
if: matrix.java == 'temurin@8'
221+
uses: typelevel/download-java@v2
222+
with:
223+
distribution: temurin
224+
java-version: 8
225+
226+
- name: Setup Java (temurin@8)
227+
if: matrix.java == 'temurin@8'
228+
uses: actions/setup-java@v3
229+
with:
230+
distribution: jdkfile
231+
java-version: 8
232+
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}
233+
234+
- name: Cache sbt
235+
uses: actions/cache@v3
236+
with:
237+
path: |
238+
~/.sbt
239+
~/.ivy2/cache
240+
~/.coursier/cache/v1
241+
~/.cache/coursier/v1
242+
~/AppData/Local/Coursier/Cache/v1
243+
~/Library/Caches/Coursier/v1
244+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
245+
246+
- name: Generate site
247+
run: sbt '++ ${{ matrix.scala }}' docs/tlSite
248+
249+
- name: Publish site
250+
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
251+
uses: peaceiris/actions-gh-pages@v3.9.0
252+
with:
253+
github_token: ${{ secrets.GITHUB_TOKEN }}
254+
publish_dir: site/target/docs/site
255+
keep_files: true

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

.scalafmt.conf

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version = 3.7.1
2+
runner.dialect = scala213
3+
4+
fileOverride {
5+
"glob:**/scala-3/**" {
6+
runner.dialect = scala3
7+
}
8+
}

CODE_OF_CONDUCT.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Code of Conduct
2+
3+
We are committed to providing a friendly, safe and welcoming environment for all, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, nationality, or other such characteristics.
4+
5+
Everyone is expected to follow the [Scala Code of Conduct] when discussing the project on the available communication channels.
6+
7+
8+
## Moderation
9+
10+
If you have any questions, concerns, or moderation requests, please contact a member of the project.
11+
12+
- [Antoine Comte](mailto:antoine@comte.cc)
13+
14+
[Scala Code of Conduct]: https://scala-lang.org/conduct/

0 commit comments

Comments
 (0)