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

Cross-build Scala 2.13 #311

Merged
merged 12 commits into from Dec 18, 2019
22 changes: 15 additions & 7 deletions .travis.yml
Expand Up @@ -3,6 +3,10 @@ dist: trusty
jdk:
- oraclejdk11

scala:
- 2.12.10
- 2.13.1

before_install:
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
openssl aes-256-cbc -K $encrypted_88322e86f6b6_key -iv $encrypted_88322e86f6b6_iv -in secring.gpg.enc -out secring.gpg -d;
Expand All @@ -15,19 +19,24 @@ install:
- gem install sass
- gem install jekyll -v 4.0.0

script:
- sbt ++$TRAVIS_SCALA_VERSION test

stages:
- test
- docs
- deploy

after_success:
- bash <(curl -s https://codecov.io/bash)

jobs:
include:
- script:
- sbt ++$TRAVIS_SCALA_VERSION $SBT_JAVA_OPT validate;
- sbt ++$TRAVIS_SCALA_VERSION $SBT_JAVA_OPT docs/tut;
- stage: docs
scala: 2.12.10
script:
- sbt ++$TRAVIS_SCALA_VERSION docs/tut
- sbt ++$TRAVIS_SCALA_VERSION clean coverage test coverageReport coverageAggregate
- bash <(curl -s https://codecov.io/bash)
- stage: deploy
scala: 2.12.10
script:
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
if grep -q "SNAPSHOT" version.sbt; then
Expand All @@ -42,7 +51,6 @@ jobs:
sbt docs/publishMicrosite;
fi
fi
scala: 2.12.10

before_cache:
- du -h -d 1 $HOME/.ivy2/cache
Expand Down
12 changes: 0 additions & 12 deletions build.sbt
@@ -1,5 +1,3 @@
import sbtorgpolicies.runnable.syntax._

pgpPassphrase := Some(getEnvVar("PGP_PASSPHRASE").getOrElse("").toCharArray)
pgpPublicRing := file(s"$gpgFolder/pubring.gpg")
pgpSecretRing := file(s"$gpgFolder/secring.gpg")
Expand Down Expand Up @@ -49,13 +47,3 @@ lazy val docs = (project in file("docs"))
.settings(docsDependencies: _*)
.settings(noPublishSettings: _*)
.enablePlugins(MicrositesPlugin)

//////////
// MISC //
//////////

addCommandAlias("validateDocs", ";project docs;tut;project root")
addCommandAlias("validateJVM", (toCompileTestList(allModules) ++ List("project root")).asCmd)
addCommandAlias(
"validate",
";clean;compile;coverage;validateJVM;coverageReport;coverageAggregate;coverageOff")
Expand Up @@ -16,4 +16,4 @@

package github4s.cats.effect.jvm

object Implicits extends ImplicitsJVM
object Implicits extends ImplicitsJVM
124 changes: 62 additions & 62 deletions github4s/src/main/scala/github4s/Decoders.scala
Expand Up @@ -33,11 +33,11 @@ object Decoders {

implicit val decodeCommit: Decoder[Commit] = Decoder.instance { c =>
for {
sha c.downField("sha").as[String]
message c.downField("commit").downField("message").as[String]
date c.downField("commit").downField("author").downField("date").as[String]
url c.downField("html_url").as[String]
author c.downField("author").as[Option[Author]]
sha <- c.downField("sha").as[String]
message <- c.downField("commit").downField("message").as[String]
date <- c.downField("commit").downField("author").downField("date").as[String]
url <- c.downField("html_url").as[String]
author <- c.downField("author").as[Option[Author]]
} yield
Commit(
sha = sha,
Expand All @@ -52,10 +52,10 @@ object Decoders {

implicit val decodeBranch: Decoder[Branch] = Decoder.instance { c =>
for {
name c.downField("name").as[String]
commit c.downField("commit").as[BranchCommit]
branchProtected c.downField("protected").as[Option[Boolean]]
protection_url c.downField("protection_url").as[Option[String]]
name <- c.downField("name").as[String]
commit <- c.downField("commit").as[BranchCommit]
branchProtected <- c.downField("protected").as[Option[Boolean]]
protection_url <- c.downField("protection_url").as[Option[String]]
} yield
Branch(
name = name,
Expand All @@ -67,8 +67,8 @@ object Decoders {

implicit val decodeBranchCommit: Decoder[BranchCommit] = Decoder.instance { c =>
for {
url c.downField("url").as[String]
sha c.downField("sha").as[String]
url <- c.downField("url").as[String]
sha <- c.downField("sha").as[String]
} yield
BranchCommit(
url = url,
Expand All @@ -84,14 +84,14 @@ object Decoders {
implicit val decodeStatusRepository: Decoder[StatusRepository] = {
Decoder.instance { c =>
for {
id c.downField("id").as[Int]
name c.downField("name").as[String]
full_name c.downField("full_name").as[String]
owner c.downField("owner").as[Option[User]]
priv c.downField("private").as[Boolean]
description c.downField("description").as[Option[String]]
fork c.downField("fork").as[Boolean]
repoUrls readRepoUrls(c)
id <- c.downField("id").as[Int]
name <- c.downField("name").as[String]
full_name <- c.downField("full_name").as[String]
owner <- c.downField("owner").as[Option[User]]
priv <- c.downField("private").as[Boolean]
description <- c.downField("description").as[Option[String]]
fork <- c.downField("fork").as[Boolean]
repoUrls <- readRepoUrls(c)
} yield
StatusRepository(
id = id,
Expand All @@ -112,39 +112,39 @@ object Decoders {

Decoder.instance { c =>
for {
id c.downField("id").as[Int]
name c.downField("name").as[String]
full_name c.downField("full_name").as[String]
owner c.downField("owner").as[User]
priv c.downField("private").as[Boolean]
description c.downField("description").as[Option[String]]
fork c.downField("fork").as[Boolean]
created_at c.downField("created_at").as[String]
updated_at c.downField("updated_at").as[String]
pushed_at c.downField("pushed_at").as[String]
homepage c.downField("homepage").as[Option[String]]
language c.downField("language").as[Option[String]]
organization c.downField("organization").as[Option[User]]
size c.downField("size").as[Int]
stargazers_count c.downField("stargazers_count").as[Int]
watchers_count c.downField("watchers_count").as[Int]
forks_count c.downField("forks_count").as[Int]
open_issues_count c.downField("open_issues_count").as[Int]
open_issues c.downField("open_issues").as[Option[Int]]
watchers c.downField("watchers").as[Option[Int]]
network_count c.downField("network_count").as[Option[Int]]
subscribers_count c.downField("subscribers_count").as[Option[Int]]
has_issues c.downField("has_issues").as[Boolean]
has_downloads c.downField("has_downloads").as[Boolean]
has_wiki c.downField("has_wiki").as[Boolean]
has_pages c.downField("has_pages").as[Boolean]
url c.downField("url").as[String]
html_url c.downField("html_url").as[String]
git_url c.downField("git_url").as[String]
ssh_url c.downField("ssh_url").as[String]
clone_url c.downField("clone_url").as[String]
svn_url c.downField("svn_url").as[String]
repoUrls readRepoUrls(c)
id <- c.downField("id").as[Int]
name <- c.downField("name").as[String]
full_name <- c.downField("full_name").as[String]
owner <- c.downField("owner").as[User]
priv <- c.downField("private").as[Boolean]
description <- c.downField("description").as[Option[String]]
fork <- c.downField("fork").as[Boolean]
created_at <- c.downField("created_at").as[String]
updated_at <- c.downField("updated_at").as[String]
pushed_at <- c.downField("pushed_at").as[String]
homepage <- c.downField("homepage").as[Option[String]]
language <- c.downField("language").as[Option[String]]
organization <- c.downField("organization").as[Option[User]]
size <- c.downField("size").as[Int]
stargazers_count <- c.downField("stargazers_count").as[Int]
watchers_count <- c.downField("watchers_count").as[Int]
forks_count <- c.downField("forks_count").as[Int]
open_issues_count <- c.downField("open_issues_count").as[Int]
open_issues <- c.downField("open_issues").as[Option[Int]]
watchers <- c.downField("watchers").as[Option[Int]]
network_count <- c.downField("network_count").as[Option[Int]]
subscribers_count <- c.downField("subscribers_count").as[Option[Int]]
has_issues <- c.downField("has_issues").as[Boolean]
has_downloads <- c.downField("has_downloads").as[Boolean]
has_wiki <- c.downField("has_wiki").as[Boolean]
has_pages <- c.downField("has_pages").as[Boolean]
url <- c.downField("url").as[String]
html_url <- c.downField("html_url").as[String]
git_url <- c.downField("git_url").as[String]
ssh_url <- c.downField("ssh_url").as[String]
clone_url <- c.downField("clone_url").as[String]
svn_url <- c.downField("svn_url").as[String]
repoUrls <- readRepoUrls(c)
} yield
Repository(
id = id,
Expand Down Expand Up @@ -199,7 +199,7 @@ object Decoders {

implicit val decodeGistFile: Decoder[GistFile] = Decoder.instance { c =>
for {
content c.downField("content").as[String]
content <- c.downField("content").as[String]
} yield
GistFile(
content = content
Expand All @@ -208,11 +208,11 @@ object Decoders {

implicit val decodeGist: Decoder[Gist] = Decoder.instance { c =>
for {
url c.downField("url").as[String]
id c.downField("id").as[String]
description c.downField("description").as[String]
public c.downField("public").as[Boolean]
files c.downField("files").as[Map[String, GistFile]]
url <- c.downField("url").as[String]
id <- c.downField("id").as[String]
description <- c.downField("description").as[String]
public <- c.downField("public").as[Boolean]
files <- c.downField("files").as[Map[String, GistFile]]
} yield
Gist(
url = url,
Expand All @@ -228,17 +228,17 @@ object Decoders {
.map(Stargazer(None, _))
.or(Decoder.instance(c =>
for {
starred_at c.downField("starred_at").as[String]
user c.downField("user").as[User]
starred_at <- c.downField("starred_at").as[String]
user <- c.downField("user").as[User]
} yield Stargazer(Some(starred_at), user)))

implicit val decodeStarredRepository: Decoder[StarredRepository] =
Decoder[Repository]
.map(StarredRepository(None, _))
.or(Decoder.instance(c =>
for {
starred_at c.downField("starred_at").as[String]
repo c.downField("repo").as[Repository]
starred_at <- c.downField("starred_at").as[String]
repo <- c.downField("repo").as[Repository]
} yield StarredRepository(Some(starred_at), repo)))

implicit def decodeNonEmptyList[T](implicit D: Decoder[T]): Decoder[NonEmptyList[T]] = {
Expand Down
2 changes: 1 addition & 1 deletion github4s/src/main/scala/github4s/free/domain/User.scala
Expand Up @@ -33,4 +33,4 @@ case class User(
hireable: Option[Boolean] = None,
public_repos: Option[Int] = None,
contributions: Option[Int] = None
)
)
20 changes: 15 additions & 5 deletions project/ProjectPlugin.scala
Expand Up @@ -29,6 +29,7 @@ object ProjectPlugin extends AutoPlugin {
val paradise: String = "2.1.1"
val simulacrum: String = "0.19.0"
val scala212: String = "2.12.10"
val scala213: String = "2.13.1"
val scalaj: String = "2.4.2"
val scalamock: String = "4.4.0"
val scalaTest: String = "3.1.0"
Expand Down Expand Up @@ -69,9 +70,12 @@ object ProjectPlugin extends AutoPlugin {
%%("scalamock", V.scalamock) % Test,
%%("scalatest", V.scalaTest) % Test,
"org.mock-server" % "mockserver-netty" % "5.8.0" % Test excludeAll ExclusionRule(
"com.twitter"),
compilerPlugin(%%("paradise", V.paradise) cross CrossVersion.full)
)
"com.twitter")
),
libraryDependencies ++= (CrossVersion.partialVersion(scalaBinaryVersion.value) match {
case Some((2, 13)) => Seq.empty[ModuleID]
case _ => Seq(compilerPlugin(%%("paradise", V.paradise) cross CrossVersion.full))
})
)

lazy val docsDependencies: Def.Setting[Seq[ModuleID]] = libraryDependencies += %%(
Expand Down Expand Up @@ -102,8 +106,14 @@ object ProjectPlugin extends AutoPlugin {
startYear := Option(2016),
resolvers += Resolver.sonatypeRepo("snapshots"),
scalaVersion := V.scala212,
crossScalaVersions := Seq(V.scala212),
scalacOptions ~= (_ filterNot Set("-Xlint").contains),
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
}
},
orgGithubTokenSetting := "GITHUB4S_ACCESS_TOKEN",
orgBadgeListSetting := List(
TravisBadge.apply(_),
Expand Down
7 changes: 4 additions & 3 deletions project/plugins.sbt
@@ -1,3 +1,4 @@
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.12.0-M3")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.0.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.12.0-M3")
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.0.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")