-
Notifications
You must be signed in to change notification settings - Fork 6
Home
Welcome to the zorechka-bot wiki!
It's a clone of scala-steward bot, but for Bazel. If you don't know either of both, don't worry. I tried to pick up a simple (not toy) project which does something useful and can be done by one person in a reasonable time. So it's not a plain CRUD with one table and one service and I hope it can give you a better understanding of how real the project will look like if you decide to use ZIO Environment/ZLayer/ZTest, etc.
The ides behind the project is following: the app should read a configuration file with a list of GitHub repos to check, then it should get all scala artifacts with their dependencies, for each artifact it should check each dependency and either remove it (if it's unused) or update the version (if a newer version exists in Maven Central). The algorithm to check if dependency is unused is dumb, you try to remove it and see if project builds successfully (by running Bazel build command), but this operation is time-consuming, so we have to use a cache in DB (MySQL) to check if the BUILD file for artifact has been changed. In the end, the application should create a pull request with all dependency changes applied.
Here is the snippet for for main flow
for {
forkDir <- ZIO(Files.createTempDirectory(s"repos-${repo.owner}-${repo.name}"))
_ <- putStrLn(s"Forking in: ${forkDir.toAbsolutePath}")
repoPath = forkDir.resolve(repo.name)
_ <- GithubClient.cloneRepo(repo, forkDir)
forkData = ForkData(repo, repoPath)
updatedDeps <- ThirdPartyDepsAnalyzer.findLatest(forkData)
unusedDeps <- UnusedDepsAnalyser.findUnused(forkData)
_ <- ResultNotifier.notify(forkData.forkDir, updatedDeps, unusedDeps)
} yield ()
And here is the diagram of application dependencies:
If we look at the "leaves" services (e.g. services that don't depend on others), they will look like Module Pattern from the original post of John - http://degoes.net/articles/zio-environment