forked from tototoshi/sbt-slick-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin enhancement #1
Merged
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d773a30
enhance plugin
chunsenwang d9e5e87
fix publish ci
chunsenwang 3358c11
fix ci
chunsenwang f8c7f57
fix ci
chunsenwang 8bf0aca
set versionScheme
chunsenwang 7f9abd0
fix publish
chunsenwang 4bc7826
fix lint warn
chunsenwang 774b929
Merge remote-tracking branch 'origin/master' into chunsenwang/plugin-…
chunsenwang 2e9c324
fix posgres start logic, pull image before start
chunsenwang 23c5db0
fix container ready check logic
chunsenwang 64b9f01
fix tests
chunsenwang 8339516
clean unsed files
chunsenwang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -2,3 +2,51 @@ name: Publish | |
|
||
on: | ||
workflow_dispatch: | ||
|
||
# can maybe test via https://github.com/nektos/act | ||
# act -s DOCKER_USERNAME=abc -s DOCKER_PASSWORD=xyz --container-architecture linux/arm64 -W .github/workflows/release.yml release | ||
jobs: | ||
release: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
|
||
- name: Configure git user to push | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "sbt" | ||
|
||
- name: Clone and checkout to current branch | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up JDK 11 # it auto caches https://github.com/actions/setup-java#caching-packages-dependencies | ||
uses: actions/[email protected] | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
cache: 'sbt' | ||
|
||
- name: Publish | ||
run: ./scripts/github-actions/publish.sh | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} | ||
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} | ||
|
||
# - name: notify build status | ||
# if: always() | ||
# uses: slackapi/[email protected] | ||
# with: | ||
# # Slack channel id, channel name, or user id to post message. | ||
# # See also: https://api.slack.com/methods/chat.postMessage#channels | ||
# # You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs. | ||
# channel-id: ${{ github.event.repository.name }}-cicd | ||
# # For posting a simple plain text message, no md just for link shortening | ||
# slack-message: "${{ steps.build_info.outputs.tubi-project-name }}-v${{ steps.build_info.outputs.tubi-project-version }} release ${{ job.status }}: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
# env: | ||
# SLACK_BOT_TOKEN: ${{ secrets.BUILD_NOTIFY_SLACK_APP_TOKEN }} |
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 |
---|---|---|
|
@@ -4,3 +4,5 @@ | |
/project/project/ | ||
/project/target/ | ||
/target/ | ||
/.idea/ | ||
/.bsp/ |
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,11 @@ | ||
version = "3.4.3" | ||
runner.dialect = scala213 | ||
preset = IntelliJ | ||
maxColumn = 120 | ||
docstrings.style = SpaceAsterisk | ||
docstrings.wrap = "no" | ||
newlines.beforeCurlyLambdaParams = multiline | ||
rewrite.rules = [Imports] | ||
rewrite.imports.sort = scalastyle | ||
rewrite.imports.groups = [["sbt\\..*"], ["java\\..*", "javax\\..*"], ["scala\\..*"]] | ||
rewrite.trailingCommas.style = keep |
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 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,69 +1,34 @@ | ||
import scalariform.formatter.preferences._ | ||
import scala.collection.JavaConverters._ | ||
import java.lang.management.ManagementFactory | ||
|
||
import scala.collection.JavaConverters.* | ||
//import scalariform.formatter.preferences.* | ||
|
||
enablePlugins(SbtPlugin) | ||
|
||
scalariformPreferences := scalariformPreferences.value | ||
.setPreference(AlignSingleLineCaseStatements, true) | ||
.setPreference(DoubleIndentConstructorArguments, true) | ||
.setPreference(DanglingCloseParenthesis, Preserve) | ||
//scalariformPreferences := scalariformPreferences.value | ||
// .setPreference(AlignSingleLineCaseStatements, true) | ||
// .setPreference(DoubleIndentConstructorArguments, true) | ||
// .setPreference(DanglingCloseParenthesis, Preserve) | ||
|
||
sbtPlugin := true | ||
|
||
name := """sbt-slick-codegen""" | ||
|
||
organization := "com.github.tototoshi" | ||
|
||
version := "2.0.0" | ||
|
||
crossSbtVersions := Seq("1.8.0") | ||
|
||
val slickVersion = SettingKey[String]("slickVersion") | ||
|
||
slickVersion := "3.3.3" | ||
organization := "com.tubitv" | ||
version := "0.0.1-SNAPSHOT" | ||
|
||
libraryDependencies ++= Seq( | ||
"com.typesafe.slick" %% "slick" % slickVersion.value, | ||
"com.typesafe.slick" %% "slick-codegen" % slickVersion.value | ||
"com.typesafe.slick" %% "slick" % Versions.slick, | ||
"com.typesafe.slick" %% "slick-codegen" % Versions.slick, | ||
"org.postgresql" % "postgresql" % Versions.postgresql, | ||
"com.github.docker-java" % "docker-java" % Versions.dockerJava, | ||
) | ||
addSbtPlugin("io.github.davidmweber" % "flyway-sbt" % Versions.flywaySbt) | ||
|
||
publishMavenStyle := true | ||
|
||
publishTo := { | ||
val nexus = "https://oss.sonatype.org/" | ||
if (version.value.trim.endsWith("SNAPSHOT")) Some("snapshots" at nexus + "content/repositories/snapshots") | ||
else Some("releases" at nexus + "service/local/staging/deploy/maven2") | ||
} | ||
|
||
publishTo := Some(if (isSnapshot.value) Repo.Jfrog.Tubins.sbtDev else Repo.Jfrog.Tubins.sbtRelease) | ||
ThisBuild / versionScheme := Some("early-semver") | ||
Test / publishArtifact := false | ||
|
||
pomExtra := | ||
<url>https://github.com/tototoshi/sbt-slick-codegen</url> | ||
<licenses> | ||
<license> | ||
<name>Apache License, Version 2.0</name> | ||
<url>https://www.apache.org/licenses/LICENSE-2.0.html</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
<scm> | ||
<url>[email protected]:tototoshi/sbt-slick-codegen</url> | ||
<connection>scm:git:[email protected]:tototoshi/sbt-slick-codegen.git</connection> | ||
</scm> | ||
<developers> | ||
<developer> | ||
<id>tototoshi</id> | ||
<name>Toshiyuki Takahashi</name> | ||
<url>https://tototoshi.github.io</url> | ||
</developer> | ||
</developers> | ||
|
||
scriptedBufferLog := false | ||
scriptedLaunchOpts ++= ManagementFactory.getRuntimeMXBean.getInputArguments.asScala.toList.filter(a => | ||
Seq("-Xmx", "-Xms", "-XX", "-Dsbt.log.noformat").exists(a.startsWith) | ||
) | ||
scriptedLaunchOpts ++= Seq( | ||
"-Dplugin.version=" + version.value, | ||
"-Dslick.version=" + slickVersion.value | ||
scriptedLaunchOpts ++= ManagementFactory.getRuntimeMXBean.getInputArguments.asScala.toList.filter( | ||
a => Seq("-Xmx", "-Xms", "-XX", "-Dsbt.log.noformat").exists(a.startsWith) | ||
) | ||
scriptedLaunchOpts ++= Seq("-Dplugin.version=" + version.value, "-Dslick.version=" + Versions.slick) |
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,22 @@ | ||
<?xml version="1.0" ?> | ||
<configuration> | ||
<gui> | ||
<mainWindow> | ||
<location x="213" y="158"></location> | ||
<size w="1302" h="824"></size> | ||
<maximize>true</maximize> | ||
</mainWindow> | ||
<lookAndFeel>com.apple.laf.AquaLookAndFeel</lookAndFeel> | ||
</gui> | ||
<recentFilePaths> | ||
<filePath>/Users/chunsenwang/tubi/sbt-slick-codegen/target/scala-2.12/sbt-1.0/classes/com/github/tototoshi/sbt/slick/CodegenPlugin$.class</filePath> | ||
</recentFilePaths> | ||
<recentDirectories> | ||
<loadPath>/Users/chunsenwang/tubi/sbt-slick-codegen/target/scala-2.12/sbt-1.0/classes/com/github/tototoshi/sbt/slick</loadPath> | ||
<savePath>/Users/chunsenwang/tubi/sbt-slick-codegen</savePath> | ||
</recentDirectories> | ||
<preferences> | ||
<JdGuiPreferences.errorBackgroundColor>0xFF6666</JdGuiPreferences.errorBackgroundColor> | ||
<JdGuiPreferences.jdCoreVersion>1.1.3</JdGuiPreferences.jdCoreVersion> | ||
</preferences> | ||
</configuration> |
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,22 @@ | ||
import sbt.* | ||
|
||
object Repo { | ||
|
||
object Jfrog { | ||
private val domain = "tubins.jfrog.io" | ||
private val jFrogRoot = s"https://$domain" | ||
|
||
object Tubins { | ||
private val pathPrefix = "tubins" | ||
|
||
lazy val sbtDev: MavenRepository = "sbt-dev" at s"$jFrogRoot/$pathPrefix/sbt-dev" | ||
|
||
lazy val sbtRelease: MavenRepository = "sbt-release" at s"$jFrogRoot/$pathPrefix/sbt-release" | ||
|
||
lazy val jvmSnapshot: MavenRepository = "jvm-snapshot" at s"$jFrogRoot/$pathPrefix/jvm-snapshots" | ||
|
||
lazy val jvm: MavenRepository = "jvm-release" at s"$jFrogRoot/$pathPrefix/jvm" | ||
} | ||
} | ||
|
||
} |
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,6 @@ | ||
object Versions { | ||
val slick = "3.4.0" | ||
val postgresql = "42.6.0" | ||
val dockerJava = "3.3.4" | ||
val flywaySbt = "7.4.0" | ||
} |
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,23 @@ | ||
ThisBuild / credentials ++= { | ||
val logger = streams.value.log | ||
if (sys.env.contains("ARTIFACTORY_USERNAME")) { | ||
logger.info("spotted credential in env, will add to credentials") | ||
Some( | ||
Credentials( | ||
"Artifactory Realm", | ||
"tubins.jfrog.io", | ||
sys.env.getOrElse("ARTIFACTORY_USERNAME", ""), | ||
sys.env.getOrElse("ARTIFACTORY_PASSWORD", "") | ||
) | ||
) | ||
} else { | ||
Credentials.loadCredentials(Path.userHome / ".artifactory" / "credentials") match { | ||
case Right(credentials: DirectCredentials) => | ||
logger.info(s"Using credentials found in the home directory for host ${credentials.host}") | ||
Some(credentials) | ||
case Left(err: String) => | ||
logger.warn(s"Could not find artifactory credentials in home directory: $err") | ||
None | ||
} | ||
} | ||
} |
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,3 +1,3 @@ | ||
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3") | ||
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.18") | ||
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") | ||
//addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3") | ||
//addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "3.9.18") | ||
//addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env bash | ||
|
||
SBT_JVM_OPTS="-J-Xms4g -J-Xmx4g -J-Xss8m -J-XX:MaxMetaspaceSize=1024m -J-XX:+UseG1GC" | ||
sbt $SBT_JVM_OPTS publish | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
u dont need this