Skip to content

Commit

Permalink
Merge pull request #208 from typelevel/sbt-typelevel
Browse files Browse the repository at this point in the history
Adopt sbt-typelevel
  • Loading branch information
rossabaker authored Jan 16, 2022
2 parents 146c4f7 + fdd95a3 commit 02c05b6
Show file tree
Hide file tree
Showing 15 changed files with 151 additions and 62 deletions.
42 changes: 29 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ on:
branches: ['**']
push:
branches: ['**']
tags: [v*, v*]
tags: [v*]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
PGP_SECRET: ${{ secrets.PGP_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
Expand All @@ -27,18 +28,20 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.8, 3.0.2]
java: [adopt@1.8]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: temurin
java-version: 8

- name: Cache sbt
uses: actions/cache@v2
Expand Down Expand Up @@ -69,6 +72,9 @@ jobs:
- if: matrix.scala == '2.13.8'
run: sbt ++${{ matrix.scala }} ++2.13.8 site/makeMicrosite

- name: Make target directories
run: mkdir -p testing/.jvm/target core/.js/target testing/.js/target core/.jvm/target tests/js/target tests/jvm/target target bench/target project/target

- name: Compress target directories
run: tar cf targets.tar testing/.jvm/target core/.js/target testing/.js/target core/.jvm/target tests/js/target tests/jvm/target target bench/target project/target

Expand All @@ -81,23 +87,25 @@ jobs:
publish:
name: Publish Artifacts
needs: [build]
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v'))
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.8]
java: [adopt@1.8]
scala: [3.0.2]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup Java and Scala
uses: olafurpg/setup-scala@v13
- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: temurin
java-version: 8

- name: Cache sbt
uses: actions/cache@v2
Expand Down Expand Up @@ -142,8 +150,16 @@ jobs:
rm targets.tar
- name: Import signing key
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == ''
run: echo $PGP_SECRET | base64 -d | gpg --import

- name: Import signing key and strip passphrase
if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != ''
run: |
echo "$PGP_SECRET" | base64 -d > /tmp/signing-key.gpg
echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg
(echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1)
- run: sbt ++${{ matrix.scala }} release

- run: |
Expand Down
2 changes: 2 additions & 0 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version = 3.3.1

runner.dialect = Scala213Source3

style = default

maxColumn = 100
Expand Down
12 changes: 11 additions & 1 deletion bench/src/main/scala/com/rossabaker/ci/bench/CIStringBench.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
* Copyright 2020 Typelevel
*
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.ci
Expand Down
43 changes: 6 additions & 37 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ val catsV = "2.7.0"
val scalacheckV = "1.15.4"
val disciplineMunitV = "1.0.9"

enablePlugins(SonatypeCiReleasePlugin)
ThisBuild / tlVersionIntroduced := Map(
"3" -> "1.1.4"
)

// Projects
lazy val `case-insensitive` = project
Expand All @@ -17,24 +19,16 @@ lazy val `case-insensitive` = project
lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("core"))
.settings(commonSettings)
.settings(
name := "case-insensitive",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsV
),
Compile / unmanagedSourceDirectories ++= {
val major = if (isDotty.value) "-3" else "-2"
List(CrossType.Pure, CrossType.Full).flatMap(
_.sharedSrcDir(baseDirectory.value, "main").toList.map(f => file(f.getPath + major))
)
}
)
)

lazy val testing = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.in(file("testing"))
.settings(commonSettings)
.settings(
name := "case-insensitive-testing",
libraryDependencies ++= Seq(
Expand All @@ -50,7 +44,6 @@ lazy val tests = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full)
.in(file("tests"))
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.settings(
name := "case-insensitive-tests",
libraryDependencies ++= Seq(
Expand Down Expand Up @@ -78,7 +71,6 @@ lazy val bench = project
.in(file("bench"))
.enablePlugins(NoPublishPlugin)
.enablePlugins(JmhPlugin)
.settings(commonSettings)
.settings(
name := "case-insensitive-bench"
)
Expand All @@ -89,7 +81,6 @@ lazy val site = project
.enablePlugins(MicrositesPlugin)
.enablePlugins(MdocPlugin)
.enablePlugins(NoPublishPlugin)
.settings(commonSettings)
.dependsOn(core.jvm, testing.jvm)
.settings {
import microsites._
Expand Down Expand Up @@ -129,38 +120,16 @@ lazy val site = project
),
}

// General Settings
lazy val commonSettings = Seq(
headerLicenseStyle := HeaderLicenseStyle.SpdxSyntax
) ++ automateHeaderSettings(Compile, Test)

val Scala213 = "2.13.8"
val Scala213Cond = s"matrix.scala == '$Scala213'"

// General Settings
inThisBuild(
List(
organization := "org.typelevel",
organizationName := "Typelevel",
publishGithubUser := "rossabaker",
publishFullName := "Ross A. Baker",
baseVersion := "1.1",
tlBaseVersion := "1.2",
crossScalaVersions := Seq("2.12.15", Scala213, "3.0.2"),
scalaVersion := crossScalaVersions.value.filter(_.startsWith("2.")).last,
versionIntroduced := Map(
"3.0.0-RC1" -> "1.0.0",
"3.0.0-RC2" -> "1.0.1",
"3.0.0-RC3" -> "1.1.3"
),
homepage := Some(url("https://github.com/typelevel/case-insensitive")),
homepage := Some(url("https://typelevel.org/case-insensitive")),
startYear := Some(2020),
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),
scmInfo := Some(
ScmInfo(
url("https://github.com/typelevel/case-insensitive"),
"git@github.com:typelevel/case-insensitive.git")),
githubWorkflowTargetTags ++= Seq("v*"),
githubWorkflowPublishTargetBranches := Seq(RefPredicate.StartsWith(Ref.Tag("v"))),
githubWorkflowBuildPreamble ++= Seq(
WorkflowStep
.Use(UseRef.Public("actions", "setup-ruby", "v1"), params = Map("ruby-version" -> "2.7")),
Expand Down
12 changes: 11 additions & 1 deletion core/src/main/scala-2.12/org/typelevel/ci/compat.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
* Copyright 2020 Typelevel
*
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.ci
Expand Down
12 changes: 11 additions & 1 deletion core/src/main/scala-2.13/org/typelevel/ci/compat.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
* Copyright 2020 Typelevel
*
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.ci
Expand Down
12 changes: 11 additions & 1 deletion core/src/main/scala-3/org/typelevel/ci/compat.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
* Copyright 2020 Typelevel
*
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.ci
Expand Down
12 changes: 11 additions & 1 deletion core/src/main/scala/org/typelevel/ci/CIString.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
* Copyright 2020 Typelevel
*
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.ci
Expand Down
12 changes: 11 additions & 1 deletion core/src/main/scala/org/typelevel/ci/package.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
* Copyright 2020 Typelevel
*
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel
Expand Down
1 change: 1 addition & 0 deletions project/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
resolvers += Resolver.sonatypeRepo("snapshots")
3 changes: 2 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
addSbtPlugin("com.47deg" % "sbt-microsites" % "1.3.4")
addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.22.1")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.4.0-M3")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.2.24")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
* Copyright 2020 Typelevel
*
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.ci
Expand Down
12 changes: 11 additions & 1 deletion tests/jvm/src/test/scala/org/typelevel/ci/CIStringJVMSuite.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
/*
* Copyright 2020 Typelevel
*
* SPDX-License-Identifier: Apache-2.0
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.typelevel.ci
Expand Down
Loading

0 comments on commit 02c05b6

Please sign in to comment.