Skip to content

Commit 66dcd07

Browse files
committed
Merge remote-tracking branch 'origin/main' into use_munit_cats_effect
2 parents a8184b6 + e0a3105 commit 66dcd07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1552
-1228
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ concurrency:
2424

2525
jobs:
2626
build:
27-
name: Build and Test
27+
name: Test
2828
strategy:
2929
matrix:
30-
os: [ubuntu-latest]
30+
os: [ubuntu-22.04]
3131
scala: [2.12, 2.13, 3]
3232
java: [temurin@11]
3333
runs-on: ${{ matrix.os }}
3434
timeout-minutes: 60
3535
steps:
36-
- name: Install sbt
37-
uses: sbt/setup-sbt@v1
38-
3936
- name: Checkout current branch (full)
4037
uses: actions/checkout@v4
4138
with:
4239
fetch-depth: 0
4340

41+
- name: Setup sbt
42+
uses: sbt/setup-sbt@v1
43+
4444
- name: Setup Java (temurin@11)
4545
id: setup-java-temurin-11
4646
if: matrix.java == 'temurin@11'
@@ -64,25 +64,25 @@ jobs:
6464
run: sbt githubWorkflowCheck
6565

6666
- name: Check formatting
67-
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest'
67+
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
6868
run: sbt '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck
6969

7070
- name: Test
7171
run: sbt '++ ${{ matrix.scala }}' freeGen2 test
7272

7373
- name: Check binary compatibility
74-
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest'
74+
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
7575
run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues
7676

7777
- name: Generate API documentation
78-
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest'
78+
if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-22.04'
7979
run: sbt '++ ${{ matrix.scala }}' doc
8080

8181
- name: Check there are no uncommitted changes in git (to catch generated files that weren't committed)
8282
run: sbt '++ ${{ matrix.scala }}' checkGitNoUncommittedChanges
8383

84-
- name: Check Doc Site (2.13.14 only)
85-
if: matrix.scala == '2.13.14'
84+
- name: Check Doc Site (2.13 only)
85+
if: matrix.scala == '2.13'
8686
run: sbt '++ ${{ matrix.scala }}' docs/makeSite
8787

8888
- name: Make target directories
@@ -106,18 +106,18 @@ jobs:
106106
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
107107
strategy:
108108
matrix:
109-
os: [ubuntu-latest]
109+
os: [ubuntu-22.04]
110110
java: [temurin@11]
111111
runs-on: ${{ matrix.os }}
112112
steps:
113-
- name: Install sbt
114-
uses: sbt/setup-sbt@v1
115-
116113
- name: Checkout current branch (full)
117114
uses: actions/checkout@v4
118115
with:
119116
fetch-depth: 0
120117

118+
- name: Setup sbt
119+
uses: sbt/setup-sbt@v1
120+
121121
- name: Setup Java (temurin@11)
122122
id: setup-java-temurin-11
123123
if: matrix.java == 'temurin@11'
@@ -190,18 +190,18 @@ jobs:
190190
if: github.event.repository.fork == false && github.event_name != 'pull_request'
191191
strategy:
192192
matrix:
193-
os: [ubuntu-latest]
193+
os: [ubuntu-22.04]
194194
java: [temurin@11]
195195
runs-on: ${{ matrix.os }}
196196
steps:
197-
- name: Install sbt
198-
uses: sbt/setup-sbt@v1
199-
200197
- name: Checkout current branch (full)
201198
uses: actions/checkout@v4
202199
with:
203200
fetch-depth: 0
204201

202+
- name: Setup sbt
203+
uses: sbt/setup-sbt@v1
204+
205205
- name: Setup Java (temurin@11)
206206
id: setup-java-temurin-11
207207
if: matrix.java == 'temurin@11'

.mergify.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ pull_request_rules:
1010
conditions:
1111
- author=scala-steward
1212
- body~=labels:.*early-semver-patch
13-
- status-success=Build and Test (ubuntu-latest, 2.12, temurin@11)
14-
- status-success=Build and Test (ubuntu-latest, 2.13, temurin@11)
15-
- status-success=Build and Test (ubuntu-latest, 3, temurin@11)
13+
- status-success=Test (ubuntu-22.04, 2.12, temurin@11)
14+
- status-success=Test (ubuntu-22.04, 2.13, temurin@11)
15+
- status-success=Test (ubuntu-22.04, 3, temurin@11)
1616
actions:
1717
merge: {}
1818
- name: Label bench PRs
@@ -161,9 +161,9 @@ pull_request_rules:
161161
remove: []
162162
- name: merge-when-ci-pass
163163
conditions:
164-
- status-success=Build and Test (ubuntu-latest, 2.12, temurin@11)
165-
- status-success=Build and Test (ubuntu-latest, 2.13, temurin@11)
166-
- status-success=Build and Test (ubuntu-latest, 3, temurin@11)
164+
- status-success=Test (ubuntu-22.04, 2.12, temurin@11)
165+
- status-success=Test (ubuntu-22.04, 2.13, temurin@11)
166+
- status-success=Test (ubuntu-22.04, 3, temurin@11)
167167
- label=merge-on-build-success
168168
actions:
169169
merge: {}

CONTRIBUTING.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,27 @@ Running the tests or building the documentation site requires connection to the
88
which you can spin up using docker-compose:
99

1010
```
11-
docker-compose up -d --force-update
11+
docker compose up -d --force-recreate
1212
```
1313

14-
After that, in SBT you can run `test` to run tests, and `makeSite` to build the doc site
14+
Note: If you're using Apple Silicone Macbooks (M1, M2, etc), you need to enable "Use Rosetta for x86_64/amd64 emulation on Apple Silicon" since there is no ARM64 image for postgis yet.
1515

16-
If you're editing code generation related code, you should reload the SBT project and then run the `freeGen2` SBT task
17-
before compiling or running tests.
16+
With the containers started, SBT you can run `test` to run tests, and `makeSite` to build the doc site.
17+
18+
## Fixing warnings
19+
20+
To improve code quality and bug, we enable many stricter scala compiler flags via the
21+
[sbt-tpolecat](https://github.com/typelevel/sbt-tpolecat) plugin and in CI all warnings will be treated as errors.
22+
23+
For a more pleasant development experience, we default to `tpolecatDevMode` so warnings do not cause compilation errors.
24+
You can use the sbt command `tpolecatCiMode` to enable strict mode and help catch any warnings you missed.
1825

1926
## Caveats when working on the code
2027

2128
## Avoiding internal cyclic module dependencies
2229

2330
For end users, doobie provides the aliases for high and low level APIs
24-
such as `doobie.hi.HC`, `doobie.free.FPS`.
31+
such as `doobie.hi.HC`, `doobie.free.FPS`.
2532
Due to how the module depends on one another, internally in doobie we cannot use
2633
these aliases because it'll lead to cyclic module dependencies and cause runtime errors.
2734

@@ -49,6 +56,3 @@ To update the doc site, check out the tag first.
4956
git checkout v1.2.3
5057
sbt docs/publishMicrosite
5158
```
52-
53-
54-

build.sbt

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,25 @@ import org.typelevel.sbt.tpolecat.{DevMode, CiMode}
44

55
// Library versions all in one place, for convenience and sanity.
66
lazy val catsVersion = "2.12.0"
7-
lazy val catsEffectVersion = "3.5.6"
7+
lazy val catsEffectVersion = "3.5.7"
88
lazy val circeVersion = "0.14.10"
99
lazy val fs2Version = "3.11.0"
1010
lazy val h2Version = "1.4.200"
1111
lazy val hikariVersion = "6.2.1" // N.B. Hikari v4 introduces a breaking change via slf4j v2
1212
lazy val kindProjectorVersion = "0.11.2"
13-
lazy val mysqlVersion = "9.1.0"
13+
lazy val mysqlVersion = "9.2.0"
1414
lazy val log4catsVersion = "2.7.0"
1515
lazy val postGisVersion = "2024.1.0"
1616
lazy val postgresVersion = "42.7.4"
17-
lazy val refinedVersion = "0.11.2"
17+
lazy val refinedVersion = "0.11.3"
1818
lazy val scalaCheckVersion = "1.15.4"
1919
lazy val scalatestVersion = "3.2.18"
20-
lazy val munitVersion = "1.0.2"
20+
lazy val munitVersion = "1.0.4"
2121
lazy val shapelessVersion = "2.3.12"
2222
lazy val silencerVersion = "1.7.1"
23-
lazy val specs2Version = "4.20.7"
24-
lazy val scala212Version = "2.12.19"
25-
lazy val scala213Version = "2.13.14"
23+
lazy val specs2Version = "4.20.9"
24+
lazy val scala212Version = "2.12.20"
25+
lazy val scala213Version = "2.13.15"
2626
lazy val scala3Version = "3.3.4"
2727
// scala-steward:off
2828
lazy val slf4jVersion = "1.7.36"
@@ -33,6 +33,7 @@ lazy val weaverVersion = "0.8.4"
3333
ThisBuild / tlBaseVersion := "1.0"
3434
ThisBuild / tlCiReleaseBranches := Seq("main") // publish snapshots on `main`
3535
ThisBuild / tlCiScalafmtCheck := true
36+
//ThisBuild / scalaVersion := scala212Version
3637
ThisBuild / scalaVersion := scala213Version
3738
//ThisBuild / scalaVersion := scala3Version
3839
ThisBuild / crossScalaVersions := Seq(scala212Version, scala213Version, scala3Version)
@@ -68,8 +69,8 @@ ThisBuild / githubWorkflowBuildPostamble ++= Seq(
6869
),
6970
WorkflowStep.Sbt(
7071
commands = List("docs/makeSite"),
71-
name = Some(s"Check Doc Site ($scala213Version only)"),
72-
cond = Some(s"matrix.scala == '$scala213Version'")
72+
name = Some(s"Check Doc Site (2.13 only)"),
73+
cond = Some(s"matrix.scala == '2.13'")
7374
)
7475
)
7576

@@ -98,9 +99,12 @@ lazy val compilerFlags = Seq(
9899
Compile / doc / scalacOptions --= Seq(
99100
"-Xfatal-warnings"
100101
),
101-
// Test / scalacOptions --= Seq(
102-
// "-Xfatal-warnings"
103-
// ),
102+
// Disable warning when @nowarn annotation isn't suppressing a warning
103+
// to simplify cross-building
104+
// because 2.12 @nowarn doesn't actually do anything.. https://github.com/scala/bug/issues/12313
105+
scalacOptions ++= Seq(
106+
"-Wconf:cat=unused-nowarn:s"
107+
),
104108
scalacOptions ++= (if (tlIsScala3.value)
105109
// Handle irrefutable patterns in for comprehensions
106110
Seq("-source:future", "-language:adhocExtensions")
@@ -249,8 +253,7 @@ lazy val core = project
249253
).filterNot(_ => tlIsScala3.value) ++ Seq(
250254
"org.tpolecat" %% "typename" % "1.1.0",
251255
"com.h2database" % "h2" % h2Version % "test",
252-
"org.postgresql" % "postgresql" % postgresVersion % "test",
253-
"org.mockito" % "mockito-core" % "5.12.0" % Test
256+
"org.postgresql" % "postgresql" % postgresVersion % "test"
254257
),
255258
Compile / unmanagedSourceDirectories += {
256259
val sourceDir = (Compile / sourceDirectory).value
@@ -493,7 +496,12 @@ lazy val bench = project
493496
.enablePlugins(NoPublishPlugin)
494497
.enablePlugins(AutomateHeaderPlugin)
495498
.enablePlugins(JmhPlugin)
496-
.dependsOn(core, postgres)
499+
.settings(
500+
libraryDependencies ++= (if (scalaVersion.value == scala212Version)
501+
Seq("org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0")
502+
else Seq.empty)
503+
)
504+
.dependsOn(core, postgres, hikari)
497505
.settings(doobieSettings)
498506

499507
lazy val docs = project
@@ -539,6 +547,7 @@ lazy val docs = project
539547
"scalaVersion" -> scalaVersion.value
540548
),
541549
mdocIn := baseDirectory.value / "src" / "main" / "mdoc",
550+
mdocExtraArguments ++= Seq("--no-link-hygiene"),
542551
Compile / paradox / sourceDirectory := mdocOut.value,
543552
makeSite := makeSite.dependsOn(mdoc.toTask("")).value
544553
)

docker-compose.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '3.1'
1+
version: "3.1"
22

33
services:
44
postgres:
@@ -16,9 +16,8 @@ services:
1616
limits:
1717
memory: 500M
1818

19-
2019
mysql:
21-
image: mysql:8.0-debian
20+
image: mysql:8.0
2221
environment:
2322
MYSQL_ROOT_PASSWORD: password
2423
MYSQL_DATABASE: world

init/postgres/test-db.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ create extension postgis;
66
create extension hstore;
77
create type myenum as enum ('foo', 'bar', 'invalid');
88

9+
create schema other_schema;
10+
11+
set search_path to other_schema;
12+
13+
create type other_enum as enum ('a', 'b');
14+
15+
set search_path to public;
16+
917
--
1018
-- The sample data used in the world database is Copyright Statistics
1119
-- Finland, http://www.stat.fi/worldinfigures.

0 commit comments

Comments
 (0)