Skip to content

Commit 899f9f2

Browse files
Initial Commit
0 parents  commit 899f9f2

File tree

17 files changed

+809
-0
lines changed

17 files changed

+809
-0
lines changed

.github/workflows/ci.yml

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

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
target/
2+
.idea/
3+
# vim
4+
*.sw?
5+
6+
# Ignore [ce]tags files
7+
tags
8+
9+
.bloop
10+
.metals
11+
metals.sbt
12+
.vscode
13+
.bsp

CODE_OF_CONDUCT.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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. If you are being harassed, please contact us immediately so that we can support you.
6+
7+
## Moderation
8+
9+
Any questions, concerns, or moderation requests please contact a member of the project.
10+
11+
- [Christopher Davenport](mailto:[email protected])
12+
13+
[Scala Code of Conduct]: https://www.scala-lang.org/conduct/

LICENSE

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2022 Christopher Davenport
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# equilibrium - erver Software Ready to Go [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/equilibrium_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.chrisdavenport/equilibrium_2.12) ![Code of Conduct](https://img.shields.io/badge/Code%20of%20Conduct-Scala-blue.svg)
2+
3+
## [Head on over to the microsite](https://ChristopherDavenport.github.io/equilibrium)
4+
5+
## Quick Start
6+
7+
To use equilibrium in an existing SBT project with Scala 2.12 or a later version, add the following dependencies to your
8+
`build.sbt` depending on your needs:
9+
10+
```scala
11+
libraryDependencies ++= Seq(
12+
"io.chrisdavenport" %% "equilibrium" % "<version>"
13+
)
14+
```

0 commit comments

Comments
 (0)