Skip to content

Commit

Permalink
Merge pull request #20 from mkurz/sbt-ci-release
Browse files Browse the repository at this point in the history
Upgrade to latest sbt-js-engine, use GHA + sbt-ci-release, change groupId
  • Loading branch information
mkurz authored Jan 25, 2024
2 parents 2a2708a + 33c9ec4 commit c013b7b
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 164 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check

on:
pull_request:

push:
branches:
- main # Check branch after merge

concurrency:
# Only run once for latest commit per ref and cancel other (previous) runs.
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Tests
uses: playframework/.github/.github/workflows/cmd.yml@v3
with:
java: 21, 17, 11, 8
scala: 2.12.18
cmd: |
sbt ++$MATRIX_SCALA test ^scripted
finish:
name: Finish
if: github.event_name == 'pull_request'
needs: # Should be last
- "tests"
uses: playframework/.github/.github/workflows/rtm.yml@v3
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish

on:
push:
branches: # Snapshots
- main
tags: ["**"] # Releases

jobs:
publish-artifacts:
name: JDK 8
runs-on: ubuntu-20.04
if: ${{ github.repository_owner == 'sbt' }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# we don't know what commit the last tag was it's safer to get entire repo so previousStableVersion resolves
fetch-depth: 0

- name: Coursier Cache
id: coursier-cache
uses: coursier/cache-action@v6

- name: Install Adoptium Temurin OpenJDK
uses: coursier/setup-action@v1
with:
jvm: adoptium:8

- name: Publish artifacts
run: sbt ci-release
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}

- name: Cleanup before cache
shell: bash
run: |
find $HOME/Library/Caches/Coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ project/plugins/project/
.idea/
.idea_modules/

.DS_Store
.DS_Store

.bsp/
12 changes: 0 additions & 12 deletions .travis.yml

This file was deleted.

104 changes: 0 additions & 104 deletions CONTRIBUTING.md

This file was deleted.

20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
sbt-stylus
==========

[![Build Status](https://api.travis-ci.org/sbt/sbt-stylus.png?branch=master)](https://travis-ci.org/sbt/sbt-stylus) [![Download](https://api.bintray.com/packages/sbt-web/sbt-plugin-releases/sbt-stylus/images/download.svg)](https://bintray.com/sbt-web/sbt-plugin-releases/sbt-stylus/_latestVersion)
[![Build Status](https://github.com/sbt/sbt-stylus/actions/workflows/build-test.yml/badge.svg)](https://github.com/sbt/sbt-stylus/actions/workflows/build-test.yml)

> Note that this plugin is presently only working with an engineType set to Node e.g.:
> Note that this plugin is presently only working with an engineType set to Node e.g. (which is the default if a `node` command can be detected):
> `set JsEngineKeys.engineType := JsEngineKeys.EngineType.Node`
Allows stylus to be used from within sbt. Builds on com.typesafe.sbt:js-engine in order to execute the stylus compiler along with
Allows stylus to be used from within sbt. Builds on com.github.sbt:sbt-js-engine in order to execute the stylus compiler along with
the scripts to verify. js-engine enables high performance linting given parallelism and native JS engine execution.

To use this plugin use the addSbtPlugin command within your project's plugins.sbt (or as a global setting) i.e.:

```scala
addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % "1.1.0")
addSbtPlugin("com.github.sbt" % "sbt-stylus" % "1.2.0")
```

Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:
Expand All @@ -31,7 +31,7 @@ plugins | List of extra styles plugins to enable.
## Use Nib:

```scala
StylusKeys.useNib in Assets := true
Assets / StylusKeys.useNib := true
```

```stylus
Expand Down Expand Up @@ -63,7 +63,7 @@ StylusKeys.plugins = Vector("nib", "jeet")
The following sbt code illustrates how compression can be enabled:

```scala
StylusKeys.compress in Assets := true
Assets / StylusKeys.compress := true
```

## File filters
Expand All @@ -73,7 +73,7 @@ that are required for compilation. Beyond just `main.styl`, you can use an expre
following:

```scala
includeFilter in (Assets, StylusKeys.stylus) := "foo.styl" | "bar.styl"
(Assets / StylusKeys.stylus / includeFilter := "foo.styl" | "bar.styl"
```

...where both `foo.styl` and `bar.styl` will be considered for the Stylus compiler.
Expand All @@ -86,9 +86,7 @@ you may have a convention where any Stylus file starting with an `_` should not
include all `.styl` files but exclude any beginning with an `_` you can use the following declaration:

```scala
includeFilter in (Assets, StylusKeys.stylus) := "*.styl"
Assets / StylusKeys.stylus / includeFilter := "*.styl"

excludeFilter in (Assets, StylusKeys.stylus) := "_*.styl"
Assets / StylusKeys.stylus / excludeFilter := "_*.styl"
```

© Typesafe Inc., 2014
26 changes: 24 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
name := "sbt-stylus"
lazy val `sbt-stylus` = project in file(".")

enablePlugins(SbtWebBase)

sonatypeProfileName := "com.github.sbt.sbt-stylus" // See https://issues.sonatype.org/browse/OSSRH-77819#comment-1203625

description := "sbt-web plugin for running stylus"

developers += Developer(
"playframework",
"The Play Framework Team",
"[email protected]",
url("https://github.com/playframework")
)

addSbtJsEngine("1.3.5")

libraryDependencies ++= Seq(
"com.typesafe" % "jstranspiler" % "1.0.1",
"org.webjars" % "mkdirp" % "0.3.5",
Expand All @@ -9,4 +23,12 @@ libraryDependencies ++= Seq(
"org.webjars" % "when-node" % "3.5.2-3"
)

addSbtJsEngine("1.2.2")
// Customise sbt-dynver's behaviour to make it work with tags which aren't v-prefixed
ThisBuild / dynverVTagPrefix := false

// Sanity-check: assert that version comes from a tag (e.g. not a too-shallow clone)
// https://github.com/dwijnand/sbt-dynver/#sanity-checking-the-version
Global / onLoad := (Global / onLoad).value.andThen { s =>
dynverAssertTagVersion.value
s
}
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.0.1
sbt.version=1.9.7
4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-web-build-base" % "1.2.0")
addSbtPlugin("com.github.sbt" % "sbt-web-build-base" % "2.0.2")

addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")
2 changes: 1 addition & 1 deletion sbt-stylus-tester/build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
lazy val root = (project in file(".")).enablePlugins(SbtWeb)

StylusKeys.useNib in Assets := true
Assets / StylusKeys.useNib := true
2 changes: 1 addition & 1 deletion sbt-stylus-tester/project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.16
sbt.version=1.9.7
4 changes: 2 additions & 2 deletions sbt-stylus-tester/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
lazy val root = Project("plugins", file(".")).dependsOn(plugin)
lazy val plugin = RootProject(file("..").getAbsoluteFile.toURI)

lazy val plugin = file("../").getCanonicalFile.toURI
lazy val root = (project in file(".")).dependsOn(plugin)
8 changes: 4 additions & 4 deletions src/main/scala/com/typesafe/sbt/stylus/SbtStylus.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ object SbtStylus extends AutoPlugin {
inConfig(Assets)(stylusUnscopedSettings) ++
inConfig(TestAssets)(stylusUnscopedSettings) ++
Seq(
taskMessage in Assets := "Stylus compiling",
taskMessage in TestAssets := "Stylus test compiling"
Assets / taskMessage := "Stylus compiling",
TestAssets / taskMessage := "Stylus test compiling"
)
) ++ SbtJsTask.addJsSourceFileTasks(stylus) ++ Seq(
stylus in Assets := (stylus in Assets).dependsOn(webModules in Assets).value,
stylus in TestAssets := (stylus in TestAssets).dependsOn(webModules in TestAssets).value
Assets / stylus := (Assets / stylus).dependsOn(Assets / webModules).value,
TestAssets / stylus := (TestAssets / stylus).dependsOn(TestAssets / webModules).value
)

}
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-stylus/error-output/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % sys.props("project.version"))
addSbtPlugin("com.github.sbt" % "sbt-stylus" % sys.props("project.version"))

This file was deleted.

2 changes: 1 addition & 1 deletion src/sbt-test/sbt-stylus/normal/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % sys.props("project.version"))
addSbtPlugin("com.github.sbt" % "sbt-stylus" % sys.props("project.version"))
2 changes: 1 addition & 1 deletion src/sbt-test/sbt-stylus/plugins/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % sys.props("project.version"))
addSbtPlugin("com.github.sbt" % "sbt-stylus" % sys.props("project.version"))

libraryDependencies += "org.webjars.bower" % "jeet" % "6.1.2"
1 change: 0 additions & 1 deletion version.sbt

This file was deleted.

0 comments on commit c013b7b

Please sign in to comment.