Skip to content

Add examples of mill + cask + scalasql #4924

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 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
a3db4d1
Add examples of mill + cask + scalasql
chaitanyawaikar Apr 12, 2025
5d3053f
[autofix.ci] apply automated fixes
autofix-ci[bot] Apr 12, 2025
6fd4641
Remove comment
chaitanyawaikar Apr 12, 2025
59f3845
Add documentation for example 10-todo-webapp-cask-scalasql
chaitanyawaikar Apr 12, 2025
f3a7d78
Introduce example for http4s + scalasql
chaitanyawaikar Apr 13, 2025
6e8c44c
[autofix.ci] apply automated fixes
autofix-ci[bot] Apr 13, 2025
dc6846e
Add documentation link for 11-todo-http4s-scalasql
chaitanyawaikar Apr 13, 2025
d39cc7d
Merge branch 'main' into feature/add_examples_with_scalasql
chaitanyawaikar Apr 13, 2025
cb409d3
Add tests and documentation for the module `11-todo-http-scalasql`
chaitanyawaikar Apr 13, 2025
0599fb4
[autofix.ci] apply automated fixes
autofix-ci[bot] Apr 13, 2025
0765a09
Merge branch 'main' into feature/add_examples_with_scalasql
chaitanyawaikar Apr 16, 2025
39a33ec
Add integration tests for `10-todo-webapp-cask-scalasql` module
chaitanyawaikar Apr 18, 2025
56eefc3
[autofix.ci] apply automated fixes
autofix-ci[bot] Apr 18, 2025
7d4049e
Changing build.mill to get rid of the CI error
chaitanyawaikar Apr 18, 2025
bcb32c5
[autofix.ci] apply automated fixes
autofix-ci[bot] Apr 18, 2025
750b540
Merge branch 'main' into feature/add_examples_with_scalasql
chaitanyawaikar Apr 27, 2025
ac52b64
Address review comment https://github.com/com-lihaoyi/mill/pull/4924/…
chaitanyawaikar Apr 27, 2025
6b4e6d3
Add integration tests and create a separate module
chaitanyawaikar Apr 27, 2025
5b7b8d8
[autofix.ci] apply automated fixes
autofix-ci[bot] Apr 27, 2025
1fb3288
Add integration tests for `10-todo-webapp-cask-scalasql` example
chaitanyawaikar Apr 27, 2025
afcaf55
Edit comment in build.mill file
chaitanyawaikar Apr 27, 2025
639a29b
Merge branch 'main' into feature/add_examples_with_scalasql
chaitanyawaikar Apr 28, 2025
0c53be7
Merge branch 'main' into feature/add_examples_with_scalasql
chaitanyawaikar May 2, 2025
a7a5508
Merge branch 'main' into feature/add_examples_with_scalasql
chaitanyawaikar May 21, 2025
83bd016
Merge branch 'main' into feature/add_examples_with_scalasql
chaitanyawaikar Jun 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions example/scalalib/web/10-todo-webapp-cask-scalasql/build.mill
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package build

import mill._, scalalib._

object `package` extends RootModule with ScalaModule {
def scalaVersion = "2.13.8"

override def ivyDeps = Agg(
ivy"com.lihaoyi::cask:0.9.1",
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?

)

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.

def testFramework = "utest.runner.Framework"

override def ivyDeps = Agg(
ivy"com.lihaoyi::utest:0.8.5",
ivy"com.lihaoyi::requests:0.6.9",
ivy"com.dimafeng::testcontainers-scala-postgresql:0.43.0",
ivy"com.dimafeng::testcontainers-scala-scalatest:0.43.0",
ivy"org.testcontainers:postgresql:1.19.1"
)
}
}

// This example demonstrates how to set up a simple Scala webserver
// implementing the popular Todo-MVC demo application. It uses the
// Cask web framework to handle HTTP requests and Scalasql to interact
// with an in-memory H2 database. It includes a test suite
// that spins up the web server locally, creates a postgres testcontainer
// and makes HTTP requests against it.

/** Usage
*
* > ./mill test
* + webapp.WebAppTests.simpleRequest...
*
* > ./mill runBackground
*
* > curl http://localhost:8080
* ...What needs to be done...
* ...
*
* > ./mill clean runBackground
*
*/
Loading
Loading