Skip to content

Commit

Permalink
Merge pull request #2 from busymachines/feature/scala3-ce3-support
Browse files Browse the repository at this point in the history
CE3 + Scala 3 support
  • Loading branch information
lorandszakacs authored Aug 5, 2021
2 parents 4f6fdc8 + 4e71ba1 commit 248be6e
Show file tree
Hide file tree
Showing 25 changed files with 1,007 additions and 252 deletions.
32 changes: 21 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ name: Continuous Integration

on:
pull_request:
branches: ['*']
branches: ['**']
push:
branches: ['*']
branches: ['**']
tags: [v*]

env:
Expand All @@ -26,7 +26,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.5]
scala: [2.13.6, 3.0.1]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -53,12 +53,12 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Check that workflows are up to date
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
run: sbt --client '++${{ matrix.scala }}; githubWorkflowCheck'

- run: sbt ++${{ matrix.scala }} ci
- run: sbt --client '++${{ matrix.scala }}; ci'

- name: Compress target directories
run: tar cf targets.tar target db-testkit/target db-test-data/target project/target
run: tar cf targets.tar target db-test-data/target db-test-data-ce2/target db-testkit-ce2/target db-testkit/target project/target

- name: Upload target directories
uses: actions/upload-artifact@v2
Expand All @@ -73,7 +73,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.5]
scala: [2.13.6]
java: [adopt@1.8]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -99,17 +99,27 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

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

- name: Inflate target directories (2.13.5)
- name: Inflate target directories (2.13.6)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.0.1)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-3.0.1-${{ matrix.java }}

- name: Inflate target directories (3.0.1)
run: |
tar xf targets.tar
rm targets.tar
- name: Import signing key
run: echo $PGP_SECRET | base64 -d | gpg --import

- run: sbt ++${{ matrix.scala }} release
- run: sbt --client '++${{ matrix.scala }}; release'
126 changes: 63 additions & 63 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,58 +16,68 @@
# limitations under the License.
#

# See https://scalameta.org/scalafmt/docs/configuration.html for details,
# mostly done by trial and error. But I guess this formatting is "good enough"
# See https://scalameta.org/scalafmt/docs/configuration.html for details
#
# https://github.com/scalameta/scalafmt/releases
version = 3.0.0-RC6

#https://github.com/scalameta/scalafmt/releases
version = 2.7.5

project {
#if you don't specify that files ending in .scala .sbt with $,
# .scalafmt.conf is included in the formatting attempt
includeFilters = [
".*.\\.scala$"
".*\\..sbt$"
]
fileOverride {
"glob:**/src/main/scala/**" {
runner.dialect = scala213source3
}
"glob:**/src/test/scala/**" {
runner.dialect = scala213source3
}
"glob:**/src/main/scala-2/**" {
runner.dialect = scala213source3
}
"glob:**/src/test/scala-2/**" {
runner.dialect = scala213source3
}
"glob:**/src/main/scala-3/**" {
runner.dialect = scala3
}
"glob:**/src/test/scala-3/**" {
runner.dialect = scala3
}
"glob:**/project/*.scala" {
runner.dialect = scala212
}
"glob:**/*.sbt" {
runner.dialect = Sbt1
}
}

maxColumn = 120

# Note. Only for the truest vertical aligners. This is a new option,
# feel free to open PR enabling more crazy vertical alignment here.
# Expect changes.
align = most
align.openParenCallSite = false
align.openParenDefnSite = false
align.multiline = true
align.tokens."+" = [

align.tokens.add = [

{code = "<-", owner = "Enumerator.Generator"}
//Everything before the Term.Assign was the default regex. To find the
//default value, look through the code here:
//https://github.com/scalameta/scalafmt/blob/master/scalafmt-core/shared/src/main/scala/org/scalafmt/config/Align.scala
{code = "=", owner = "(Enumerator.Generator|Val|Defn.(Va(l|r)|Def|Type))|Term.Assign"}
{code = "<-", owner = "Enumerator.Generator"},

//used to align comments
"//"
# Everything before the Term.Assign was the default regex. To find the
# default value, look through the code here:
# https://github.com/scalameta/scalafmt/blob/master/scalafmt-core/shared/src/main/scala/org/scalafmt/config/Align.scala
{code = "=", owner = "(Enumerator.Generator|Val|Defn.(Va(l|r)|Def|Type))|Term.Assign|Param"},

//used for aligning type definition
":"

//used when creating tuples
{code = "->", owner = "Term.ApplyInfix"},
"//", # used to align comments
":", # used for aligning type definition
{code = "->", owner = "Term.ApplyInfix"}, # used to align tuples 1 -> 2

//sbt specific
{code = "%", owner = "Term.ApplyInfix"},
{code = "%%", owner = "Term.ApplyInfix"}
{code = "%%%", owner = "Term.ApplyInfix"}
{code = ":=", owner = "Term.ApplyInfix"}
{code = "withSources", owner = "Term.ApplyInfix"}
{code = "%%", owner = "Term.ApplyInfix"},
{code = "%%%", owner = "Term.ApplyInfix"},
{code = ":=", owner = "Term.ApplyInfix"},
{code = "withSources", owner = "Term.ApplyInfix"},
"extends"
]

###############################################################################

continuationIndent {
callSite = 2
defnSite = 2
Expand All @@ -76,12 +86,16 @@ continuationIndent {
withSiteRelativeToExtends = 0
}

###############################################################################

verticalMultiline.atDefnSite = false
verticalMultiline.newlineAfterOpenParen = true
verticalMultiline.arityThreshold = 3

###############################################################################

newlines {
alwaysBeforeTopLevelStatements = true
topLevelStatements = [before]
sometimesBeforeColonInMethodReturnType = true
penalizeSingleSelectMultiArgList = false
alwaysBeforeElseAfterCurlyIf = true
Expand All @@ -91,30 +105,35 @@ newlines {
afterCurlyLambda = squash
}

###############################################################################

spaces {
afterKeywordBeforeParen = true
}

###############################################################################

binPack {
parentConstructors = true
literalArgumentLists = true
literalsMinArgCount = 5
}

###############################################################################

optIn {
breaksInsideChains = false
//preserves existing newlines in . chain calls.
//See: optIn.breakChainOnFirstMethodDot = true
# preserves existing newlines in . chain calls.
# See: optIn.breakChainOnFirstMethodDot = true
breakChainOnFirstMethodDot = true
blankLineBeforeDocstring = true
}

###############################################################################

rewrite {
rules = [
SortImports
SortModifiers
# if your for has more than one single <- then it gets transformed into a multit-line curly brace one
PreferCurlyFors
AvoidInfix
RedundantBraces
Expand All @@ -127,40 +146,21 @@ rewrite.redundantBraces.methodBodies = true
rewrite.redundantBraces.includeUnitMethods = false
rewrite.redundantBraces.stringInterpolation = true
rewrite.redundantBraces.parensForOneLineApply = true
rewrite.neverInfix.excludeFilters = [withSources]

#we only really want to disable infix notation
# for map and flatMap and the like, because it
# kills IDE performance and type inference
rewrite.neverInfix.excludeFilters = [
until
to
by
eq
ne
"should.*"
"contain.*"
"must.*"
in
be
of # behaviour of ("X")
taggedAs
thrownBy
synchronized
have
when
size
theSameElementsAs
withSources
]
###############################################################################

preset = default
danglingParentheses.preset = true

###############################################################################

assumeStandardLibraryStripMargin = true
includeNoParensInSelectChains = false
includeCurlyBraceInSelectChains = true
trailingCommas = multiple

###############################################################################

runner {
optimizer {
Expand All @@ -171,4 +171,4 @@ runner {
# minimum number of func arguments before config-style (look at top of file) is enabled
forceConfigStyleMinArgCount = 2
}
}
}
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

# unreleased

# 0.3.0

This is the first release for a stable Scala 3 version, and with cats-effect 3 support!

### :warning: breaking
- `pureharm-db-testkit` now depends on cats-effect `3.2.1`, and the corresponding dependencies for it.
- `pureharm-db-testkit-ce2` is binary, and source compatible with `pureharm-db-testkit` from version `0.2.0`, so if you haven't migrated to CE3 yet, use the former module.

### Dependency upgrades
- [pureharm-core](https://github.com/busymachines/pureharm-core/releases) `0.3.0`
- [pureharm-effects-cats](https://github.com/busymachines/pureharm-effects-cats/releases) `0.5.0`
- [pureharm-testkit](https://github.com/busymachines/pureharm-testkit/releases) `0.4.0`
- [pureharm-db-core](https://github.com/busymachines/pureharm-db-core/releases) `0.5.0`
- [pureharm-db-flyway](https://github.com/busymachines/pureharm-db-flyway/releases) `0.6.0`

### New Scala versions:
- `2.13.6`
- `3.0.1` for JVM + JS platforms
- drop `3.0.0-RC2`, `3.0.0-RC3`

### internals
- bump scalafmt to `3.0.0-RC6` — from `2.7.5`
- bump sbt to `1.5.5`
- bump sbt-spiewak to `0.21.0`
- bump sbt-scalafmt to `2.4.3`
- bump sbt-scalajs-crossproject to `1.1.0`
- bump sbt-scalajs to `1.6.0`

# 0.2.0

### breaking changes:
Expand Down
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ See [changelog](./CHANGELOG.md).

We do not even pretend to support anything other than Postgresql.

## Scala versions
- `2.13`: JVM
- `3`: JVM

## modules

- `"com.busymachines" %% "pureharm-db-testkit" % "0.2.0"`. Which has these as its main dependencies:
- [pureharm-core-anomaly](https://github.com/busymachines/pureharm-core/releases) `0.2.0`
- [pureharm-core-sprout](https://github.com/busymachines/pureharm-core/releases) `0.2.0`
- [pureharm-core-identifiable](https://github.com/busymachines/pureharm-core/releases) `0.2.0`
- [pureharm-effects-cats](https://github.com/busymachines/pureharm-effects-cats/releases) `0.4.0`
- [pureharm-testkit](https://github.com/busymachines/pureharm-testkit/releases) `0.3.0`
- [pureharm-db-core](https://github.com/busymachines/pureharm-db-core/releases) `0.4.0`
- [pureharm-db-flyway](https://github.com/busymachines/pureharm-db-flyway/releases) `0.4.0`
- `"com.busymachines" %% "pureharm-db-test-data" % "0.2.0"`
- `"com.busymachines" %% "pureharm-db-testkit" % "0.3.0"`. Which has these as its main dependencies:
- [pureharm-core-anomaly](https://github.com/busymachines/pureharm-core/releases) `0.3.0`
- [pureharm-core-sprout](https://github.com/busymachines/pureharm-core/releases) `0.3.0`
- [pureharm-core-identifiable](https://github.com/busymachines/pureharm-core/releases) `0.3.0`
- [pureharm-effects-cats](https://github.com/busymachines/pureharm-effects-cats/releases) `0.5.0`
- [pureharm-testkit](https://github.com/busymachines/pureharm-testkit/releases) `0.4.0`
- [pureharm-db-core](https://github.com/busymachines/pureharm-db-core/releases) `0.5.0`
- [pureharm-db-flyway](https://github.com/busymachines/pureharm-db-flyway/releases) `0.6.0`
- `"com.busymachines" %% "pureharm-db-test-data" % "0.3.0"`
- used only for common tests between different DB modules

## usage
Expand Down
Loading

0 comments on commit 248be6e

Please sign in to comment.