Skip to content

Commit

Permalink
Upgraded sbt to 1.6, scala.js to 1.8 and webpack to 5 (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor-podzigun committed Nov 16, 2022
1 parent badd9b9 commit b574db5
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 19 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: CI

on:
push:
paths-ignore:
- '*.md'
branches: [ master ]
tags:
- '*'
Expand All @@ -13,26 +15,26 @@ jobs:
runs-on: ubuntu-latest
steps:

- name: Git checkout
uses: actions/checkout@v2
- name: Git checkout (merge)
uses: actions/checkout@v3
if: github.event_name != 'pull_request'
with:
fetch-depth: 0

- name: Git checkout (PR)
uses: actions/checkout@v3
if: github.event_name == 'pull_request'
with:
fetch-depth: 0
# see: https://frontside.com/blog/2020-05-26-github-actions-pull_request/#how-does-pull_request-affect-actionscheckout
ref: ${{ github.event.pull_request.head.sha }}

- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v3
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') }}
cache: 'sbt'

- name: Extract Tag Name
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
Expand Down
2 changes: 2 additions & 0 deletions .sbtopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-J-Xmx2G
-J-XX:+UseG1GC
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version = 1.5.2
sbt.version = 1.6.2
8 changes: 4 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//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.9.0-SNAPSHOT").changing())
addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.9.0")
addSbtPlugin(("org.scommons.sbt" % "sbt-scommons-plugin" % "1.0.0-SNAPSHOT").changing())
//addSbtPlugin("org.scommons.sbt" % "sbt-scommons-plugin" % "0.9.0")

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

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.7.3")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.2.7")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3")
addSbtPlugin("org.scoverage" % "sbt-coveralls" % "1.3.2")
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 @@ -5,7 +5,7 @@ import scommons.sbtplugin.project.CommonLibs

object Libs extends CommonLibs {

private val scommonsApiVersion = "0.9.0"
private val scommonsApiVersion = "1.0.0-SNAPSHOT"

lazy val scommonsApiCore = Def.setting("org.scommons.api" %% "scommons-api-core" % scommonsApiVersion)
}
27 changes: 27 additions & 0 deletions project/src/main/scala/definitions/GitHubActionsCI.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package definitions

import org.scoverage.coveralls.CIService

import scala.io.Source
import scala.util.parsing.json.{JSON, JSONObject}

case object GitHubActionsCI extends CIService {
val name = ""
val jobId: Option[String] = sys.env.get("GITHUB_RUN_ID")

// https://github.com/coverallsapp/github-action/blob/master/src/run.ts#L31-L40
val pullRequest: Option[String] = for {
eventName <- sys.env.get("GITHUB_EVENT_NAME") if eventName.startsWith("pull_request")
payloadPath <- sys.env.get("GITHUB_EVENT_PATH")
source = Source.fromFile(payloadPath, "utf-8")
lines = try source.mkString finally source.close()
payload <- JSON.parseRaw(lines)
prNumber <- payload.asInstanceOf[JSONObject].obj.get("number")
} yield prNumber.toString.stripSuffix(".0")

// https://docs.github.com/en/actions/learn-github-actions/environment-variables
val currentBranch: Option[String] = pullRequest match {
case Some(_) => sys.env.get("GITHUB_HEAD_REF")
case None => sys.env.get("GITHUB_REF_NAME")
}
}
3 changes: 3 additions & 0 deletions project/src/main/scala/definitions/ServiceModule.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package definitions

import org.scoverage.coveralls.Imports.CoverallsKeys._
import sbt.Keys._
import sbt._
import scommons.sbtplugin.project.CommonModule
Expand All @@ -20,6 +21,8 @@ object ServiceModule {
val settings: Seq[Setting[_]] = Seq(
organization := "org.scommons.service",

coverallsService := GitHubActionsCI.jobId.map(_ => GitHubActionsCI),

//
// publish/release related settings:
//
Expand Down

0 comments on commit b574db5

Please sign in to comment.