Skip to content

Commit 1989209

Browse files
Added GitHub CI action (#3)
1 parent bd42ff2 commit 1989209

File tree

7 files changed

+95
-56
lines changed

7 files changed

+95
-56
lines changed

.github/workflows/ci.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags:
7+
- '*'
8+
pull_request:
9+
branches: [ master ]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
16+
- name: Git checkout
17+
uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: '12'
25+
26+
- name: Set up JDK 8
27+
uses: actions/setup-java@v2
28+
with:
29+
java-version: '8'
30+
distribution: 'adopt'
31+
32+
- name: Cache sbt
33+
uses: actions/cache@v2
34+
with:
35+
path: |
36+
~/.sbt
37+
~/.ivy2/cache
38+
~/.coursier/cache/v1
39+
~/.cache/coursier/v1
40+
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt', 'project/**/*.scala') }}
41+
42+
- name: Cache node_modules
43+
uses: actions/cache@v2
44+
with:
45+
path: |
46+
~/.npm
47+
~/.nvm
48+
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('**/package-lock.json') }}
49+
restore-keys: |
50+
${{ runner.os }}-node_modules-cache-v2-
51+
52+
- name: Extract Tag Name
53+
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
54+
if: ${{ startsWith(github.ref, 'refs/tags') }}
55+
56+
- name: Run tests
57+
run: |
58+
sbt coverage test
59+
sbt coverageAggregate coveralls
60+
if: ${{ env.TAG_NAME == '' }}
61+
env:
62+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
63+
64+
- name: Publish SNAPSHOT
65+
run: sbt clean publish
66+
if: ${{ !github.event.pull_request && env.TAG_NAME == '' }}
67+
env:
68+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
69+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
70+
71+
- name: Publish RELEASE
72+
run: |
73+
mkdir ./keys
74+
echo $PGP_PUBLIC | base64 --decode > ./keys/pubring.gpg
75+
echo $PGP_SECRET | base64 --decode > ./keys/secring.gpg
76+
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)"
77+
echo "Publish a release version=$VERSION for tag $TAG_NAME"
78+
version=$VERSION sbt clean publishSigned sonatypeBundleRelease
79+
if: ${{ env.TAG_NAME != '' }}
80+
env:
81+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
82+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
83+
PGP_PUBLIC: ${{ secrets.PGP_PUBLIC }}
84+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
85+
PGP_PASS: ${{ secrets.PGP_PASS }}

.travis.yml

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

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
[![Build Status](https://travis-ci.com/scommons/scommons-api.svg?branch=master)](https://travis-ci.com/scommons/scommons-api)
2+
[![CI](https://github.com/scommons/scommons-api/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/scommons/scommons-api/actions/workflows/ci.yml?query=workflow%3Aci+branch%3Amaster)
33
[![Coverage Status](https://coveralls.io/repos/github/scommons/scommons-api/badge.svg?branch=master)](https://coveralls.io/github/scommons/scommons-api?branch=master)
44
[![scala-index](https://index.scala-lang.org/scommons/scommons-api/scommons-api-core/latest.svg)](https://index.scala-lang.org/scommons/scommons-api/scommons-api-core)
55
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-1.1.0.svg)](https://www.scala-js.org)

pgp.sbt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
import java.util.Base64
12

23
//see: https://www.scala-sbt.org/sbt-pgp/usage.html
3-
4-
useGpg := false
5-
pgpPublicRing := file("./travis/pubring.gpg")
6-
pgpSecretRing := file("./travis/secring.gpg")
7-
pgpPassphrase := sys.env.get("PGP_PASS").map(_.toArray)
4+
pgpPublicRing := file("./keys/pubring.gpg")
5+
pgpSecretRing := file("./keys/secring.gpg")
6+
pgpPassphrase := sys.env.get("PGP_PASS").map(p => new String(Base64.getDecoder.decode(p)).toArray)

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"
22
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"
33

4-
addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0-SNAPSHOT").changing())
5-
//addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0")
4+
//addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0-SNAPSHOT").changing())
5+
addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0")
66

77
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
88
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")

project/src/main/scala/definitions/ScalaJsModule.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport._
55
import sbt.Keys._
66
import sbt._
77
import scoverage.ScoverageKeys.{coverageEnabled, coverageScalacPluginVersion}
8-
import scoverage.ScoverageSbtPlugin._
98

109
object ScalaJsModule {
1110

@@ -26,14 +25,14 @@ object ScalaJsModule {
2625
},
2726
libraryDependencies ~= { modules =>
2827
if (scalaJSVersion.startsWith("0.6")) modules
29-
else modules.filter(_.organization != OrgScoverage)
28+
else modules.filter(_.organization != "org.scoverage")
3029
},
3130
libraryDependencies ++= {
3231
if (coverageEnabled.value) {
3332
if (scalaJSVersion.startsWith("0.6")) Nil
3433
else Seq(
35-
OrgScoverage %% s"${ScalacRuntimeArtifact}_sjs1" % coverageScalacPluginVersion.value,
36-
OrgScoverage %% ScalacPluginArtifact % coverageScalacPluginVersion.value % ScoveragePluginConfig.name
34+
"org.scoverage" %% "scalac-scoverage-runtime_sjs1" % coverageScalacPluginVersion.value,
35+
"org.scoverage" %% "scalac-scoverage-plugin" % coverageScalacPluginVersion.value % "scoveragePlugin"
3736
)
3837
}
3938
else Nil

travis/secrets.tar.enc

-5.02 KB
Binary file not shown.

0 commit comments

Comments
 (0)