-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from bishabosha/add-CI
add CI
- Loading branch information
Showing
5 changed files
with
201 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
tags: | ||
- "v*" | ||
pull_request: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: coursier/[email protected] | ||
- uses: VirtusLab/[email protected] | ||
with: | ||
jvm: "8" | ||
power: true | ||
|
||
- name: Check formatting | ||
run: scala-cli fmt src project.scala --check | ||
|
||
- name: Run unit tests | ||
run: scala-cli test src project.scala --cross |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version = "3.7.14" | ||
runner.dialect = scala3 | ||
align.preset = more | ||
maxColumn = 100 | ||
indent.fewerBraces = never | ||
rewrite.scala3.convertToNewSyntax = true | ||
rewrite.scala3.removeOptionalBraces = yes | ||
rewrite.scala3.insertEndMarkerMinLines = 5 | ||
verticalMultiline.atDefnSite = true | ||
newlines.usingParamListModifierPrefer = before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package example | ||
|
||
import mirrorops.OpsMirror | ||
import mirrorops.Meta | ||
import compiletime.constValue | ||
import compiletime.constValueTuple | ||
|
||
class OpsMirrorSuite extends munit.FunSuite: | ||
import OpsMirrorSuite.* | ||
import OpMeta.* | ||
import ParamMeta.* | ||
|
||
class failsWith[E] extends mirrorops.ErrorAnnotation[E] | ||
|
||
enum BasicError: | ||
case Message(msg: String) | ||
|
||
enum OpMeta extends mirrorops.MetaAnnotation: | ||
case Streaming() | ||
case JSONBody() | ||
|
||
enum ParamMeta extends mirrorops.MetaAnnotation: | ||
case PrimaryKey() | ||
|
||
@failsWith[BasicError] | ||
trait BasicService: | ||
@Streaming | ||
@JSONBody | ||
def lookup(@PrimaryKey id: Long): String | ||
end BasicService | ||
|
||
test("summon mirror basic with annotations") { | ||
val mirror = summon[OpsMirror.Of[BasicService]] | ||
|
||
type FirstOp = Tuple.Head[mirror.MirroredOperations] | ||
|
||
summon[mirror.MirroredLabel =:= "BasicService"] | ||
summon[mirror.MirroredOperationLabels =:= ("lookup" *: EmptyTuple)] | ||
summon[Operation_Metadata[FirstOp] =:= (Meta @JSONBody, Meta @Streaming)] | ||
summon[Operation_InputLabels[FirstOp] =:= ("id" *: EmptyTuple)] | ||
summon[Operation_InputTypes[FirstOp] =:= (Long *: EmptyTuple)] | ||
summon[ | ||
Operation_InputMetadatas[FirstOp] =:= ((Meta @PrimaryKey *: EmptyTuple) *: EmptyTuple) | ||
] | ||
summon[Operation_ErrorType[FirstOp] =:= BasicError] | ||
summon[Operation_OutputType[FirstOp] =:= String] | ||
} | ||
end OpsMirrorSuite | ||
|
||
object OpsMirrorSuite: | ||
type Operation_Is[Ls <: Tuple] = mirrorops.Operation { type InputTypes = Ls } | ||
type Operation_Im[Ls <: Tuple] = mirrorops.Operation { | ||
type InputMetadatas = Ls | ||
} | ||
type Operation_M[Ls <: Tuple] = mirrorops.Operation { type Metadata = Ls } | ||
type Operation_Et[E] = mirrorops.Operation { type ErrorType = E } | ||
type Operation_Ot[T] = mirrorops.Operation { type OutputType = T } | ||
type Operation_IL[Ls <: Tuple] = mirrorops.Operation { type InputLabels = Ls } | ||
type Operation_InputLabels[Op] = Op match | ||
case Operation_IL[ls] => ls | ||
type Operation_InputTypes[Op] = Op match | ||
case Operation_Is[ls] => ls | ||
type Operation_ErrorType[Op] = Op match | ||
case Operation_Et[ls] => ls | ||
type Operation_OutputType[Op] = Op match | ||
case Operation_Ot[ls] => ls | ||
type Operation_InputMetadatas[Op] = Op match | ||
case Operation_Im[ls] => ls | ||
type Operation_Metadata[Op] = Op match | ||
case Operation_M[ls] => ls | ||
end OpsMirrorSuite |