Skip to content
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

Prepare repository for next .github release and SBT build improvements #501

Merged
merged 22 commits into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
2b6cbef
Move microsite files to `microsite`
alejandrohdezma Jun 1, 2020
a6da8e5
Move docs templates to `docs` folder, as Mdoc is expecting
alejandrohdezma Jun 1, 2020
03a1f4a
Remove `sbt-buildinfo` plugin, it isn't used anymore
alejandrohdezma Jun 1, 2020
0bc5e75
Move `organization` & `crossScalaVersions` as build settings
alejandrohdezma Jun 1, 2020
4b5db96
Add `scalaVersion` setting
alejandrohdezma Jun 1, 2020
ccaa204
Update to latest Scala versions
alejandrohdezma Jun 1, 2020
35cb272
Remove unused variable
alejandrohdezma Jun 1, 2020
ae1d97d
This requirement isn't needed
alejandrohdezma Jun 1, 2020
398575d
Extract common code and remove options provided by `sbt-tpolecat`
alejandrohdezma Jun 1, 2020
c2a047e
These are already provided by `sbt-microsites`
alejandrohdezma Jun 1, 2020
b62b523
Inline `publishMicrosite` into `ci-docs`
alejandrohdezma Jun 1, 2020
0ac15af
Add new alias that will be used for releasing new artifacts
alejandrohdezma Jun 1, 2020
a950c55
Enable downloading info from github before `ci-docs`/`ci-publish`
alejandrohdezma Jun 1, 2020
4f3b1ca
There is no need to call `scalafmt` with cross-compilation
alejandrohdezma Jun 1, 2020
73e810e
Remove `sbt-mdoc-toc` since it is not being used
alejandrohdezma Jun 1, 2020
8bea1da
Update plugins to latest versions
alejandrohdezma Jun 1, 2020
6a4c34c
There is no need to call `mdoc` with cross-compilation
alejandrohdezma Jun 1, 2020
1286384
Add `sbt-codecov` to manage testing with coverage and uploading it
alejandrohdezma Jun 1, 2020
e34c890
This file will be used by next version of workflows provided by .github
alejandrohdezma Jun 1, 2020
4f01b49
Remove `sbt-org-policies` unused markers
alejandrohdezma Jun 1, 2020
7d43c86
Add `sbt-remove-test-from-pom` plugin
alejandrohdezma Jun 1, 2020
2d14932
Remove unneeded setting
alejandrohdezma Jun 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pre:
docs: 'gem install jekyll -v 4'
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@

[comment]: # (Start Badges)

[![Join the chat at https://gitter.im/47degrees/github4s](https://badges.gitter.im/47degrees/github4s.svg)](https://gitter.im/47degrees/github4s?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![codecov.io](http://codecov.io/gh/47degrees/github4s/branch/master/graph/badge.svg)](http://codecov.io/gh/47degrees/github4s) [![Maven Central](https://img.shields.io/badge/maven%20central-0.24.0-green.svg)](https://oss.sonatype.org/#nexus-search;gav~com.47deg~github4s*) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/47degrees/github4s/master/LICENSE) [![Latest version](https://img.shields.io/badge/github4s-0.24.0-green.svg)](https://index.scala-lang.org/47degrees/github4s) [![GitHub Issues](https://img.shields.io/github/issues/47degrees/github4s.svg)](https://github.com/47degrees/github4s/issues)

[comment]: # (End Badges)

Github4s
=============

Expand All @@ -14,14 +10,10 @@ Github4s

To get started with SBT, simply add the following to your build.sbt file.

[comment]: # (Start Replace)

```scala
libraryDependencies += "com.47deg" %% "github4s" % "0.24.0"
```

[comment]: # (End Replace)

## Github4s in the wild

If you wish to add your library here please consider a PR to include it in the list below.
Expand All @@ -32,11 +24,8 @@ If you wish to add your library here please consider a PR to include it in the l
| | [**dashing**](https://github.com/benfradet/dashing) | Dashing is a collection of dashboards to monitor the health of an open source organization.
| | [**cla-bot**](https://github.com/snowplow-incubator/cla-bot) | Bot making sure external contributors sign a CLA.

[comment]: # (Start Copyright)
# Copyright

Github4s is designed and developed by 47 Degrees

Copyright (C) 2016-2020 47 Degrees. <http://47deg.com>

[comment]: # (End Copyright)
41 changes: 14 additions & 27 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
addCommandAlias("ci-test", "+scalafmtCheckAll; +scalafmtSbtCheck; +docs/mdoc; +test")
addCommandAlias("ci-docs", "project-docs/mdoc; docs/mdoc; headerCreateAll")
addCommandAlias("ci-microsite", "docs/publishMicrosite")
ThisBuild / organization := "com.47deg"
ThisBuild / scalaVersion := "2.13.2"
ThisBuild / crossScalaVersions := Seq("2.12.11", "2.13.2")

addCommandAlias("ci-test", "scalafmtCheckAll; scalafmtSbtCheck; mdoc; testCovered")
addCommandAlias("ci-docs", "github; mdoc; headerCreateAll; publishMicrosite")
addCommandAlias("ci-publish", "github; ci-release")

skip in publish := true

lazy val github4s = project
.enablePlugins(BuildInfoPlugin)
.settings(
buildInfoKeys := Seq[BuildInfoKey](
name,
version,
"token" -> sys.env.getOrElse("GITHUB_TOKEN", "")
),
buildInfoPackage := "github4s"
)
.settings(coreDeps: _*)
lazy val github4s = project.settings(coreDeps: _*)

//////////
// DOCS //
//////////

lazy val docs: Project = project
.aggregate(github4s)
lazy val microsite: Project = project
.dependsOn(github4s)
.settings(micrositeSettings: _*)
.settings(skip in publish := true)
.enablePlugins(MicrositesPlugin)
.enablePlugins(ScalaUnidocPlugin)
.settings(
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(github4s, docs)
)
.settings(micrositeSettings: _*)
.settings(skip in publish := true)
.settings(unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(github4s, microsite))

lazy val `project-docs` = (project in file(".docs"))
.aggregate(github4s)
.dependsOn(github4s)
.settings(moduleName := "github4s-project-docs")
.settings(mdocIn := file(".docs"))
lazy val documentation = project
.enablePlugins(MdocPlugin)
.settings(mdocOut := file("."))
.settings(skip in publish := true)
.enablePlugins(MdocPlugin)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 0 additions & 11 deletions .docs/README.md → docs/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@

[comment]: # (Start Badges)

[![Join the chat at https://gitter.im/47degrees/github4s](https://badges.gitter.im/47degrees/github4s.svg)](https://gitter.im/47degrees/github4s?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![codecov.io](http://codecov.io/gh/47degrees/github4s/branch/master/graph/badge.svg)](http://codecov.io/gh/47degrees/github4s) [![Maven Central](https://img.shields.io/badge/maven%20central-@VERSION@-green.svg)](https://oss.sonatype.org/#nexus-search;gav~com.47deg~github4s*) [![License](https://img.shields.io/badge/license-Apache%202-blue.svg)](https://raw.githubusercontent.com/47degrees/github4s/master/LICENSE) [![Latest version](https://img.shields.io/badge/github4s-@VERSION@-green.svg)](https://index.scala-lang.org/47degrees/github4s) [![GitHub Issues](https://img.shields.io/github/issues/47degrees/github4s.svg)](https://github.com/47degrees/github4s/issues)

[comment]: # (End Badges)

Github4s
=============

Expand All @@ -14,14 +10,10 @@ Github4s

To get started with SBT, simply add the following to your build.sbt file.

[comment]: # (Start Replace)

```scala
libraryDependencies += "com.47deg" %% "github4s" % "@VERSION@"
```

[comment]: # (End Replace)

## Github4s in the wild

If you wish to add your library here please consider a PR to include it in the list below.
Expand All @@ -32,11 +24,8 @@ If you wish to add your library here please consider a PR to include it in the l
| | [**dashing**](https://github.com/benfradet/dashing) | Dashing is a collection of dashboards to monitor the health of an open source organization.
| | [**cla-bot**](https://github.com/snowplow-incubator/cla-bot) | Bot making sure external contributors sign a CLA.

[comment]: # (Start Copyright)
# Copyright

Github4s is designed and developed by 47 Degrees

Copyright (C) 2016-2020 47 Degrees. <http://47deg.com>

[comment]: # (End Copyright)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
64 changes: 21 additions & 43 deletions project/ProjectPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,25 @@ import microsites._
import microsites.MicrositesPlugin.autoImport._
import sbt.Keys._
import sbt._
import scoverage.ScoverageKeys
import scoverage.ScoverageKeys._
import com.alejandrohdezma.sbt.github.SbtGithubPlugin
import sbtunidoc.ScalaUnidocPlugin.autoImport._
import mdoc.MdocPlugin.autoImport._

object ProjectPlugin extends AutoPlugin {

override def trigger: PluginTrigger = allRequirements

override def requires: Plugins = SbtGithubPlugin

object autoImport {

lazy val V = new {
val scala212: String = "2.12.10"
val scala213: String = "2.13.1"
val base64: String = "0.2.9"
val cats: String = "2.1.1"
val catsEffect: String = "2.1.1"
alejandrohdezma marked this conversation as resolved.
Show resolved Hide resolved
val circe: String = "0.13.0"
val http4s: String = "0.21.4"
val paradise: String = "2.1.1"
val scalamock: String = "4.4.0"
val scalatest: String = "3.1.2"
val silencer: String = "1.6.0"
val base64: String = "0.2.9"
val cats: String = "2.1.1"
val circe: String = "0.13.0"
val http4s: String = "0.21.4"
val paradise: String = "2.1.1"
val scalamock: String = "4.4.0"
val scalatest: String = "3.1.2"
val silencer: String = "1.7.0"
}

lazy val docsMappingsAPIDir: SettingKey[String] =
Expand All @@ -39,8 +32,6 @@ object ProjectPlugin extends AutoPlugin {
micrositeDescription := "Github API wrapper written in Scala",
micrositeBaseUrl := "github4s",
micrositeDocumentationUrl := "docs",
micrositeGithubOwner := "47degrees",
micrositeGithubRepo := "github4s",
micrositeAuthor := "Github4s contributors",
micrositeGithubToken := Option(System.getenv().get("GITHUB_TOKEN")),
micrositeCompilingDocsTool := WithMdoc,
Expand Down Expand Up @@ -90,38 +81,25 @@ object ProjectPlugin extends AutoPlugin {
"com.github.ghik" % "silencer-lib" % V.silencer % Provided cross CrossVersion.full,
compilerPlugin("com.github.ghik" % "silencer-plugin" % V.silencer cross CrossVersion.full)
),
libraryDependencies ++= (CrossVersion.partialVersion(scalaBinaryVersion.value) match {
case Some((2, 13)) => Seq.empty[ModuleID]
case _ =>
Seq(compilerPlugin("org.scalamacros" %% "paradise" % V.paradise cross CrossVersion.full))
})
libraryDependencies ++= on(2, 12)(
compilerPlugin("org.scalamacros" %% "paradise" % V.paradise cross CrossVersion.full)
).value
)

}

import autoImport.V

override def projectSettings: Seq[Def.Setting[_]] =
Seq(
organization := "com.47deg",
crossScalaVersions := Seq(V.scala212, V.scala213),
scalacOptions := {
val withStripedLinter = scalacOptions.value filterNot Set("-Xlint", "-Xfuture").contains
(CrossVersion.partialVersion(scalaBinaryVersion.value) match {
case Some((2, 13)) => withStripedLinter :+ "-Ymacro-annotations"
case _ => withStripedLinter
}) :+ "-language:higherKinds"
},
scalacOptions ++= on(2, 13)("-Ymacro-annotations").value,
coverageMinimum := 70d,
coverageFailOnMinimum := true,
coverageExcludedPackages := "<empty>;github4s\\.scalaz\\..*",
// This is necessary to prevent packaging the BuildInfo with
// sensible information like the Github token. Do not remove.
mappings in (Compile, packageBin) ~= { (ms: Seq[(File, String)]) =>
ms filter {
case (_, toPath) =>
!toPath.startsWith("github4s/BuildInfo")
}
}
coverageFailOnMinimum := true
)

def on[A](major: Int, minor: Int)(a: A): Def.Initialize[Seq[A]] =
Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some(v) if v == (major, minor) => Seq(a)
case _ => Nil
}
}
}
26 changes: 13 additions & 13 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.4.0")
addSbtPlugin("com.alejandrohdezma" %% "sbt-github" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-mdoc-toc" % "0.2")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.11")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.3")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.2.1")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.0")
addSbtPlugin("com.eed3si9n" % "sbt-unidoc" % "0.4.3")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-codecov" % "0.2.0")
addSbtPlugin("com.alejandrohdezma" % "sbt-github" % "0.8.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.8.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.8.2")
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.11")