Skip to content

Commit

Permalink
Upgrades Project (#91)
Browse files Browse the repository at this point in the history
* Fixes scalajs tests
* Excludes scalaz module from code coverage
* Upgrades sbt-org-policies plugin version
* Releases new patch version
* Adds jvmopts
  • Loading branch information
juanpedromoreno committed Apr 21, 2017
1 parent 3e3724b commit f6f1191
Show file tree
Hide file tree
Showing 31 changed files with 218 additions and 134 deletions.
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.8
12 changes: 12 additions & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Cats jvmopts see https://weblogs.java.net/blog/kcpeppe/archive/2013/12/11/case-study-jvm-hotspot-flags
-Dfile.encoding=UTF8
-Xms2G
-Xmx2G
-XX:MaxMetaspaceSize=512M
-XX:ReservedCodeCacheSize=128M
-XX:+TieredCompilation
-XX:-UseGCOverheadLimit
# effectively adds GC to Perm space
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
# must be enabled for CMSClassUnloadingEnabled to work
23 changes: 13 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
language: scala

scala:
- 2.10.6
- 2.11.8
- 2.12.1
- 2.10.6
- 2.11.11
- 2.12.2

jdk:
- oraclejdk8
- oraclejdk8

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;
fi
- 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;
fi

script:
- sbt ++$TRAVIS_SCALA_VERSION clean coverage test
- sbt ++$TRAVIS_SCALA_VERSION 'docs/tut'
- sbt ++$TRAVIS_SCALA_VERSION orgScriptCI

after_success:
- sbt ++$TRAVIS_SCALA_VERSION coverageReport
- bash <(curl -s https://codecov.io/bash) -t 744f05ba-f905-4468-aef1-f5016fc2909d
- sbt ++$TRAVIS_SCALA_VERSION orgAfterCISuccess
2 changes: 1 addition & 1 deletion NOTICE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github4s
Github4s
Copyright (c) 2016-2017 47 Degrees. All rights reserved.

Licensed under Apache License. See [LICENSE](LICENSE) for terms.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
[comment]: # (Start Badges)

[![Build Status](https://travis-ci.org/47deg/github4s.svg?branch=master)](https://travis-ci.org/47deg/github4s)
[![codecov.io](http://codecov.io/github/47deg/github4s/coverage.svg?branch=master)](http://codecov.io/github/47deg/github4s?branch=master)

[comment]: # (End Badges)

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

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

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

```
[comment]: # (Start Replace)

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

[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.

★ | ★ | ★
--- | --- | ---
![scala-exercises](https://www.scala-exercises.org/assets/images/navbar_brand.svg) | [**scala-exercises**](https://www.scala-exercises.org/) | Scala Exercises is an Open Source project for learning different technologies based in the Scala Programming Language.

[comment]: # (Start Copyright)
# Copyright

github4s is designed and developed by 47 Degrees
Github4s is designed and developed by 47 Degrees

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


[comment]: # (End Copyright)
9 changes: 4 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ lazy val root = (project in file("."))
.dependsOn(github4sJVM, github4sJS, scalaz, docs)
.aggregate(github4sJVM, github4sJS, scalaz, docs)
.settings(noPublishSettings: _*)
.settings(coverageFailOnMinimum := false)

lazy val github4s = (crossProject in file("github4s"))
.settings(moduleName := "github4s")
Expand All @@ -18,14 +17,15 @@ lazy val github4s = (crossProject in file("github4s"))
"token" -> sys.env.getOrElse("GITHUB4S_ACCESS_TOKEN", "")),
buildInfoPackage := "github4s"
)
.settings(commonDeps: _*)
.crossDepSettings(commonCrossDeps: _*)
.settings(standardCommonDeps: _*)
.jvmSettings(jvmDeps: _*)
.jsSettings(jsDeps: _*)
.jsSettings(sharedJsSettings: _*)
.jsSettings(testSettings: _*)
.jsSettings(jsDeps: _*)

lazy val github4sJVM = github4s.jvm
lazy val github4sJS = github4s.js.settings(coverageFailOnMinimum := false)
lazy val github4sJS = github4s.js

lazy val docs = (project in file("docs"))
.dependsOn(scalaz)
Expand All @@ -38,5 +38,4 @@ lazy val docs = (project in file("docs"))
lazy val scalaz = (project in file("scalaz"))
.settings(moduleName := "github4s-scalaz")
.settings(scalazDependencies: _*)
.settings(coverageFailOnMinimum := false)
.dependsOn(github4sJVM)
8 changes: 6 additions & 2 deletions docs/src/main/tut/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Github4s is a GitHub API wrapper written in Scala.

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

[comment]: # (Start Replace)

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

[comment]: # (End Replace)
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import fr.hmil.roshttp._
import fr.hmil.roshttp.body.BulkBodyPart
import fr.hmil.roshttp.response.SimpleHttpResponse
import fr.hmil.roshttp.util.HeaderMap
import github4s.GithubResponses.{GHResponse, GHResult, JsonParsingException, UnexpectedException}
import github4s.GithubResponses._
import github4s.HttpClient.HttpCode400
import io.circe.Decoder
import io.circe.parser._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import github4s.Github._
import github4s.Github
import github4s.utils.TestUtils
import org.scalatest._
import fr.hmil.roshttp.response.SimpleHttpResponse
import github4s.free.domain.Authorize
import github4s.js.Implicits._
import scala.concurrent.Future

import scala.concurrent.ExecutionContext

class GHAuthSpec extends AsyncFlatSpec with Matchers with TestUtils {

override implicit val executionContext =
override implicit val executionContext: ExecutionContext =
scala.concurrent.ExecutionContext.Implicits.global

"Auth >> NewAuth" should "return error on Left when invalid credential is provided" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import github4s.Github._
import github4s.Github
import github4s.utils.TestUtils
import org.scalatest._
import fr.hmil.roshttp.response.SimpleHttpResponse
import github4s.free.domain.{Gist, GistFile}
import github4s.js.Implicits._
import scala.concurrent.Future

import scala.concurrent.ExecutionContext

class GHGistsSpec extends AsyncFlatSpec with Matchers with TestUtils {

override implicit val executionContext =
override implicit val executionContext: ExecutionContext =
scala.concurrent.ExecutionContext.Implicits.global

"Gists >> Post" should "return the provided gist" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ import github4s.js.Implicits._
import github4s.utils.TestUtils
import org.scalatest._

import scala.concurrent.ExecutionContext

class GHGitDataSpec extends AsyncFlatSpec with Matchers with TestUtils {

override implicit val executionContext =
override implicit val executionContext: ExecutionContext =
scala.concurrent.ExecutionContext.Implicits.global

"GitData >> GetReference" should "return a list of references" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ import github4s.js.Implicits._
import github4s.utils.TestUtils
import org.scalatest._

import scala.concurrent.ExecutionContext

class GHIssuesSpec extends AsyncFlatSpec with Matchers with TestUtils {

override implicit val executionContext =
override implicit val executionContext: ExecutionContext =
scala.concurrent.ExecutionContext.Implicits.global

"Issues >> List" should "return a list of issues" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

package github4s.utils.integration
package github4s.integration

import github4s.Github
import github4s.Github._
Expand All @@ -23,20 +23,21 @@ import github4s.js.Implicits._
import github4s.utils.TestUtils
import org.scalatest.{AsyncFlatSpec, Matchers}

import scala.concurrent.ExecutionContext

class GHPullRequestsSpec extends AsyncFlatSpec with Matchers with TestUtils {

override implicit val executionContext =
override implicit val executionContext: ExecutionContext =
scala.concurrent.ExecutionContext.Implicits.global

"PullRequests >> List" should "return a non empty list when valid repo is provided" in {
"PullRequests >> List" should "return a right response when valid repo is provided" in {

val response =
Github(accessToken).pullRequests
.list(validRepoOwner, validRepoName)
.execFuture(headerUserAgent)

testFutureIsRight[List[PullRequest]](response, { r =>
r.result.nonEmpty shouldBe true
r.statusCode shouldBe okStatusCode
})
}
Expand All @@ -60,7 +61,7 @@ class GHPullRequestsSpec extends AsyncFlatSpec with Matchers with TestUtils {
it should "return error when an invalid repo name is passed" in {
val response =
Github(accessToken).pullRequests
.list(validRepoOwner, validRepoName)
.list(validRepoOwner, invalidRepoName)
.execFuture(headerUserAgent)

testFutureIsLeft(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,8 @@ class GHReposSpec extends AsyncFlatSpec with Matchers with TestUtils {
it should "return error when an invalid path is passed" in {
val response =
Github(accessToken).repos
.getContents(validRepoOwner, validRepoName, validFilePath)
.getContents(validRepoOwner, validRepoName, invalidFilePath)
.execFuture(headerUserAgent)

testFutureIsLeft(response)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@
* limitations under the License.
*/

package github4s.utils.integration
package github4s.integration

import github4s.Decoders._
import github4s.Github
import github4s.Github._
import github4s.free.domain.{CombinedStatus, Status}
import github4s.js.Implicits._
import github4s.utils.TestUtils
import org.scalatest.{AsyncFlatSpec, Matchers}

import scala.concurrent.ExecutionContext

class GHStatusesSpec extends AsyncFlatSpec with Matchers with TestUtils {

override implicit val executionContext = scala.concurrent.ExecutionContext.Implicits.global
override implicit val executionContext: ExecutionContext =
scala.concurrent.ExecutionContext.Implicits.global

"Statuses >> Get" should "return a combined status" in {
val response = Github(accessToken).statuses
Expand All @@ -43,7 +45,7 @@ class GHStatusesSpec extends AsyncFlatSpec with Matchers with TestUtils {
val response = Github(accessToken).statuses
.getCombinedStatus(validRepoOwner, validRepoName, invalidRef)
.execFuture(headerUserAgent)
response should be('left)
testFutureIsLeft(response)
}

"Statuses >> List" should "return a non empty list when a valid ref is provided" in {
Expand All @@ -68,7 +70,7 @@ class GHStatusesSpec extends AsyncFlatSpec with Matchers with TestUtils {
})
}

"Status >> Create" should "create a status" in {
"Statuses >> Create" should "create a status" in {
val response = Github(accessToken).statuses
.createStatus(
validRepoOwner,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ import github4s.Github
import github4s.utils.TestUtils
import org.scalatest._
import fr.hmil.roshttp.response.SimpleHttpResponse
import scala.concurrent.Future

import scala.concurrent.{ExecutionContext, Future}
import github4s.free.domain.User
import github4s.js.Implicits._

class GHUsersSpec extends AsyncFlatSpec with Matchers with TestUtils {

override implicit val executionContext =
override implicit val executionContext: ExecutionContext =
scala.concurrent.ExecutionContext.Implicits.global

"Users >> Get" should "return the expected login for a valid username" in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ import scala.concurrent.Future

trait TestUtils extends Matchers {
def testFutureIsLeft[A](response: Future[GHResponse[A]])(
implicit ec: scala.concurrent.ExecutionContext) = {
implicit ec: scala.concurrent.ExecutionContext): Future[Assertion] = {
response map { r =>
r.isLeft should be(true)
}
}

def testFutureIsRight[A](response: Future[GHResponse[A]], f: (GHResult[A]) => Assertion)(
implicit ec: scala.concurrent.ExecutionContext) = {
implicit ec: scala.concurrent.ExecutionContext): Future[Assertion] = {
response map { r
{
r.isRight should be(true)
Expand All @@ -47,9 +47,9 @@ trait TestUtils extends Matchers {
}
}

val accessToken = Option(github4s.BuildInfo.token)
def tokenHeader = "token " + accessToken.getOrElse("")
val headerUserAgent = Map("user-agent" -> "github4s")
val accessToken: Option[String] = Option(github4s.BuildInfo.token)
def tokenHeader: String = "token " + accessToken.getOrElse("")
val headerUserAgent: Map[String, String] = Map("user-agent" -> "github4s")

val validUsername = "rafaparadela"
val invalidUsername = "GHInvalidaUserName"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ package github4s
import github4s.GithubResponses.{GHResult, JsonParsingException, UnexpectedException}
import io.circe.Decoder
import io.circe.parser._
import io.circe.generic.auto._
import github4s.GithubResponses.GHResponse

import scalaj.http._
import cats.implicits._
import github4s.GithubDefaultUrls._
import github4s.free.interpreters.Capture

trait HttpRequestBuilderExtensionJVM {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class EncodersSpec extends FlatSpec with Matchers {
val expectedJson = parse(expectedJsonString).right.get
val actualJson = treeData.asJson

actualJson shouldBe expectedJson
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package github4s.unit

import cats.Id
import github4s.Decoders._
import github4s.GithubResponses.{GHResponse, GHResult}
import github4s.api.Statuses
import github4s.free.domain._
Expand Down

0 comments on commit f6f1191

Please sign in to comment.