8000 Add examples of mill + cask + scalasql by chaitanyawaikar · Pull Request #4924 · com-lihaoyi/mill · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
< 8000 ul class="pagehead-actions flex-shrink-0 d-none d-md-inline" style="padding: 2px 0;">
  • Notifications You must be signed in to change notification settings
  • Fork 403
  • Add examples of mill + cask + scalasql #4924

    8000
    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

    Open
    wants to merge 23 commits into
    base: main
    Choose a base branch
    from

    Conversation

    chaitanyawaikar
    Copy link
    @chaitanyawaikar chaitanyawaikar commented Apr 12, 2025

    Description

    This PR solves the issue #4799. It includes creation of two new examples of the very popular TODO MVC app

    1. Cask + Scalasql as example 10-todo-webapp-cask-scalasql
    2. Http4s + Scalasql as example 11-todo-http4s-scalasql

    Unit tests, integration tests and a short documentation have been added for each of these modules.

    Commands to run the examples

    # From the root directory
    
    ./mill "example.scalalib.web[11-todo-http4s-scalasql].local.server"
    
    ./mill "example.scalalib.web[10-todo-webapp-cask-scalasql].local.server"

    @chaitanyawaikar chaitanyawaikar changed the title [WIP] Add examples of mill + cask + scalasql Add examples of mill + cask + scalasql Apr 13, 2025
    @chaitanyawaikar chaitanyawaikar marked this pull request as ready for review April 13, 2025 13:24
    ivy"com.h2database:h2:2.2.224"
    )

    object test extends ScalaTests {
    Copy link
    Member

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Let's have one test suite using H2 in memory and one integration suite using PostgreSQL via testcontainers.

    Copy link
    Author

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    @lihaoyi
    Copy link
    Member
    lihaoyi commented Apr 16, 2025

    @chaitanyawaikar left some comments but otherwise looks reasonable

    chaitanyawaikar and others added 4 commits April 18, 2025 18:20
    "[6549-0]   [error] -- [E8] /home/runner/work/mill/mill/out/example/scalalib/web/11-todo-http4s-scalasql/native/server/testForked.dest/worker-0/sandbox/run-2/build.mill:7:5
    [6549-0]   [error] 7 ?    ivy"org.http4s::http4s-ember-server::0.23.30",
    [6549-0]   [error]   ?    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    [6549-0]   [error]   ?value ivy is not a member of StringContext, but could be made available as an extension method.
    [6549-0]   [error]   ?
    [6549-0]   [error]   ?One of the following imports might fix the problem:
    [6549-0]   [error]   ?
    [6549-0]   [error]   ?  import coursier.ivyRepositoryString
    [6549-0]   [error]   ?  import coursier.util.StringInterpolators.SafeIvyRepository
    [6549-0]   [error]   ?
    [6549-0]   [error]   ?
    [6549-0]   [error] -- [E8] /home/runner/work/mill/mill/out/example/scalalib/web/11-todo-http4s-scalasql/native/server/testForked.dest/worker-0/sandbox/run-2/build.mill:8:5"
    @lefou
    Copy link
    Member
    lefou commented Apr 26, 2025

    Are these apps written from scratch or did you copy them from somewhere else? If they are copies, you should add a comment where they come from, which version you used and under which license they were shared.

    @chaitanyawaikar
    Copy link
    Author

    Are these apps written from scratch or did you copy them from somewhere else? If they are copies, you should add a comment where they come from, which version you used and under which license they were shared.

    These apps are written from scratch. I checked the pattern of other examples written under /scalalib/web

    @lihaoyi
    Copy link
    Member
    lihaoyi commented Apr 27, 2025

    @chaitanyawaikar let me know when you want me to review this again, l'm not seeing the separate object integration test module and the leftover mill file is still there so I assume you're still working on it

    @chaitanyawaikar
    Copy link
    Author
    chaitanyawaikar commented Apr 27, 2025

    @chaitanyawaikar let me know when you want me to review this again, l'm not seeing the separate object integration test module and the leftover mill file is still there so I assume you're still working on it

    @lihaoyi yes, I will try to complete this in 1-2 days. I am facing many issues running integration tests locally, hence started pushing code to remote CI server.

    It may sound a bit trivial, but could you please let me know how to run the integration tests from within the examples ? I tried the following commands

    # From inside the example ../mill/example/scalalib/web/10-todo-webapp-cask-scalasql
    ./mill __.test
    
    # From the root project directory
    ./mill "example.scalalib.web.`10-todo-webapp-cask-scalasql`.test"

    and none of them run only the integration tests only for that module.

    However, running the complete test suite locally however crashes my system and this is slowing me down considerably. Any inputs here would be highly helpful to bring this to completion. Thank you 🙏

    @lihaoyi
    Copy link
    Member
    lihaoyi commented Apr 27, 2025

    @chaitanyawaikar the developer.md docs have the syntax

    ./mill "example.javalib.basic[1-simple].local.server"

    @chaitanyawaikar
    Copy link
    Author

    @chaitanyawaikar let me know when you want me to review this again, l'm not seeing the separate object integration test module and the leftover mill file is still there so I assume you're still working on it

    The review comments have been addressed. Feel free to review them once again.

    Comment on lines +22 to +26
    def scalaVersion = `package`.scalaVersion
    override def repositories = super.repositories ++ Seq(
    coursier.MavenRepository("https://oss.sonatype.org/content/repositories/snapshots")
    )
    override def moduleDeps = Seq(`package`)
    Copy link
    Member

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    None of these are necessary, why are they here?

    }

    /** Unit tests using H2 */
    trait TestModule extends TestBase with ScalaTests {
    Copy link
    Member

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    No need separate traits, just put these definitions in the objects

    ivy"com.lihaoyi::scalatags:0.13.1",
    ivy"com.lihaoyi::upickle:3.1.0",
    ivy"com.lihaoyi::scalasql:0.1.19",
    ivy"com.h2database:h2:2.2.224"
    Copy link
    Member

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Does the root module really need h2database when it is only used in the unit tests?

    Dep.parse(ivy"org.http4s::http4s-scalatags::0.25.2", scalaVersion()).right.get,
    Dep.parse(ivy"io.circe::circe-generic::0.14.10", scalaVersion()).right.get,
    Dep.parse(ivy"com.lihaoyi::scalasql:0.1.19", scalaVersion()).right.get,
    Dep.parse(ivy"com.h2database:h2:2.2.224", scalaVersion()).right.get
    Copy link
    Member

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Why this Dep.parse.right.get stuff?

    @lihaoyi
    Copy link
    Member
    lihaoyi commented Apr 27, 2025

    Left some comments. build.mill files generally need a cleanup, please cross-reference them to the existing cask/http4s examples as well as the spring-boot and micronaut examples and follow the existing conventions.

    Your example build.mill files appear to be missing Usage blocks. Again, please follow the existing examples and define them appropriately

    Lastly, lets replace the existing Cask and Http4s examples with your new ones, rather than simply adding them on. The existing examples aren't really necessary once the new examples are in shape

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    None yet
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants
    0