Skip to content

Commit

Permalink
ci(iris): add format and testing for iris service PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Baliasnikov committed Nov 9, 2022
1 parent 6d51df0 commit ec3d4a7
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions iris/service/build.sbt
Expand Up @@ -77,8 +77,8 @@ lazy val server = commonProject(project)
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
//runClean,
//runTest,
runClean,
runTest,
setReleaseVersion,
ReleaseStep(releaseStepTask(server / Docker / publish)),
setNextVersion
Expand Down
Expand Up @@ -5,5 +5,5 @@ import io.iohk.atala.iris.core.model.ledger.Block

trait ROBlocksRepository[F[_]] {
def getFullBlock(blockNo: Int): F[Either[BlockError.NotFound, Block.Full]]
def getLatestBlock: F[Either[BlockError.NoneAvailable.type , Block.Canonical]]
def getLatestBlock: F[Either[BlockError.NoneAvailable.type, Block.Canonical]]
}
Expand Up @@ -2,11 +2,10 @@ package io.iohk.atala.iris.core.repository

import zio.*

/** This component intended to run several combined repository operations in one database transaction.
* The idea to have repositories traits instantiated with IOConnection and ZIO monads.
* Former to make possible to combine several operations in one DB transaction,
* latter to run repository operations without additional hustle.
*/
/** This component intended to run several combined repository operations in one database transaction. The idea to have
* repositories traits instantiated with IOConnection and ZIO monads. Former to make possible to combine several
* operations in one DB transaction, latter to run repository operations without additional hustle.
*/
trait DbRepositoryTransactor[F[_]] {
def runAtomically[A](action: F[A]): Task[A]
}
Expand Up @@ -14,10 +14,11 @@ trait ROIrisBatchesRepository[S[_]] {
def getIrisBatchesStream(lastSeen: Option[TransactionId]): S[ConfirmedIrisBatch]
}

/**
* @tparam F represents a monad where CRUD requests are executed
* @tparam S represents a monad for streaming of data
*/
/** @tparam F
* represents a monad where CRUD requests are executed
* @tparam S
* represents a monad for streaming of data
*/
trait IrisBatchesRepository[F[_], S[_]] extends ROIrisBatchesRepository[S] {
def saveIrisBatch(irisBatch: ConfirmedIrisBatch): F[Unit]
}
Expand Up @@ -23,6 +23,6 @@ class InMemoryIrisBatchesRepository(list: Ref[Vector[ConfirmedIrisBatch]])

override def getIrisBatchesStream(lastSeen: Option[TransactionId]): StreamZIO[ConfirmedIrisBatch] =
ZStream.fromIterableZIO(list.get)

def getConfirmedBatches: Task[Vector[ConfirmedIrisBatch]] = list.get
}
3 changes: 2 additions & 1 deletion iris/service/project/Dependencies.scala
Expand Up @@ -52,7 +52,8 @@ object Dependencies {
private lazy val zioTestMagnolia = "dev.zio" %% "zio-test-magnolia" % "2.0.2" % Test

// Dependency Modules
private lazy val baseDependencies: Seq[ModuleID] = Seq(zio, zioConfig, zioConfigMagnolia, zioConfigTypesafe, zioStream, prismCrypto, shared, enumeratum)
private lazy val baseDependencies: Seq[ModuleID] =
Seq(zio, zioConfig, zioConfigMagnolia, zioConfigTypesafe, zioStream, prismCrypto, shared, enumeratum)
private lazy val grpcDependencies: Seq[ModuleID] = Seq(grpcNetty, grpcServices, scalaPbProto, scalaPbGrpc)
private lazy val doobieDependencies: Seq[ModuleID] = Seq(doobiePostgres, doobieHikari)
private lazy val circeDependencies: Seq[ModuleID] =
Expand Down
Expand Up @@ -74,7 +74,7 @@ object BlockchainModule {
object RepoModule {
val transactorLayer: TaskLayer[Transactor[Task]] = {
val layerWithConfig = ZLayer.fromZIO {
ZIO.service[AppConfig].map(_.iris.database).flatMap { config =>
ZIO.service[AppConfig].map(_.iris.database).flatMap { config =>
Dispatcher[Task].allocated.map { case (dispatcher, _) =>
given Dispatcher[Task] = dispatcher
TransactorLayer.hikari[Task](
Expand Down
Expand Up @@ -30,7 +30,7 @@ class IrisServiceGrpcImpl(service: PublishingScheduler, batchRepo: ROIrisBatches
document = Some(DocumentDefinition(publicKeys = Seq(), services = Seq()))
)
)

override def scheduleOperation(request: proto.IrisOperation): Future[IrisOperationOutcome] = Unsafe.unsafe {
implicit unsafe =>
runtime.unsafe.runToFuture(ZIO.succeed(IrisOperationOutcome(mockOperationId)))
Expand Down

0 comments on commit ec3d4a7

Please sign in to comment.