Skip to content

Commit 0e176ab

Browse files
authored
Replace GitHub actions with travis (#212)
1 parent 3014f37 commit 0e176ab

File tree

6 files changed

+172
-39
lines changed

6 files changed

+172
-39
lines changed

.github/workflows/ci.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Continuous Integration
9+
10+
on:
11+
pull_request:
12+
branches: [master]
13+
push:
14+
branches: [master]
15+
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
19+
jobs:
20+
build:
21+
name: Build and Test
22+
strategy:
23+
matrix:
24+
os: [ubuntu-latest]
25+
scala: [2.12.14]
26+
java: [temurin@8, temurin@11, temurin@17]
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- name: Checkout current branch (full)
30+
uses: actions/checkout@v2
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Setup Java (temurin@8)
35+
if: matrix.java == 'temurin@8'
36+
uses: actions/setup-java@v2
37+
with:
38+
distribution: temurin
39+
java-version: 8
40+
41+
- name: Setup Java (temurin@11)
42+
if: matrix.java == 'temurin@11'
43+
uses: actions/setup-java@v2
44+
with:
45+
distribution: temurin
46+
java-version: 11
47+
48+
- name: Setup Java (temurin@17)
49+
if: matrix.java == 'temurin@17'
50+
uses: actions/setup-java@v2
51+
with:
52+
distribution: temurin
53+
java-version: 17
54+
55+
- name: Cache sbt
56+
uses: actions/cache@v2
57+
with:
58+
path: |
59+
~/.sbt
60+
~/.ivy2/cache
61+
~/.coursier/cache/v1
62+
~/.cache/coursier/v1
63+
~/AppData/Local/Coursier/Cache/v1
64+
~/Library/Caches/Coursier/v1
65+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}
66+
67+
- name: Check that workflows are up to date
68+
run: sbt ++${{ matrix.scala }} githubWorkflowCheck
69+
70+
- name: Build project
71+
run: sbt ++${{ matrix.scala }} test

.github/workflows/clean.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# This file was automatically generated by sbt-github-actions using the
2+
# githubWorkflowGenerate task. You should add and commit this file to
3+
# your git repository. It goes without saying that you shouldn't edit
4+
# this file by hand! Instead, if you wish to make changes, you should
5+
# change your sbt build configuration to revise the workflow description
6+
# to meet your needs, then regenerate this file.
7+
8+
name: Clean
9+
10+
on: push
11+
12+
jobs:
13+
delete-artifacts:
14+
name: Delete Artifacts
15+
runs-on: ubuntu-latest
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
steps:
19+
- name: Delete artifacts
20+
run: |
21+
# Customize those three lines with your repository and credentials:
22+
REPO=${GITHUB_API_URL}/repos/${{ github.repository }}
23+
24+
# A shortcut to call GitHub API.
25+
ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; }
26+
27+
# A temporary file which receives HTTP response headers.
28+
TMPFILE=/tmp/tmp.$$
29+
30+
# An associative array, key: artifact name, value: number of artifacts of that name.
31+
declare -A ARTCOUNT
32+
33+
# Process all artifacts on this repository, loop on returned "pages".
34+
URL=$REPO/actions/artifacts
35+
while [[ -n "$URL" ]]; do
36+
37+
# Get current page, get response headers in a temporary file.
38+
JSON=$(ghapi --dump-header $TMPFILE "$URL")
39+
40+
# Get URL of next page. Will be empty if we are at the last page.
41+
URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*<//' -e 's/>.*//')
42+
rm -f $TMPFILE
43+
44+
# Number of artifacts on this page:
45+
COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') ))
46+
47+
# Loop on all artifacts on this page.
48+
for ((i=0; $i < $COUNT; i++)); do
49+
50+
# Get name of artifact and count instances of this name.
51+
name=$(jq <<<$JSON -r ".artifacts[$i].name?")
52+
ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1))
53+
54+
id=$(jq <<<$JSON -r ".artifacts[$i].id?")
55+
size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") ))
56+
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
57+
ghapi -X DELETE $REPO/actions/artifacts/$id
58+
done
59+
done

.github/workflows/format.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Scalafmt
2+
3+
on:
4+
pull_request:
5+
branches: ['**']
6+
7+
env:
8+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9+
10+
jobs:
11+
build:
12+
name: Code is formatted
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- name: Checkout current branch (full)
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Check project is formatted
24+
uses: jrouly/scalafmt-native-action@v1
25+
with:
26+
version: '3.4.3'

.travis.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

build.sbt

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import scala.collection.JavaConverters._
22

3-
scalaVersion := "2.12.10"
3+
scalaVersion := "2.12.15"
44

55
sbtPlugin := true
66
crossSbtVersions := List("1.0.0")
@@ -30,7 +30,6 @@ organizationHomepage := Some(url("https://lightbend.com"))
3030
startYear := Some(2018)
3131

3232
enablePlugins(AutomateHeaderPlugin)
33-
scalafmtOnCompile := true
3433

3534
enablePlugins(SbtPlugin)
3635
scriptedLaunchOpts += ("-Dproject.version=" + version.value)
@@ -39,3 +38,14 @@ scriptedLaunchOpts ++= java.lang.management.ManagementFactory.getRuntimeMXBean.g
3938
)
4039

4140
packageSrc / publishArtifact := false
41+
42+
// Disable publish for now
43+
ThisBuild / githubWorkflowPublishTargetBranches := Seq()
44+
45+
ThisBuild / githubWorkflowJavaVersions := List(
46+
JavaSpec.temurin("8"),
47+
JavaSpec.temurin("11"),
48+
JavaSpec.temurin("17")
49+
)
50+
51+
ThisBuild / githubWorkflowTargetBranches := Seq("master")

project/plugins.sbt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
2-
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
3-
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.5")
1+
addSbtPlugin("com.dwijnand" % "sbt-dynver" % "4.1.1")
2+
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
3+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.5")
4+
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")

0 commit comments

Comments
 (0)