Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial implementation of plugin #1

Merged
merged 51 commits into from
Oct 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
c8c4d14
Implement something that looks like an sbt plugin
lorandszakacs Sep 20, 2022
3e575c1
Init scala project
lorandszakacs Sep 20, 2022
6e64ca8
Add initial implementation of CirceIoPlugin sbt plugin
lorandszakacs Sep 20, 2022
c22bba6
Shamelessly add myself as developer
lorandszakacs Sep 20, 2022
61cec24
Use only JDK 11 and 17 by default
lorandszakacs Sep 20, 2022
100a64b
Remove fail-fast matrix behaviour
lorandszakacs Sep 20, 2022
fa42baa
Remove scalastyle
lorandszakacs Sep 20, 2022
2610345
Use entire sbt-typelevel plugin
lorandszakacs Sep 20, 2022
953ac9a
Remove redundant enabling of TypelevelCiReleasePlugin
lorandszakacs Sep 20, 2022
46c24cf
Bump sbt-scoverage to 2.0.4 from 1.9.3
lorandszakacs Sep 20, 2022
0572946
Use scalafix and enable it
lorandszakacs Sep 20, 2022
5b244f8
prePR
lorandszakacs Sep 20, 2022
df422f3
Add trailing empty line
lorandszakacs Sep 20, 2022
e687309
Enable typelevel-scalafiix-cats rule
lorandszakacs Sep 20, 2022
acfd688
Set JDK release version to 8
lorandszakacs Sep 20, 2022
cb371cf
Refine nowarn for interpolators
lorandszakacs Sep 20, 2022
71ba8e1
Remove scalafix dependency. Already provided by sbt-typelevel-scalafix
lorandszakacs Sep 20, 2022
543d012
Add aproximation of CirceIoSitePlugin
lorandszakacs Sep 20, 2022
0ddf2ba
Eat own site and use README.md as docs/ module using CirceIoSitePlugin
lorandszakacs Sep 20, 2022
2a4edb8
Update build.sbt
lorandszakacs Sep 21, 2022
be5fbfd
Bump sbt-typelevel to 0.4.15
lorandszakacs Sep 21, 2022
a628e3d
Ignore more metals things
lorandszakacs Sep 21, 2022
5d668cf
Put codecoverage under the circeRootOfCodeCoverage settingKey
lorandszakacs Sep 21, 2022
d795892
Generate workflows
lorandszakacs Sep 21, 2022
dfa8334
Disable scalafix check for the plugin build
lorandszakacs Sep 21, 2022
e551d24
Eat own scalafix
lorandszakacs Sep 22, 2022
c8962ab
Remove comment - re-arrange stuff
lorandszakacs Sep 22, 2022
3ea0d4d
Merge branch 'main' into initial-implementation
armanbilge Sep 22, 2022
b5a628b
Actually apply scalafix
lorandszakacs Sep 23, 2022
9c16c03
Do not generate empty code coverage workflow when circeRootOfCodeCove…
lorandszakacs Sep 23, 2022
c7ad4e1
Make text on site readable
lorandszakacs Sep 24, 2022
8a2607d
Remove duplicated images, rename them for more clarity
lorandszakacs Sep 24, 2022
9dfe5b3
Make logos and favicon actually display
lorandszakacs Sep 24, 2022
07f8eec
Add section about images to README
lorandszakacs Sep 24, 2022
4597534
Fix comment
lorandszakacs Sep 24, 2022
363eddc
Disable code coverage for ScalaJS projects
lorandszakacs Sep 24, 2022
ba4c6cf
Exclude io.circe.examples.* packages from code coverage
lorandszakacs Sep 24, 2022
753a6c9
Scalafix
lorandszakacs Sep 24, 2022
dd5ed0f
Add default coverageHighlighting := true
lorandszakacs Sep 24, 2022
2aff009
Rename CirceIo -> CirceOrg
lorandszakacs Sep 24, 2022
b36d24e
Remove done //TODO:
lorandszakacs Sep 24, 2022
e0f8fe7
Update docs/README.md
lorandszakacs Oct 24, 2022
85b669d
Update core/build.sbt
lorandszakacs Oct 24, 2022
dab3ba0
Update README.md
lorandszakacs Oct 24, 2022
d9a1376
Update README.md
lorandszakacs Oct 24, 2022
7cfa12e
Update core/build.sbt
lorandszakacs Oct 24, 2022
461737c
Update docs/README.md
lorandszakacs Oct 24, 2022
01bb43d
bump sbt to 1.7.2
lorandszakacs Oct 24, 2022
8802c1e
Fix typo
lorandszakacs Oct 24, 2022
5113b37
Add scala native auto plugin
lorandszakacs Oct 25, 2022
0a462b2
Move code coverage opinionated settings to build settings
lorandszakacs Oct 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
266 changes: 266 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,272 @@
# This file was automatically generated by sbt-github-actions using the
# githubWorkflowGenerate task. You should add and commit this file to
# your git repository. It goes without saying that you shouldn't edit
# this file by hand! Instead, if you wish to make changes, you should
# change your sbt build configuration to revise the workflow description
# to meet your needs, then regenerate this file.

name: Continuous Integration

on:
pull_request:
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

env:
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
name: Build and Test
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.17]
java: [temurin@11, temurin@17]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 11

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Check that workflows are up to date
run: sbt githubWorkflowCheck

- name: Check headers and formatting
if: matrix.java == 'temurin@11'
run: sbt '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Test
run: sbt '++${{ matrix.scala }}' test

- name: Check scalafix lints
if: matrix.java == 'temurin@11'
run: sbt '++${{ matrix.scala }}' 'scalafixAll --check'

- name: Check binary compatibility
if: matrix.java == 'temurin@11'
run: sbt '++${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@11'
run: sbt '++${{ matrix.scala }}' doc

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p target site/target core/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar target site/target core/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
uses: actions/upload-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
path: targets.tar

publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.17]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 11

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (2.12.17)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.17

- name: Inflate target directories (2.12.17)
run: |
tar xf targets.tar
rm targets.tar

- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
run: echo $PGP_SECRET | base64 -di | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
run: |
echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(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)

- name: Publish
run: sbt '++${{ matrix.scala }}' tlRelease

site:
name: Generate Site
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.17]
java: [temurin@11]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Download Java (temurin@11)
id: download-java-temurin-11
if: matrix.java == 'temurin@11'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 11

- name: Setup Java (temurin@11)
if: matrix.java == 'temurin@11'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 11
jdkFile: ${{ steps.download-java-temurin-11.outputs.jdkFile }}

- name: Download Java (temurin@17)
id: download-java-temurin-17
if: matrix.java == 'temurin@17'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 17

- name: Setup Java (temurin@17)
if: matrix.java == 'temurin@17'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 17
jdkFile: ${{ steps.download-java-temurin-17.outputs.jdkFile }}

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
~/AppData/Local/Coursier/Cache/v1
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Generate site
run: sbt '++${{ matrix.scala }}' docs/tlSite

- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site/target/docs/site
keep_files: true
59 changes: 59 additions & 0 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# This file was automatically generated by sbt-github-actions using the
# githubWorkflowGenerate task. You should add and commit this file to
# your git repository. It goes without saying that you shouldn't edit
# this file by hand! Instead, if you wish to make changes, you should
# change your sbt build configuration to revise the workflow description
# to meet your needs, then regenerate this file.

name: Clean

on: push

jobs:
delete-artifacts:
name: Delete Artifacts
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Delete artifacts
run: |
# Customize those three lines with your repository and credentials:
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}

# A shortcut to call GitHub API.
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }

# A temporary file which receives HTTP response headers.
TMPFILE=/tmp/tmp.$$

# An associative array, key: artifact name, value: number of artifacts of that name.
declare -A ARTCOUNT

# Process all artifacts on this repository, loop on returned "pages".
URL=$REPO/actions/artifacts
while [[ -n "$URL" ]]; do

# Get current page, get response headers in a temporary file.
JSON=$(ghapi --dump-header $TMPFILE "$URL")

# Get URL of next page. Will be empty if we are at the last page.
URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*<//' -e 's/>.*//')
rm -f $TMPFILE

# Number of artifacts on this page:
COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') ))

# Loop on all artifacts on this page.
for ((i=0; $i < $COUNT; i++)); do

# Get name of artifact and count instances of this name.
name=$(jq <<<$JSON -r ".artifacts[$i].name?")
ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1))

id=$(jq <<<$JSON -r ".artifacts[$i].id?")
size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") ))
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
ghapi -X DELETE $REPO/actions/artifacts/$id
done
done
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
*.class
*.log
target/
.idea/
.vscode
.bloop
.metals
project/metals.sbt
project/project
.bsp/
3 changes: 3 additions & 0 deletions .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
updates.pin = [
{ groupId = "org.scala-lang", artifactId = "scala-library", version = "2.12." }
]
3 changes: 3 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rules = [
OrganizeImports
]
21 changes: 21 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version = 3.5.3
project.git = true
runner.dialect = scala213
project.layout = StandardConvention
continuationIndent.defnSite = 2
docstrings.style = Asterisk
docstrings.wrap = no
includeCurlyBraceInSelectChains = false
maxColumn = 120
newlines.alwaysBeforeElseAfterCurlyIf = false
newlines.alwaysBeforeMultilineDef = false
optIn.breakChainOnFirstMethodDot = false
spaces.inImportCurlyBraces = true
rewrite.rules = [
AvoidInfix,
RedundantParens,
AsciiSortImports,
PreferCurlyFors
]
newlines.afterCurlyLambda = preserve
newlines.beforeCurlyLambdaParams = multilineWithCaseOnly
Loading