Skip to content

Commit

Permalink
Attempt to set up sbt-ci-release
Browse files Browse the repository at this point in the history
  • Loading branch information
ceedubs committed Jan 21, 2019
1 parent 4228b03 commit 1145a6c
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 97 deletions.
49 changes: 30 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
language: scala
sudo: false
scala:
- 2.12.6
jdk:
- oraclejdk8

sbt_args: "-J-Xmx2G"
before_install:
- git fetch --tags

stages:
- name: test
- name: release
if: (branch = master AND type = push) OR (tag IS present)

jobs:
include:
- stage: Documentation
env: PHASE=A
- stage: Unit Tests
env: PHASE=B
- stage: Publish
env: PHASE=C

script:
- scripts/travis-ci.sh

after_script:
- find $HOME/.sbt -name "*.lock" | xargs rm
- find $HOME/.ivy2 -name "ivydata-*.properties" | xargs rm
- env: TEST="docs"
script: sbt tut
- env: TEST="test"
script: sbt +test
- env: TEST="coverage"
script: sbt coverage test && sbt coverageReport && bash <(curl -s https://codecov.io/bash)
- stage: release
script: sbt ci-release

# These directories are cached to S3 at the end of the build
cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot/
directories:
- $HOME/.sbt/1.0/dependency
- $HOME/.sbt/boot/scala*
- $HOME/.sbt/launchers
- $HOME/.ivy2/cache
- $HOME/.coursier

before_cache:
- du -h -d 1 $HOME/.ivy2/cache
- du -h -d 2 $HOME/.sbt/
- find $HOME/.sbt -name "*.lock" -type f -delete
- find $HOME/.ivy2/cache -name "ivydata-*.properties" -type f -delete
- rm -rf $HOME/.ivy2/local
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# irrec

[![Build Status](https://api.travis-ci.org/ceedubs/irrec.svg)](https://travis-ci.org/ceedubs/irrec)
[![Build Status](https://travis-ci.org/ceedubs/irrec.svg?branch=master)](https://travis-ci.org/ceedubs/irrec/branches)
[![codecov.io](http:https://codecov.io/github/ceedubs/irrec/coverage.svg?branch=master)](http:https://codecov.io/github/ceedubs/irrec?branch=master)

An implementation of regular expressions based on recursion schemes and Kleene algebras.
Expand Down
138 changes: 84 additions & 54 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import dependencies._

scalaVersion in ThisBuild := "2.12.6"

organization in ThisBuild := "ceedubs"
inThisBuild(List(
organization := "net.ceedubs",
homepage := Some(url("https://github.com/ceedubs/irrec")),
licenses := List("Apache-2.0" -> url("http:https://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"ceedubs",
"Cody Allen",
"[email protected]",
url("https://github.com/ceedubs")
)
)
))

version in ThisBuild := "0.1.0-SNAPSHOT"

coverageExcludedPackages in ThisBuild := "ceedubs.irrec.bench"

Expand Down Expand Up @@ -64,59 +73,80 @@ lazy val root = project
).aggregate(kleene, regex, regexGen)

// Thanks, Rob! https://tpolecat.github.io/2017/04/25/scalac-flags.html
val scalacOptionSettings: Seq[Setting[_]] = Seq(
scalacOptions ++= Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding", "utf-8", // Specify character encoding used by source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
"-Xfuture", // Turn on future language features.
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
"-Xlint:by-name-right-associative", // By-name parameter of right associative operator.
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
"-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:nullary-unit", // Warn when nullary methods return Unit.
"-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object.
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
"-Xlint:unsound-match", // Pattern match may not be typesafe.
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
"-Ypartial-unification", // Enable partial unification in type constructor inference
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused.
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
),
scalacOptions in (Compile, console) --= Seq("-Ywarn-unused:imports", "-Xfatal-warnings")
val scalac212Options: Seq[String] = Seq(
"-deprecation", // Emit warning and location for usages of deprecated APIs.
"-encoding", "utf-8", // Specify character encoding used by source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
"-Xfuture", // Turn on future language features.
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
"-Xlint:by-name-right-associative", // By-name parameter of right associative operator.
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
"-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:nullary-unit", // Warn when nullary methods return Unit.
"-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object.
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
"-Xlint:unsound-match", // Pattern match may not be typesafe.
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
"-Ypartial-unification", // Enable partial unification in type constructor inference
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused.
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
)

val scalac211Options: Seq[String] = {
val exclusions = Set(
"-Xlint:constant",
"-Ywarn-extra-implicit"
)
scalac212Options.filter(s =>
!s.startsWith("-Ywarn-unused") &&
!exclusions.contains(s))
}

val scalacOptionSettings: Seq[Setting[_]] = {
def baseScalaCOptions(scalaVersion: String) = CrossVersion.partialVersion(scalaVersion) match {
case Some((2, 11)) => scalac211Options
case _ => scalac212Options
}

Seq(
scalacOptions ++= baseScalaCOptions(scalaVersion.value),
scalacOptions in (Compile, console) --= Seq("-Ywarn-unused:imports", "-Xfatal-warnings")
)
}

val commonSettings: Seq[Setting[_]] = Seq(
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.7")
addCompilerPlugin("org.spire-math" %% "kind-projector" % "0.9.7"),
scalaVersion := "2.12.8",
crossScalaVersions := List("2.11.12", "2.12.8")
) ++ scalacOptionSettings

val noPublishSettings = Seq(
Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.3")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.7")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.3.4")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.2.1")
2 changes: 1 addition & 1 deletion readme/src/main/tut/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# irrec

[![Build Status](https://api.travis-ci.org/ceedubs/irrec.svg)](https://travis-ci.org/ceedubs/irrec)
[![Build Status](https://travis-ci.org/ceedubs/irrec.svg?branch=master)](https://travis-ci.org/ceedubs/irrec/branches)
[![codecov.io](http:https://codecov.io/github/ceedubs/irrec/coverage.svg?branch=master)](http:https://codecov.io/github/ceedubs/irrec?branch=master)

An implementation of regular expressions based on recursion schemes and Kleene algebras.
Expand Down
22 changes: 0 additions & 22 deletions scripts/travis-ci.sh

This file was deleted.

0 comments on commit 1145a6c

Please sign in to comment.