Skip to content

Commit

Permalink
Reorganize build.sbt. Add coverage tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosedp committed Sep 17, 2021
1 parent b81eef0 commit 938db73
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 49 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,11 @@ jobs:
with:
java-version: '11'
distribution: 'adopt'
- name: Run tests
- name: Run tests for all versions
run: sbt +test

- name: Run code coverage
run: sbt clean coverage test coverageReport
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76 changes: 63 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,66 @@
out/
target/
project/target
project/project
docs/generated
.addons-dont-touch
/lib/
/test_lib/
/testbuild/
obj_dir
test_run_dir
generated
# Scala .gitignore
#
# JARs aren't checked in, they are fetched by sbt
#
/lib/*.jar
/test/files/codelib/*.jar
/test/files/lib/*.jar
/test/files/speclib/instrumented.jar
/tools/*.jar

# Developer specific properties
/build.properties
/buildcharacter.properties

# might get generated when testing Jenkins scripts locally
/jenkins.properties

# target directory for build
/build/

# other
/out/
/bin/
/sandbox/

# intellij
/src/intellij*/*.iml
/src/intellij*/*.ipr
/src/intellij*/*.iws
**/.cache
/.idea
/.settings

# vscode
/.vscode

# Standard symbolic link to build/quick/bin
/qbin

# sbt's target directories
/target/
/project/**/target/
/test/macro-annot/target/
/test/files/target/
/test/target/
/build-sbt/
local.sbt
jitwatch.out

# Used by the restarr/restarrFull commands as target directories
/build-restarr/
/target-restarr/

# metals
.metals
.bloop
project/**/metals.sbt
project/metals.sbt

# custom
.bsp
.vscode
.addons-dont-touch
.DS_Store
generated
docs/generated
test_run_dir
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

A generic library adding some frequently used methods in Scala and Chisel development.

[![codecov.io](https://codecov.io/github/carlosedp/scalautils/coverage.svg?branch=master)]
(https://codecov.io/github/carlosedp/scalautils?branch=master)

## Adding to your project

### SBT
Expand Down
60 changes: 35 additions & 25 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,39 +1,49 @@
name := "scalautils"
organization := "com.carlosedp"
version := "0.4.0"
scalaVersion := "2.13.6"

homepage := Some(url("https://carlosedp.com"))
ThisBuild / organization := "com.carlosedp"
ThisBuild / version := "0.4.0"
ThisBuild / scalaVersion := "2.13.6"
ThisBuild / homepage := Some(url("https://carlosedp.com"))
ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT"))
scmInfo := Some(ScmInfo(url("https://github.com/carlosedp/scalautils"), "git@github.com:carlosedp/scalautils.git"))
developers := List(Developer("carlosedp", "carlosedp", "carlosedp@gmail.com", url("https://github.com/carlosedp")))
ThisBuild / scmInfo := Some(
ScmInfo(url("https://github.com/carlosedp/scalautils"), "git@github.com:carlosedp/scalautils.git")
)
ThisBuild / developers := List(
Developer("carlosedp", "carlosedp", "carlosedp@gmail.com", url("https://github.com/carlosedp"))
)
semanticdbEnabled := true
semanticdbVersion := "4.4.27"
semanticdbVersion := "4.4.27" //scalafixSemanticdb.revision // Force version due to compatibility issues
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.5.0"

crossScalaVersions := Seq("2.11.12", "2.12.13", "2.13.6")
publishConfiguration := publishConfiguration.value.withOverwrite(true)
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true)
publishMavenStyle := true
lazy val root = (project in file("."))
.settings(
name := "scalautils",
crossScalaVersions := Seq("2.11.12", "2.12.13", "2.13.6", "3.0.2"),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.9",
sonatypeRepository := "https://s01.oss.sonatype.org/service/local",
sonatypeCredentialHost := "s01.oss.sonatype.org",
publishConfiguration := publishConfiguration.value.withOverwrite(true),
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true),
publishMavenStyle := true
)

libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.9"
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.5.0"
ThisBuild / publishTo := {
val nexus = "https://s01.oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}

addCommandAlias("fix", "all compile:scalafix test:scalafix")
addCommandAlias("fmt", "all scalafmtSbt scalafmtAll;all compile:scalafix test:scalafix")
addCommandAlias("fix", "all Compile / scalafix Test / scalafix")
addCommandAlias("fmt", "all scalafmtSbt scalafmtAll")
addCommandAlias("lint", "fmt;fix")
addCommandAlias("deps", "dependencyUpdates")
addCommandAlias("xtest", "+test")
addCommandAlias("release", "+publishSigned;sonatypeBundleRelease")

scalacOptions ++= Seq(
"-deprecation",
"-explaintypes",
"-unchecked",
"-feature",
"-Ywarn-value-discard",
"-Ywarn-dead-code",
"-Ywarn-unused"
)

sonatypeRepository := "https://s01.oss.sonatype.org/service/local"
sonatypeCredentialHost := "s01.oss.sonatype.org"
ThisBuild / publishTo := {
val nexus = "https://s01.oss.sonatype.org/"
if (isSnapshot.value) Some("snapshots" at nexus + "content/repositories/snapshots")
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
4 changes: 0 additions & 4 deletions project/metals.sbt

This file was deleted.

11 changes: 6 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.27")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.3")
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "2.0.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.27")
addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.5.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.0")

0 comments on commit 938db73

Please sign in to comment.