diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0317e9b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +# This file was automatically generated by sbt-github-actions using the +# githubWorkflowGenerate task. You should add and commit this file to +# your git repository. It goes without saying that you shouldn't edit +# this file by hand! Instead, if you wish to make changes, you should +# change your sbt build configuration to revise the workflow description +# to meet your needs, then regenerate this file. + +name: Continuous Integration + +on: + pull_request: + branches: ['**'] + push: + branches: ['**'] + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + name: Build and Test + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.10.7, 2.11.12, 2.12.14, 2.13.6] + java: [adopt@1.8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java and Scala + uses: olafurpg/setup-scala@v12 + with: + java-version: ${{ matrix.java }} + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: Check that workflows are up to date + run: sbt --client '++${{ matrix.scala }}; githubWorkflowCheck' + + - run: sbt --client '++${{ matrix.scala }}; mimaReportBinaryIssues' + + - run: sbt --client '++${{ matrix.scala }}; clean' + + - run: sbt --client '++${{ matrix.scala }}; coverage' + + - run: sbt --client '++${{ matrix.scala }}; test' + + - run: sbt --client '++${{ matrix.scala }}; coverageReport' + + - run: sbt --client '++${{ matrix.scala }}; coveralls' \ No newline at end of file diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 0000000..b535fcc --- /dev/null +++ b/.github/workflows/clean.yml @@ -0,0 +1,59 @@ +# This file was automatically generated by sbt-github-actions using the +# githubWorkflowGenerate task. You should add and commit this file to +# your git repository. It goes without saying that you shouldn't edit +# this file by hand! Instead, if you wish to make changes, you should +# change your sbt build configuration to revise the workflow description +# to meet your needs, then regenerate this file. + +name: Clean + +on: push + +jobs: + delete-artifacts: + name: Delete Artifacts + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Delete artifacts + run: | + # Customize those three lines with your repository and credentials: + REPO=${GITHUB_API_URL}/repos/${{ github.repository }} + + # A shortcut to call GitHub API. + ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; } + + # A temporary file which receives HTTP response headers. + TMPFILE=/tmp/tmp.$$ + + # An associative array, key: artifact name, value: number of artifacts of that name. + declare -A ARTCOUNT + + # Process all artifacts on this repository, loop on returned "pages". + URL=$REPO/actions/artifacts + while [[ -n "$URL" ]]; do + + # Get current page, get response headers in a temporary file. + JSON=$(ghapi --dump-header $TMPFILE "$URL") + + # Get URL of next page. Will be empty if we are at the last page. + URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*.*//') + rm -f $TMPFILE + + # Number of artifacts on this page: + COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') )) + + # Loop on all artifacts on this page. + for ((i=0; $i < $COUNT; i++)); do + + # Get name of artifact and count instances of this name. + name=$(jq <<<$JSON -r ".artifacts[$i].name?") + ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1)) + + id=$(jq <<<$JSON -r ".artifacts[$i].id?") + size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") )) + printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size + ghapi -X DELETE $REPO/actions/artifacts/$id + done + done \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 00708ee..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: scala -sudo: required -dist: trusty - -scala: - - 2.10.7 - - 2.11.12 - - 2.12.8 - - 2.13.4 -jdk: - - oraclejdk8 - - openjdk8 -cache: - directories: - - $HOME/.ivy2/cache - - $HOME/.sbt/boot/ - -install: /bin/true - -script: - - sbt ++$TRAVIS_SCALA_VERSION mimaReportBinaryIssues - - sbt ++$TRAVIS_SCALA_VERSION -jvm-opts travis-jvmopts clean coverage test coverageReport - - sbt ++$TRAVIS_SCALA_VERSION coveralls diff --git a/README.md b/README.md index e86e3f1..2bf6ec5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Ficus is a lightweight companion to Typesafe config that makes it more Scala-fri Ficus adds an `as[A]` method to a normal [Typesafe Config](http://lightbend.github.io/config/latest/api/com/typesafe/config/Config.html) so you can do things like `config.as[Option[Int]]`, `config.as[List[String]]`, or even `config.as[MyClass]`. It is implemented with type classes so that it is easily extensible and many silly mistakes can be caught by the compiler. -[![Build Status](https://travis-ci.org/iheartradio/ficus.svg?branch=master)](http://travis-ci.org/iheartradio/ficus) +[![Build Status](https://img.shields.io/github/workflow/status/iheartradio/ficus/Continuous%20Integration.svg)](https://github.com/iheartradio/ficus/actions) [![Join the chat at https://gitter.im/iheartradio/ficus](https://badges.gitter.im/iheartradio/ficus.svg)](https://gitter.im/iheartradio/ficus?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Coverage Status](https://coveralls.io/repos/github/iheartradio/ficus/badge.svg?branch=master)](https://coveralls.io/github/iheartradio/ficus?branch=master) [![Latest version](https://index.scala-lang.org/iheartradio/ficus/ficus/latest.svg?color=orange)](https://index.scala-lang.org/iheartradio/ficus) diff --git a/build.sbt b/build.sbt index 0fa6b01..690d235 100644 --- a/build.sbt +++ b/build.sbt @@ -7,14 +7,29 @@ lazy val gcTask = gc := { System gc() } +ThisBuild / githubWorkflowBuild := Seq( + WorkflowStep.Sbt(List("mimaReportBinaryIssues")), + WorkflowStep.Sbt(List("clean")), + WorkflowStep.Sbt(List("coverage")), + WorkflowStep.Sbt(List("test")) +) + +ThisBuild / githubWorkflowBuildPostamble ++= Seq( + WorkflowStep.Sbt(List("coverageReport")), + WorkflowStep.Sbt(List("coveralls")) +) + +ThisBuild / githubWorkflowPublishTargetBranches := Seq() + +ThisBuild / scalaVersion := "2.12.14" +ThisBuild / crossScalaVersions := Seq("2.10.7", "2.11.12", scalaVersion.value, "2.13.6") + lazy val root = project.in(file(".")) .settings( /* basic project info */ name := "ficus", description := "A Scala-friendly wrapper companion for Typesafe config", startYear := Some(2013), - scalaVersion := "2.12.14", - crossScalaVersions := Seq("2.10.7", "2.11.12", scalaVersion.value, "2.13.6"), scalacOptions ++= Seq( "-feature", "-deprecation", diff --git a/project/plugins.sbt b/project/plugins.sbt index 3cbe76f..01f20dc 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -11,3 +11,5 @@ addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.9.2") addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.7") addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.1.2") + +addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.12.0") diff --git a/travis-jvmopts b/travis-jvmopts deleted file mode 100644 index 44bd845..0000000 --- a/travis-jvmopts +++ /dev/null @@ -1,3 +0,0 @@ --Xss1M --Xms512M --Xmx512M