Skip to content

Commit

Permalink
Replace travis with github actions (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich authored Jul 13, 2021
1 parent 450306f commit da8dd4c
Show file tree
Hide file tree
Showing 7 changed files with 143 additions and 29 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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: [[email protected]]
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'
59 changes: 59 additions & 0 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
@@ -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/.*<//' -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
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
19 changes: 17 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
3 changes: 0 additions & 3 deletions travis-jvmopts

This file was deleted.

0 comments on commit da8dd4c

Please sign in to comment.