Skip to content

Commit 8eda8bf

Browse files
authored
4-prepare-the-project-for-release (#14)
#4: Prepare the project for release * project separated into modules: core, slick, examples * added workflows * removed wrong packages that remained after previous merge * fixed headers * disabled example tests as they are not idempotent
1 parent 5c6f641 commit 8eda8bf

File tree

54 files changed

+202
-1354
lines changed

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

+202
-1354
lines changed

.editorconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#
2-
# Copyright 2021 ABSA Group Limited
2+
# Copyright 2022 ABSA Group Limited
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
66
# You may obtain a copy of the License at
7+
#
78
# http://www.apache.org/licenses/LICENSE-2.0
89
#
910
# Unless required by applicable law or agreed to in writing, software

.gitattributes

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#
2-
# Copyright 2021 ABSA Group Limited
2+
# Copyright 2022 ABSA Group Limited
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
66
# You may obtain a copy of the License at
7+
#
78
# http://www.apache.org/licenses/LICENSE-2.0
89
#
910
# Unless required by applicable law or agreed to in writing, software

.github/WORKFLOWS/build.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#
2+
# Copyright 2022 ABSA Group Limited
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
name: Build
18+
19+
on:
20+
push:
21+
branches: [master ]
22+
pull_request:
23+
branches: [ master ]
24+
types: [ assigned, opened, synchronize, reopened, labeled ]
25+
26+
jobs:
27+
test:
28+
runs-on: ubuntu-latest
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
scala: [2.11.12, 2.12.12]
33+
name: Build on Scala ${{matrix.scala}}
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v2
37+
- uses: coursier/cache-action@v5
38+
- name: Setup Scala
39+
uses: olafurpg/setup-scala@v10
40+
with:
41+
java-version: "[email protected]"
42+
- name: Build and run tests
43+
run: sbt ++${{matrix.scala}} test

.github/WORKFLOWS/license_check.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#
2-
# Copyright 2018 ABSA Group Limited
2+
# Copyright 2022 ABSA Group Limited
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
66
# You may obtain a copy of the License at
7+
#
78
# http://www.apache.org/licenses/LICENSE-2.0
89
#
910
# Unless required by applicable law or agreed to in writing, software
@@ -17,6 +18,19 @@ name: License Check
1718

1819
on:
1920
push:
20-
branches: [ master ]
21+
branches: [ main, develop, master ]
2122
pull_request:
2223
branches: [ master ]
24+
types: [ assigned, opened, synchronize, reopened, labeled ]
25+
26+
jobs:
27+
license-test:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v2
32+
- name: Setup Scala
33+
uses: olafurpg/setup-scala@v10
34+
with:
35+
java-version: "[email protected]"
36+
- run: sbt headerCheck

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#
2-
# Copyright 2021 ABSA Group Limited
2+
# Copyright 2022 ABSA Group Limited
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
66
# You may obtain a copy of the License at
7+
#
78
# http://www.apache.org/licenses/LICENSE-2.0
89
#
910
# Unless required by applicable law or agreed to in writing, software

build.sbt

Lines changed: 47 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
2-
* Copyright 2021 ABSA Group Limited
2+
* Copyright 2022 ABSA Group Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7+
*
78
* http://www.apache.org/licenses/LICENSE-2.0
89
*
910
* Unless required by applicable law or agreed to in writing, software
@@ -13,33 +14,56 @@
1314
* limitations under the License.
1415
*/
1516

16-
ThisBuild / name := "fa-db"
17-
ThisBuild / organization := "za.co.absa"
17+
ThisBuild / organization := "za.co.absa.fa-db"
1818

1919
lazy val scala211 = "2.11.12"
2020
lazy val scala212 = "2.12.12"
2121

2222
ThisBuild / scalaVersion := scala211
2323
ThisBuild / crossScalaVersions := Seq(scala211, scala212)
24-
ThisBuild / publish := {}
25-
26-
libraryDependencies ++= List(
27-
28-
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
29-
//"org.tpolecat" %% "skunk-core" % "0.2.0",
30-
// "org.scalikejdbc" %% "scalikejdbc" % "3.4.+",
31-
// "com.h2database" % "h2" % "1.4.+",
32-
// "ch.qos.logback" % "logback-classic" % "1.2.+",
33-
34-
"com.typesafe.slick" %% "slick" % "3.3.3",
35-
"org.slf4j" % "slf4j-nop" % "1.6.4",
36-
"com.typesafe.slick" %% "slick-hikaricp" % "3.3.3",
37-
"org.postgresql" % "postgresql" % "9.4-1206-jdbc42",
38-
//
39-
// "io.github.finagle" %% "finagle-postgres" % "0.13.0",
40-
41-
"org.scalatest" %% "scalatest" % "3.2.9" % Test,
42-
"org.scalamock" %% "scalamock" % "5.1.0" % Test
43-
)
24+
25+
import Dependencies._
26+
27+
ThisBuild/resolvers += Resolver.mavenLocal + "Local Maven" at Path.userHome.asFile.toURI.toURL + ".m2/repository"
28+
29+
lazy val printScalaVersion = taskKey[Unit]("Print Scala versions faDB is being built for.")
30+
31+
ThisBuild / printScalaVersion := {
32+
val log = streams.value.log
33+
log.info(s"Building with Scala ${scalaVersion.value}")
34+
log.info(s"Local maven ${Resolver.mavenLocal}")
35+
}
36+
37+
lazy val parent = (project in file("."))
38+
.aggregate(faDbCore, faDBSlick, faDBExamples)
39+
.settings(
40+
name := "root",
41+
libraryDependencies ++= rootDependencies(scalaVersion.value),
42+
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint"),
43+
publish / skip := true
44+
)
45+
46+
lazy val faDbCore = (project in file("core"))
47+
.settings(
48+
name := "core",
49+
libraryDependencies ++= coreDependencies(scalaVersion.value),
50+
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value // printScalaVersion is run with compile
51+
)
52+
53+
lazy val faDBSlick = (project in file("slick"))
54+
.settings(
55+
name := "slick",
56+
libraryDependencies ++= slickDependencies(scalaVersion.value),
57+
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value // printScalaVersion is run with compile
58+
).dependsOn(faDbCore)
59+
60+
lazy val faDBExamples = (project in file("examples"))
61+
.settings(
62+
name := "examples",
63+
libraryDependencies ++= examplesDependencies(scalaVersion.value),
64+
Test / parallelExecution := false,
65+
(Compile / compile) := ((Compile / compile) dependsOn printScalaVersion).value, // printScalaVersion is run with compile
66+
publish / skip := true
67+
).dependsOn(faDbCore, faDBSlick)
4468

4569
releasePublishArtifactsAction := PgpKeys.publishSigned.value

src/main/scala/za/co/absa/fadb/DBExecutor.scala renamed to core/src/main/scala/za/co/absa/fadb/DBExecutor.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7+
*
78
* http://www.apache.org/licenses/LICENSE-2.0
89
*
910
* Unless required by applicable law or agreed to in writing, software

src/main/scala/za/co/absa/fadb/DBFunction.scala renamed to core/src/main/scala/za/co/absa/fadb/DBFunction.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
2-
* Copyright 2021 ABSA Group Limited
2+
* Copyright 2022 ABSA Group Limited
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7+
*
78
* http://www.apache.org/licenses/LICENSE-2.0
89
*
910
* Unless required by applicable law or agreed to in writing, software

src/main/scala/za/co/absa/fadb/DBSchema.scala renamed to core/src/main/scala/za/co/absa/fadb/DBSchema.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7+
*
78
* http://www.apache.org/licenses/LICENSE-2.0
89
*
910
* Unless required by applicable law or agreed to in writing, software
@@ -28,7 +29,7 @@ import scala.concurrent.ExecutionContext.Implicits.global
2829
* @param schemaNameOverride - in case the class name would not match the database schema name, this gives the
2930
* possibility of override
3031
* @param namingConvention - the [[NamingConvention]] prescribing how to convert a class name into a db object name
31-
* @tparam E - the engine of the executor type, e.g. Slick [[Database]]
32+
* @tparam E - the engine of the executor type, e.g. Slick Database
3233
*/
3334
abstract class DBSchema[E](val executor: DBExecutor[E], schemaNameOverride: Option[String] = None)
3435
(implicit namingConvention: NamingConvention) {

src/main/scala/za/co/absa/fadb/exceptions/DBFailException.scala renamed to core/src/main/scala/za/co/absa/fadb/exceptions/DBFailException.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
7+
*
78
* http://www.apache.org/licenses/LICENSE-2.0
89
*
910
* Unless required by applicable law or agreed to in writing, software

0 commit comments

Comments
 (0)