Skip to content

Commit

Permalink
Added GitHub CI action (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-podzigun authored Jan 31, 2022
1 parent 5e0ffcb commit df467d9
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 57 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: CI

on:
push:
branches: [ master ]
tags:
- '*'
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Git checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '12'

- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'

- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier/cache/v1
~/.cache/coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt', 'project/**/*.scala') }}

- name: Cache node_modules
uses: actions/cache@v2
with:
path: |
~/.npm
~/.nvm
~/work/scommons-react/scommons-react/core/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/core/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/dom/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/dom/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/redux/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/redux/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/showcase/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/showcase/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/test/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/test/target/scala-2.13/scalajs-bundler/test/package-lock.json
~/work/scommons-react/scommons-react/test-dom/target/scala-2.13/scalajs-bundler/test/node_modules
~/work/scommons-react/scommons-react/test-dom/target/scala-2.13/scalajs-bundler/test/package-lock.json
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node_modules-cache-v2-
- name: Extract Tag Name
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
if: ${{ startsWith(github.ref, 'refs/tags') }}

- name: Run tests
run: |
sbt coverage test
sbt coverageAggregate coveralls
if: ${{ env.TAG_NAME == '' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

- name: Publish SNAPSHOT
run: sbt clean publish
if: ${{ !github.event.pull_request && env.TAG_NAME == '' }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}

- name: Publish RELEASE
run: |
mkdir ./keys
echo $PGP_PUBLIC | base64 --decode > ./keys/pubring.gpg
echo $PGP_SECRET | base64 --decode > ./keys/secring.gpg
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)"
echo "Publish a release version=$VERSION for tag $TAG_NAME"
version=$VERSION sbt clean publishSigned sonatypeBundleRelease
if: ${{ env.TAG_NAME != '' }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PUBLIC: ${{ secrets.PGP_PUBLIC }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
PGP_PASS: ${{ secrets.PGP_PASS }}
44 changes: 0 additions & 44 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
@@ -1,5 +1,5 @@

[![Build Status](https://travis-ci.com/scommons/scommons-react.svg?branch=master)](https://travis-ci.com/scommons/scommons-react)
[![CI](https://github.com/scommons/scommons-react/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/scommons/scommons-react/actions/workflows/ci.yml?query=workflow%3Aci+branch%3Amaster)
[![Coverage Status](https://coveralls.io/repos/github/scommons/scommons-react/badge.svg?branch=master)](https://coveralls.io/github/scommons/scommons-react?branch=master)
[![scala-index](https://index.scala-lang.org/scommons/scommons-react/scommons-react-core/latest.svg)](https://index.scala-lang.org/scommons/scommons-react/scommons-react-core)
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-1.1.0.svg)](https://www.scala-js.org)
Expand Down
9 changes: 4 additions & 5 deletions pgp.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import java.util.Base64

//see: https://www.scala-sbt.org/sbt-pgp/usage.html

useGpg := false
pgpPublicRing := file("./travis/pubring.gpg")
pgpSecretRing := file("./travis/secring.gpg")
pgpPassphrase := sys.env.get("PGP_PASS").map(_.toArray)
pgpPublicRing := file("./keys/pubring.gpg")
pgpSecretRing := file("./keys/secring.gpg")
pgpPassphrase := sys.env.get("PGP_PASS").map(p => new String(Base64.getDecoder.decode(p)).toArray)
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/"
resolvers += "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/"

addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0-SNAPSHOT").changing())
//addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0")
//addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0-SNAPSHOT").changing())
addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.8.0")

addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.5")
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
Expand Down
2 changes: 1 addition & 1 deletion project/src/main/scala/common/Libs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scommons.sbtplugin.project.CommonLibs

object Libs extends CommonLibs {

val scommonsNodejsVersion = "0.7.0"
val scommonsNodejsVersion = "0.8.0"
private val sjsReactJsVer = "0.17.1"

lazy val sjsReactJsCore = Def.setting("org.scommons.shogowada" %%% "scalajs-reactjs-core" % sjsReactJsVer)
Expand Down
7 changes: 3 additions & 4 deletions project/src/main/scala/definitions/ScalaJsModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import sbt._
import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin
import scommons.sbtplugin.project.CommonNodeJsModule
import scoverage.ScoverageKeys.{coverageEnabled, coverageScalacPluginVersion}
import scoverage.ScoverageSbtPlugin._

trait ScalaJsModule extends ReactModule {

Expand All @@ -24,14 +23,14 @@ trait ScalaJsModule extends ReactModule {
},
libraryDependencies ~= { modules =>
if (scalaJSVersion.startsWith("0.6")) modules
else modules.filter(_.organization != OrgScoverage)
else modules.filter(_.organization != "org.scoverage")
},
libraryDependencies ++= {
if (coverageEnabled.value) {
if (scalaJSVersion.startsWith("0.6")) Nil
else Seq(
OrgScoverage %% s"${ScalacRuntimeArtifact}_sjs1" % coverageScalacPluginVersion.value,
OrgScoverage %% ScalacPluginArtifact % coverageScalacPluginVersion.value % ScoveragePluginConfig.name
"org.scoverage" %% "scalac-scoverage-runtime_sjs1" % coverageScalacPluginVersion.value,
"org.scoverage" %% "scalac-scoverage-plugin" % coverageScalacPluginVersion.value % "scoveragePlugin"
)
}
else Nil
Expand Down
Binary file removed travis/secrets.tar.enc
Binary file not shown.

0 comments on commit df467d9

Please sign in to comment.