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

Enables Hydra on cats build #2848

Merged
merged 14 commits into from
May 23, 2019
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.hydra
project/boot
target
.ensime
Expand Down
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ scala_version_213: &scala_version_213 2.13.0-RC1

before_install:
- export PATH=${PATH}:./vendor/bundle
- mkdir -p /home/travis/.triplequote/metrics/config && echo "$HydraLicense" > "/home/travis/.triplequote/hydra.license" && cp hydra-metrics-service.conf /home/travis/.triplequote/metrics/config/metrics-service.conf

stages:
- name: styling
Expand Down Expand Up @@ -88,12 +89,19 @@ notifications:

env:
global:
# Sonatype Credential
- secure: Kf44XQFpq2QGe3rn98Dsf5Uz3WXzPDralS54co7sqT5oQGs1mYLYZRYz+I75ZSo5ffZ86H7M+AI9YFofqGwAjBixBbqf1tGkUh3oZp2fN3QfqzazGV3HzC+o41zALG5FL+UBaURev9ChQ5fYeTtFB7YAzejHz4y5E97awk934Rg=
- secure: QbNAu0jCaKrwjJi7KZtYEBA/pYbTJ91Y1x/eLAJpsamswVOvwnThA/TLYuux+oiZQCiDUpBzP3oxksIrEEUAhl0lMtqRFY3MrcUr+si9NIjX8hmoFwkvZ5o1b7pmLF6Vz3rQeP/EWMLcljLzEwsrRXeK0Ei2E4vFpsg8yz1YXJg=
- TRAVIS_NODE_VERSION="4"
# Hydra License
- secure: "Nwd0ySmT7BQJcQb/Dyrkv/B1uYLrE5u+Ppz3Q3d6FvEB5z3XzzDai03hjMwwFwMgXGtZ2Aio0KqF2qf3oINPkmSVx1ntvL0JqwRZqxF5YPLp/vb8b4LbvHrzsf5Jh/EFK5JOdN6ApPlhw8u1X1ifvJbG6yVt9qRxCejHOI0ZT4k="
# Hydra Metrics Credential
- secure: "Xbc3y1rTRDj2ThfsT3Pj98T3OgC90aZlVrgAFtOrSTknZAK0jArlvsKg456PvTPcR2uY6c7wvyebSaq+RYReFX2XpCfRjc4ywGCUtnbfcvzO4IA/MIUkFtFQJJqBXHlN5IFqjOZyaX6svD9fNscYg0NP1pqJ6vW54ArvKTALtHM="
- secure: "hbKDZntISUgbYAXK8Q6M8XwhjB7l5yHyWIs9RjnEdV0YRfcTZIba8WEaE2JFe3MdyPUhGYAWf1AVFXLdfRSmvNHMEeVPitw5cAVxPMxhfgJnPRBVhgBsr9oMl/QQbLu7/w013m6ChYmZspApzyAfmZM2ZNKsYiX/AvoBVYeGdPQ="

cache:
directories:
- .hydra
- $HOME/.m2
- $HOME/.ivy2/cache
- $HOME/.sbt
Expand Down
17 changes: 17 additions & 0 deletions hydra-metrics-service.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# mandatory: include the built-in settings tree
include "application.conf"

triplequote.dashboard.client {
# Optional user ID override
# metricsUserId = ${user.name}

# Optional host ID (e.g. hostname)
# metricsHostId = ""

# Server address to push the metrics data
serverUrl = "https://dashboard.triplequote.com/metrics"

# Optional HTTP basic authentication
clientUsername = ${?HYDRA_METRICS_USERNAME}
clientPassword = ${?HYDRA_METRICS_PASSWORD}
}
36 changes: 36 additions & 0 deletions kernel/src/main/scala/cats/kernel/instances/AllInstances.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package cats.kernel
package instances

trait AllInstances
extends BigDecimalInstances
with BigIntInstances
with BitSetInstances
with BooleanInstances
with ByteInstances
with CharInstances
with DoubleInstances
with EqInstances
with EitherInstances
with DurationInstances
with FloatInstances
with FunctionInstances
with HashInstances
with IntInstances
with ListInstances
with LongInstances
with MapInstances
with OptionInstances
with OrderInstances
with PartialOrderInstances
with QueueInstances
with SetInstances
with ShortInstances
with StreamInstances
with StringInstances
with SymbolInstances
with TupleInstances
with UnitInstances
with UUIDInstances
with VectorInstances

trait AllInstancesBinCompat0 extends FiniteDurationInstances
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package cats.kernel
package instances

trait BigDecimalInstances {
implicit val catsKernelStdOrderForBigDecimal: Order[BigDecimal] with Hash[BigDecimal] =
new BigDecimalOrder
implicit val catsKernelStdGroupForBigDecimal: CommutativeGroup[BigDecimal] =
new BigDecimalGroup
}

class BigDecimalGroup extends CommutativeGroup[BigDecimal] {
val empty: BigDecimal = BigDecimal(0)
def combine(x: BigDecimal, y: BigDecimal): BigDecimal = x + y
def inverse(x: BigDecimal): BigDecimal = -x
override def remove(x: BigDecimal, y: BigDecimal): BigDecimal = x - y
}

class BigDecimalOrder extends Order[BigDecimal] with Hash[BigDecimal] {

def hash(x: BigDecimal): Int = x.hashCode()

def compare(x: BigDecimal, y: BigDecimal): Int = x.compare(y)

override def eqv(x: BigDecimal, y: BigDecimal): Boolean = x == y
override def neqv(x: BigDecimal, y: BigDecimal): Boolean = x != y
override def gt(x: BigDecimal, y: BigDecimal): Boolean = x > y
override def gteqv(x: BigDecimal, y: BigDecimal): Boolean = x >= y
override def lt(x: BigDecimal, y: BigDecimal): Boolean = x < y
override def lteqv(x: BigDecimal, y: BigDecimal): Boolean = x <= y

override def min(x: BigDecimal, y: BigDecimal): BigDecimal = x.min(y)
override def max(x: BigDecimal, y: BigDecimal): BigDecimal = x.max(y)
}
32 changes: 32 additions & 0 deletions kernel/src/main/scala/cats/kernel/instances/BigIntInstances.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package cats.kernel
package instances

trait BigIntInstances {
implicit val catsKernelStdOrderForBigInt: Order[BigInt] with Hash[BigInt] =
new BigIntOrder
implicit val catsKernelStdGroupForBigInt: CommutativeGroup[BigInt] =
new BigIntGroup
}

class BigIntGroup extends CommutativeGroup[BigInt] {
val empty: BigInt = BigInt(0)
def combine(x: BigInt, y: BigInt): BigInt = x + y
def inverse(x: BigInt): BigInt = -x
override def remove(x: BigInt, y: BigInt): BigInt = x - y
}

class BigIntOrder extends Order[BigInt] with Hash[BigInt] {

def hash(x: BigInt): Int = x.hashCode()
def compare(x: BigInt, y: BigInt): Int = x.compare(y)

override def eqv(x: BigInt, y: BigInt): Boolean = x == y
override def neqv(x: BigInt, y: BigInt): Boolean = x != y
override def gt(x: BigInt, y: BigInt): Boolean = x > y
override def gteqv(x: BigInt, y: BigInt): Boolean = x >= y
override def lt(x: BigInt, y: BigInt): Boolean = x < y
override def lteqv(x: BigInt, y: BigInt): Boolean = x <= y

override def min(x: BigInt, y: BigInt): BigInt = x.min(y)
override def max(x: BigInt, y: BigInt): BigInt = x.max(y)
}
31 changes: 31 additions & 0 deletions kernel/src/main/scala/cats/kernel/instances/BitSetInstances.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package cats.kernel
package instances

import scala.collection.immutable.BitSet

trait BitSetInstances {
implicit val catsKernelStdOrderForBitSet: PartialOrder[BitSet] with Hash[BitSet] =
new BitSetPartialOrder

implicit val catsKernelStdSemilatticeForBitSet: BoundedSemilattice[BitSet] =
new BitSetSemilattice
}

class BitSetPartialOrder extends PartialOrder[BitSet] with Hash[BitSet] {
def hash(x: BitSet): Int = x.hashCode()

def partialCompare(x: BitSet, y: BitSet): Double =
if (x eq y) 0.0
else if (x.size < y.size) if (x.subsetOf(y)) -1.0 else Double.NaN
else if (y.size < x.size) if (y.subsetOf(x)) 1.0 else Double.NaN
else if (x == y) 0.0
else Double.NaN

override def eqv(x: BitSet, y: BitSet): Boolean =
x == y
}

class BitSetSemilattice extends BoundedSemilattice[BitSet] {
def empty: BitSet = BitSet.empty
def combine(x: BitSet, y: BitSet): BitSet = x | y
}
24 changes: 24 additions & 0 deletions kernel/src/main/scala/cats/kernel/instances/BooleanInstances.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cats.kernel
package instances

trait BooleanInstances {
implicit val catsKernelStdOrderForBoolean: Order[Boolean] with Hash[Boolean] =
new BooleanOrder
}

class BooleanOrder extends Order[Boolean] with Hash[Boolean] {

def hash(x: Boolean): Int = x.hashCode()
def compare(x: Boolean, y: Boolean): Int =
if (x == y) 0 else if (x) 1 else -1

override def eqv(x: Boolean, y: Boolean): Boolean = x == y
override def neqv(x: Boolean, y: Boolean): Boolean = x != y
override def gt(x: Boolean, y: Boolean): Boolean = x && !y
override def lt(x: Boolean, y: Boolean): Boolean = !x && y
override def gteqv(x: Boolean, y: Boolean): Boolean = x == y || x
override def lteqv(x: Boolean, y: Boolean): Boolean = x == y || y

override def min(x: Boolean, y: Boolean): Boolean = x && y
override def max(x: Boolean, y: Boolean): Boolean = x || y
}
34 changes: 34 additions & 0 deletions kernel/src/main/scala/cats/kernel/instances/ByteInstances.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cats.kernel
package instances

trait ByteInstances {
implicit val catsKernelStdOrderForByte: Order[Byte] with Hash[Byte] = new ByteOrder
implicit val catsKernelStdGroupForByte: CommutativeGroup[Byte] = new ByteGroup
}

class ByteGroup extends CommutativeGroup[Byte] {
def combine(x: Byte, y: Byte): Byte = (x + y).toByte
def empty: Byte = 0
def inverse(x: Byte): Byte = (-x).toByte
override def remove(x: Byte, y: Byte): Byte = (x - y).toByte
}

class ByteOrder extends Order[Byte] with Hash[Byte] {

def hash(x: Byte): Int = x.hashCode()

def compare(x: Byte, y: Byte): Int =
if (x < y) -1 else if (x > y) 1 else 0

override def eqv(x: Byte, y: Byte): Boolean = x == y
override def neqv(x: Byte, y: Byte): Boolean = x != y
override def gt(x: Byte, y: Byte): Boolean = x > y
override def gteqv(x: Byte, y: Byte): Boolean = x >= y
override def lt(x: Byte, y: Byte): Boolean = x < y
override def lteqv(x: Byte, y: Byte): Boolean = x <= y

override def min(x: Byte, y: Byte): Byte =
java.lang.Math.min(x.toInt, y.toInt).toByte
override def max(x: Byte, y: Byte): Byte =
java.lang.Math.max(x.toInt, y.toInt).toByte
}
18 changes: 18 additions & 0 deletions kernel/src/main/scala/cats/kernel/instances/CharInstances.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cats.kernel
package instances

trait CharInstances {
implicit val catsKernelStdOrderForChar = new CharOrder
}

class CharOrder extends Order[Char] with Hash[Char] {
def hash(x: Char): Int = x.hashCode()
def compare(x: Char, y: Char): Int =
if (x < y) -1 else if (x > y) 1 else 0
override def eqv(x: Char, y: Char): Boolean = x == y
override def neqv(x: Char, y: Char): Boolean = x != y
override def gt(x: Char, y: Char): Boolean = x > y
override def gteqv(x: Char, y: Char): Boolean = x >= y
override def lt(x: Char, y: Char): Boolean = x < y
override def lteqv(x: Char, y: Char): Boolean = x <= y
}
33 changes: 33 additions & 0 deletions kernel/src/main/scala/cats/kernel/instances/DoubleInstances.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package cats.kernel
package instances

trait DoubleInstances {
implicit val catsKernelStdOrderForDouble: Order[Double] with Hash[Double] = new DoubleOrder
implicit val catsKernelStdGroupForDouble: CommutativeGroup[Double] = new DoubleGroup
}

class DoubleGroup extends CommutativeGroup[Double] {
def combine(x: Double, y: Double): Double = x + y
def empty: Double = 0D
def inverse(x: Double): Double = -x
override def remove(x: Double, y: Double): Double = x - y
}

class DoubleOrder extends Order[Double] with Hash[Double] {

def hash(x: Double): Int = x.hashCode()
def compare(x: Double, y: Double): Int =
java.lang.Double.compare(x, y)

override def eqv(x: Double, y: Double): Boolean = x == y
override def neqv(x: Double, y: Double): Boolean = x != y
override def gt(x: Double, y: Double): Boolean = x > y
override def gteqv(x: Double, y: Double): Boolean = x >= y
override def lt(x: Double, y: Double): Boolean = x < y
override def lteqv(x: Double, y: Double): Boolean = x <= y

override def min(x: Double, y: Double): Double =
Math.min(x, y)
override def max(x: Double, y: Double): Double =
Math.max(x, y)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package cats.kernel
package instances

import scala.concurrent.duration.Duration

trait DurationInstances {
implicit val catsKernelStdOrderForDuration: Order[Duration] with Hash[Duration] = new DurationOrder
implicit val catsKernelStdGroupForDuration: CommutativeGroup[Duration] = new DurationGroup
}

// Duration.Undefined, Duration.Inf, Duration.MinusInf

/**
* This ordering is valid for all defined durations.
*
* The value Duration.Undefined breaks our laws, because undefined
* values are not equal to themselves.
*/
class DurationOrder extends Order[Duration] with Hash[Duration] {
def hash(x: Duration): Int = x.hashCode()

def compare(x: Duration, y: Duration): Int = x.compare(y)

override def eqv(x: Duration, y: Duration): Boolean = x == y
override def neqv(x: Duration, y: Duration): Boolean = x != y
override def gt(x: Duration, y: Duration): Boolean = x > y
override def gteqv(x: Duration, y: Duration): Boolean = x >= y
override def lt(x: Duration, y: Duration): Boolean = x < y
override def lteqv(x: Duration, y: Duration): Boolean = x <= y

override def min(x: Duration, y: Duration): Duration = x.min(y)
override def max(x: Duration, y: Duration): Duration = x.max(y)
}

/**
* This group models addition, but has a few problematic edge cases.
*
* 1. finite values can overflow, throwing an exception
* 2. inf + (-inf) = undefined, not zero
* 3. undefined + zero = undefined
*/
class DurationGroup extends CommutativeGroup[Duration] {
def empty: Duration = Duration.Zero
def inverse(x: Duration): Duration = -x
def combine(x: Duration, y: Duration): Duration = x + y
override def remove(x: Duration, y: Duration): Duration = x - y
}
Loading