Skip to content
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

Adopt sbt-typelevel #208

Merged
merged 17 commits into from
Jan 16, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 26 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ on:
branches: ['**']
push:
branches: ['**']
tags: [v*, v*]
tags: [v*]

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

jobs:
build:
Expand All @@ -27,18 +26,20 @@ jobs:
matrix:
os: [ubuntu-latest]
scala: [2.12.15, 2.13.7, 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 +70,9 @@ jobs:
- if: matrix.scala == '2.13.7'
run: sbt ++${{ matrix.scala }} ++2.13.7 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 @@ -85,19 +89,21 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.7]
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 +148,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
45 changes: 8 additions & 37 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ val catsV = "2.7.0"
val scalacheckV = "1.15.4"
val disciplineMunitV = "1.0.9"

enablePlugins(SonatypeCiReleasePlugin)
enablePlugins(TypelevelPlugin)
rossabaker marked this conversation as resolved.
Show resolved Hide resolved

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

// Projects
lazy val `case-insensitive` = project
Expand All @@ -17,24 +21,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 +46,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 +73,6 @@ lazy val bench = project
.in(file("bench"))
.enablePlugins(NoPublishPlugin)
.enablePlugins(JmhPlugin)
.settings(commonSettings)
.settings(
name := "case-insensitive-bench"
)
Expand All @@ -89,7 +83,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 +122,16 @@ lazy val site = project
),
}

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

val Scala213 = "2.13.7"
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-9f1d5a7-SNAPSHOT")
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
1 change: 1 addition & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ in pkgs.stdenv.mkDerivation {
buildInputs = [
jekyll
pkgs.git
pkgs.nodejs-16_x
pkgs.sbt
];
}
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