-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
86 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: [master] | ||
tags: ["*"] | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: git fetch --prune --unshallow | ||
- uses: olafurpg/setup-scala@v7 | ||
with: | ||
java-version: [email protected] | ||
- run: | | ||
sudo apt-get update && sudo apt-get -y install gnupg2 | ||
mkdir ~/.gnupg && chmod 700 ~/.gnupg | ||
echo use-agent >> ~/.gnupg/gpg.conf | ||
echo pinentry-mode loopback >> ~/.gnupg/gpg.conf | ||
echo allow-loopback-pinentry >> ~/.gnupg/gpg-agent.conf | ||
chmod 600 ~/.gnupg/* | ||
echo RELOADAGENT | gpg-connect-agent | ||
echo $PGP_SECRET | base64 --decode | gpg --import --no-tty --batch --yes | ||
env: | ||
PGP_SECRET: ${{secrets.PGP_SECRET}} | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.ivy2/cache | ||
key: ivy-${{hashFiles('**/*.sbt')}} | ||
restore-keys: | | ||
ivy- | ||
- uses: actions/cache@v1 | ||
with: | ||
path: ~/.sbt | ||
key: sbt-${{hashFiles('**/*.sbt')}}-${{hashFiles('project/build.properties')}} | ||
restore-keys: | | ||
sbt- | ||
- run: sbt ci-release | ||
env: | ||
PGP_PASSPHRASE: ${{secrets.PGP_PASSPHRASE}} | ||
PGP_SECRET: ${{secrets.PGP_SECRET}} | ||
SONATYPE_PASSWORD: ${{secrets.SONATYPE_PASSWORD}} | ||
SONATYPE_USERNAME: ${{secrets.SONATYPE_USERNAME}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
import com.typesafe.sbt.pgp.PgpKeys | ||
import sbt.Keys._ | ||
|
||
// compiler plugins | ||
addCompilerPlugin(scalafixSemanticdb) | ||
|
||
name := "scalac-scapegoat-plugin" | ||
|
||
organization := "com.sksamuel.scapegoat" | ||
description := "Scala compiler plugin for static code analysis" | ||
homepage := Some(url("https://github.com/sksamuel/scapegoat")) | ||
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")) | ||
scmInfo := Some( | ||
ScmInfo( | ||
url("https://github.com/sksamuel/scapegoat"), | ||
"scm:[email protected]:sksamuel/scapegoat.git", | ||
Some("scm:[email protected]:sksamuel/scapegoat.git") | ||
) | ||
) | ||
developers := List( | ||
Developer( | ||
"sksamuel", | ||
"sksamuel", | ||
"@sksamuel", | ||
url("https://github.com/sksamuel") | ||
) | ||
) | ||
|
||
scalaVersion := "2.13.1" | ||
crossScalaVersions := Seq("2.11.12", "2.12.10", "2.12.11", "2.13.0", "2.13.1") | ||
autoScalaLibrary := false | ||
crossVersion := CrossVersion.full | ||
crossTarget := { | ||
// workaround for https://github.com/sbt/sbt/issues/5097 | ||
target.value / s"scala-${scalaVersion.value}" | ||
} | ||
releaseCrossBuild := true | ||
|
||
sbtVersion in Global := "1.1.6" | ||
|
||
SbtPgp.autoImport.useGpg := true | ||
|
||
SbtPgp.autoImport.useGpgAgent := true | ||
// https://github.com/sksamuel/scapegoat/issues/298 | ||
ThisBuild / useCoursier := false | ||
|
||
val scalac13Options = Seq( | ||
"-Xlint:adapted-args", | ||
|
@@ -31,7 +43,6 @@ val scalac13Options = Seq( | |
"-Yrangepos", | ||
"-Ywarn-unused" | ||
) | ||
|
||
val scalac12Options = Seq( | ||
"-Xlint:adapted-args", | ||
"-Ywarn-inaccessible", | ||
|
@@ -41,7 +52,6 @@ val scalac12Options = Seq( | |
"-Xmax-classfile-name", | ||
"254" | ||
) | ||
|
||
val scalac11Options = Seq( | ||
"-Ywarn-adapted-args", | ||
"-Ywarn-inaccessible", | ||
|
@@ -54,7 +64,6 @@ val scalac11Options = Seq( | |
"254" | ||
//"-Ywarn-value-discard" | ||
) | ||
|
||
scalacOptions := { | ||
val common = Seq( | ||
"-unchecked", | ||
|
@@ -64,16 +73,16 @@ scalacOptions := { | |
"utf8", | ||
"-Xlint" | ||
) | ||
|
||
common ++ (scalaBinaryVersion.value match { | ||
case "2.11" => scalac11Options | ||
case "2.12" => scalac12Options | ||
case "2.13" => scalac13Options | ||
}) | ||
} | ||
javacOptions ++= Seq("-source", "1.8", "-target", "1.8") | ||
|
||
fullClasspath in console in Compile ++= (fullClasspath in Test).value // because that's where "PluginRunner" is | ||
|
||
// because that's where "PluginRunner" is | ||
fullClasspath in console in Compile ++= (fullClasspath in Test).value | ||
initialCommands in console := s""" | ||
import com.sksamuel.scapegoat._ | ||
def check(code: String) = { | ||
|
@@ -87,8 +96,6 @@ def check(code: String) = { | |
} | ||
""" | ||
|
||
javacOptions ++= Seq("-source", "1.8", "-target", "1.8") | ||
|
||
libraryDependencies ++= Seq( | ||
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided", | ||
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "provided", | ||
|
@@ -107,65 +114,28 @@ libraryDependencies ++= Seq( | |
"org.slf4j" % "slf4j-api" % "1.7.30" % "test" | ||
) | ||
|
||
sbtrelease.ReleasePlugin.autoImport.releasePublishArtifactsAction := PgpKeys.publishSigned.value | ||
|
||
sbtrelease.ReleasePlugin.autoImport.releaseCrossBuild := true | ||
|
||
publishTo := Some( | ||
if (isSnapshot.value) | ||
Opts.resolver.sonatypeSnapshots | ||
else | ||
Opts.resolver.sonatypeStaging | ||
) | ||
|
||
publishMavenStyle := true | ||
|
||
publishArtifact in Test := false | ||
|
||
// Test | ||
fork in (Test, run) := true | ||
logBuffered in Test := false | ||
parallelExecution in Test := false | ||
|
||
pomIncludeRepository := { _ => false } | ||
|
||
pomExtra := { | ||
<url>https://github.com/sksamuel/scapegoat</url> | ||
<licenses> | ||
<license> | ||
<name>Apache 2</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
<scm> | ||
<url>git@github.com:sksamuel/scapegoat.git</url> | ||
<connection>scm:git@github.com:sksamuel/scapegoat.git</connection> | ||
</scm> | ||
<developers> | ||
<developer> | ||
<id>sksamuel</id> | ||
<name>sksamuel</name> | ||
<url>http://github.com/sksamuel</url> | ||
</developer> | ||
</developers> | ||
} | ||
// ScalaTest reporter config: | ||
// -o - standard output, | ||
// D - show all durations, | ||
// T - show reminder of failed and cancelled tests with short stack traces, | ||
// F - show full stack traces. | ||
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oDTF") | ||
|
||
// Assembly | ||
// include the scala xml and compat modules into the final jar, shaded | ||
assemblyShadeRules in assembly := Seq( | ||
ShadeRule.rename("scala.xml.**" -> "scapegoat.xml.@1").inAll, | ||
ShadeRule.rename("scala.collection.compat.**" -> "scapegoat.compat.@1").inAll | ||
) | ||
|
||
// do not run tests during assembly | ||
test in assembly := {} | ||
|
||
autoScalaLibrary := false | ||
makePom := makePom.dependsOn(assembly).value | ||
packageBin in Compile := crossTarget.value / (assemblyJarName in assembly).value | ||
|
||
// debug assembly process | ||
//logLevel in assembly := Level.Debug | ||
|
||
// https://github.com/sksamuel/scapegoat/issues/298 | ||
ThisBuild / useCoursier := false | ||
makePom := makePom.dependsOn(assembly).value | ||
test in assembly := {} // do not run tests during assembly | ||
publishArtifact in Test := false | ||
|
||
// Scalafix | ||
scalafixDependencies in ThisBuild += "com.nequissimus" %% "sort-imports" % "0.3.1" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.