Skip to content

Commit 99b684a

Browse files
Added GitHub CI action (#45)
1 parent acc2234 commit 99b684a

8 files changed

Lines changed: 128 additions & 75 deletions

File tree

.github/workflows/ci.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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+
~/work/scommons-react-native/scommons-react-native/showcase/node_modules
49+
~/work/scommons-react-native/scommons-react-native/showcase/package-lock.json
50+
~/work/scommons-react-native/scommons-react-native/showcase/target/scala-2.13/scalajs-bundler/main/node_modules
51+
~/work/scommons-react-native/scommons-react-native/showcase/target/scala-2.13/scalajs-bundler/main/package-lock.json
52+
~/work/scommons-react-native/scommons-react-native/showcase/target/scala-2.13/scalajs-bundler/test/node_modules
53+
~/work/scommons-react-native/scommons-react-native/showcase/target/scala-2.13/scalajs-bundler/test/package-lock.json
54+
~/work/scommons-react-native/scommons-react-native/core/target/scala-2.13/scalajs-bundler/test/node_modules
55+
~/work/scommons-react-native/scommons-react-native/core/target/scala-2.13/scalajs-bundler/test/package-lock.json
56+
~/work/scommons-react-native/scommons-react-native/community/target/scala-2.13/scalajs-bundler/test/node_modules
57+
~/work/scommons-react-native/scommons-react-native/community/target/scala-2.13/scalajs-bundler/test/package-lock.json
58+
~/work/scommons-react-native/scommons-react-native/expo/target/scala-2.13/scalajs-bundler/test/node_modules
59+
~/work/scommons-react-native/scommons-react-native/expo/target/scala-2.13/scalajs-bundler/test/package-lock.json
60+
~/work/scommons-react-native/scommons-react-native/navigation/target/scala-2.13/scalajs-bundler/test/node_modules
61+
~/work/scommons-react-native/scommons-react-native/navigation/target/scala-2.13/scalajs-bundler/test/package-lock.json
62+
~/work/scommons-react-native/scommons-react-native/test/target/scala-2.13/scalajs-bundler/test/node_modules
63+
~/work/scommons-react-native/scommons-react-native/test/target/scala-2.13/scalajs-bundler/test/package-lock.json
64+
~/work/scommons-react-native/scommons-react-native/ui/target/scala-2.13/scalajs-bundler/test/node_modules
65+
~/work/scommons-react-native/scommons-react-native/ui/target/scala-2.13/scalajs-bundler/test/package-lock.json
66+
key: ${{ runner.os }}-node_modules-cache-v2-${{ hashFiles('**/package-lock.json') }}
67+
restore-keys: |
68+
${{ runner.os }}-node_modules-cache-v2-
69+
70+
- name: Extract Tag Name
71+
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
72+
if: ${{ startsWith(github.ref, 'refs/tags') }}
73+
74+
- name: Run tests
75+
run: |
76+
sbt -mem 2048 coverage test
77+
sbt coverageAggregate coveralls
78+
if: ${{ env.TAG_NAME == '' }}
79+
env:
80+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
81+
82+
- name: Publish SNAPSHOT
83+
run: |
84+
sbt clean publish
85+
echo "Publish to expo"
86+
sbt -mem 2048 "project scommons-react-native-showcase" fullOptJS
87+
cd showcase
88+
npm install
89+
npm install expo-cli --save-dev
90+
./node_modules/expo-cli/bin/expo.js login -u $EXPO_USERNAME -p $EXPO_PASSWORD
91+
EXPO_ENV=production ./node_modules/expo-cli/bin/expo.js publish --non-interactive
92+
if: ${{ !github.event.pull_request && env.TAG_NAME == '' }}
93+
env:
94+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
95+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
96+
EXPO_USERNAME: ${{ secrets.EXPO_USERNAME }}
97+
EXPO_PASSWORD: ${{ secrets.EXPO_PASSWORD }}
98+
99+
- name: Publish RELEASE
100+
run: |
101+
mkdir ./keys
102+
echo $PGP_PUBLIC | base64 --decode > ./keys/pubring.gpg
103+
echo $PGP_SECRET | base64 --decode > ./keys/secring.gpg
104+
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)"
105+
echo "Publish a release version=$VERSION for tag $TAG_NAME"
106+
version=$VERSION sbt clean publishSigned sonatypeBundleRelease
107+
if: ${{ env.TAG_NAME != '' }}
108+
env:
109+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
110+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
111+
PGP_PUBLIC: ${{ secrets.PGP_PUBLIC }}
112+
PGP_SECRET: ${{ secrets.PGP_SECRET }}
113+
PGP_PASS: ${{ secrets.PGP_PASS }}

.travis.yml

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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
[![Build Status](https://travis-ci.com/scommons/scommons-react-native.svg?branch=master)](https://travis-ci.com/scommons/scommons-react-native)
2+
[![CI](https://github.com/scommons/scommons-react-native/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/scommons/scommons-react-native/actions/workflows/ci.yml?query=workflow%3Aci+branch%3Amaster)
33
[![Coverage Status](https://coveralls.io/repos/github/scommons/scommons-react-native/badge.svg?branch=master)](https://coveralls.io/github/scommons/scommons-react-native?branch=master)
44
[![scala-index](https://index.scala-lang.org/scommons/scommons-react-native/scommons-react-native-core/latest.svg)](https://index.scala-lang.org/scommons/scommons-react-native/scommons-react-native-core)
55
[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-1.1.0.svg)](https://www.scala-js.org)
@@ -133,7 +133,7 @@ Note: Many examples are from an excellent book [React Native in Action](https://
133133
* [expo-sqlite](https://docs.expo.io/versions/latest/sdk/sqlite/)
134134
* [SQLite](showcase/src/main/scala/showcase/app/expo/sqlite/SQLiteDemo.scala) => [tests](showcase/src/test/scala/showcase/app/expo/sqlite/SQLiteDemoSpec.scala)
135135
* See [scommons-websql](https://github.com/scommons/scommons-websql) for how to:
136-
* use [quill](https://getquill.io) bindings with expo SQLite
136+
* use high-level `scommons-websql-io` module with expo SQLite
137137
* use `scommons-websql-migrations` to automate your DB schema versioning
138138

139139
### How to Build

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/common/Libs.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import scommons.sbtplugin.project.CommonLibs
66

77
object Libs extends CommonLibs {
88

9-
val scommonsApiVersion = "0.7.0"
10-
val scommonsReactVersion = "1.0.0-SNAPSHOT"
11-
val scommonsNodejsVersion = "0.7.0"
12-
val scommonsWebSqlVersion = "0.7.1"
9+
val scommonsApiVersion = "0.8.0"
10+
val scommonsReactVersion = "0.8.0"
11+
val scommonsNodejsVersion = "0.8.0"
12+
val scommonsWebSqlVersion = "0.8.0"
1313

1414
lazy val scommonsApiXhr = Def.setting("org.scommons.api" %%% "scommons-api-xhr" % scommonsApiVersion)
1515
lazy val scommonsReactCore = Def.setting("org.scommons.react" %%% "scommons-react-core" % scommonsReactVersion)

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import sbt._
77
import scalajsbundler.sbtplugin.ScalaJSBundlerPlugin
88
import scommons.sbtplugin.project.CommonMobileModule
99
import scoverage.ScoverageKeys.{coverageEnabled, coverageScalacPluginVersion}
10-
import scoverage.ScoverageSbtPlugin._
1110

1211
trait ScalaJsModule extends ReactNativeModule {
1312

@@ -24,14 +23,14 @@ trait ScalaJsModule extends ReactNativeModule {
2423
},
2524
libraryDependencies ~= { modules =>
2625
if (scalaJSVersion.startsWith("0.6")) modules
27-
else modules.filter(_.organization != OrgScoverage)
26+
else modules.filter(_.organization != "org.scoverage")
2827
},
2928
libraryDependencies ++= {
3029
if (coverageEnabled.value) {
3130
if (scalaJSVersion.startsWith("0.6")) Nil
3231
else Seq(
33-
OrgScoverage %% s"${ScalacRuntimeArtifact}_sjs1" % coverageScalacPluginVersion.value,
34-
OrgScoverage %% ScalacPluginArtifact % coverageScalacPluginVersion.value % ScoveragePluginConfig.name
32+
"org.scoverage" %% "scalac-scoverage-runtime_sjs1" % coverageScalacPluginVersion.value,
33+
"org.scoverage" %% "scalac-scoverage-plugin" % coverageScalacPluginVersion.value % "scoveragePlugin"
3534
)
3635
}
3736
else Nil

travis/secrets.tar.enc

-5.02 KB
Binary file not shown.

0 commit comments

Comments
 (0)