diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f06ded..d87b4bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,11 +9,16 @@ name: Continuous Integration on: pull_request: - branches: [main] + branches: ['**'] push: - branches: [main] + branches: ['**'] + tags: [v*] env: + 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: @@ -24,6 +29,7 @@ jobs: os: [ubuntu-latest] scala: [3.0.2, 2.12.15, 2.13.8] java: [temurin@8] + project: [rootJS, rootJVM] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) @@ -50,19 +56,156 @@ jobs: ~/Library/Caches/Coursier/v1 key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - if: matrix.scala == '2.13.8' - uses: ruby/setup-ruby@v1 + - name: Check that workflows are up to date + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck + + - name: Check headers and formatting + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck + + - name: fastOptJS + if: matrix.project == 'rootJS' + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/fastOptJS + + - name: Test + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test + + - name: Check binary compatibility + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues + + - name: Generate API documentation + run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc + + - name: Make target directories + run: mkdir -p target .js/target site/target core/.js/target core/.jvm/target .jvm/target .native/target project/target + + - name: Compress target directories + run: tar cf targets.tar target .js/target site/target core/.js/target core/.jvm/target .jvm/target .native/target project/target + + - name: Upload target directories + uses: actions/upload-artifact@v2 with: - ruby-version: 2.6 + name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }} + path: targets.tar - - if: matrix.scala == '2.13.8' - run: gem install jekyll -v 4 + publish: + name: Publish Artifacts + needs: [build] + 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: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v2 + with: + fetch-depth: 0 - - name: Check that workflows are up to date - run: sbt ++${{ matrix.scala }} githubWorkflowCheck + - name: Setup Java (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 8 + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - name: Validate unit tests and binary compatibility - run: sbt ++${{ matrix.scala }} test mimaReportBinaryIssues + - name: Download target directories (3.0.2) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-3.0.2-${{ matrix.java }} - - if: matrix.scala == '2.13.8' - run: sbt ++${{ matrix.scala }} docs/makeMicrosite + - name: Inflate target directories (3.0.2) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.12.15) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-2.12.15-${{ matrix.java }} + + - name: Inflate target directories (2.12.15) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.13.8) + uses: actions/download-artifact@v2 + with: + name: target-${{ matrix.os }}-2.13.8-${{ matrix.java }} + + - name: Inflate target directories (2.13.8) + run: | + tar xf targets.tar + 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) + + - name: Publish + run: sbt '++${{ matrix.scala }}' tlRelease + + site: + name: Generate Site + strategy: + matrix: + os: [ubuntu-latest] + scala: [2.13.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 (temurin@8) + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v2 + with: + distribution: temurin + java-version: 8 + + - name: Cache sbt + uses: actions/cache@v2 + with: + path: | + ~/.sbt + ~/.ivy2/cache + ~/.coursier/cache/v1 + ~/.cache/coursier/v1 + ~/AppData/Local/Coursier/Cache/v1 + ~/Library/Caches/Coursier/v1 + key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + + - name: Generate site + run: sbt '++${{ matrix.scala }}' tlSite + + - name: Publish site + if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' + uses: peaceiris/actions-gh-pages@v3.8.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: site/target/docs/site + publish_branch: gh-pages diff --git a/build.sbt b/build.sbt index 08a85d0..8404af3 100644 --- a/build.sbt +++ b/build.sbt @@ -1,69 +1,28 @@ -import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType} - -ThisBuild / baseVersion := "1.4" - -ThisBuild / organization := "org.typelevel" -ThisBuild / organizationName := "Typelevel" +ThisBuild / tlBaseVersion := "1.4" ThisBuild / developers := List( - Developer("larsrh", "Lars Hupel", "", url("https://github.com/larsrh")), - Developer("travisbrown", "Travis Brown", "", url("https://github.com/travisbrown")), - Developer( - "ChristopherDavenport", - "Christopher Davenport", - "", - url("https://github.com/ChristopherDavenport") - ), - Developer("djspiewak", "Daniel Spiewak", "", url("https://github.com/djspiewak")), + tlGitHubDev("larsrh", "Lars Hupel"), + tlGitHubDev("travisbrown", "Travis Brown"), + tlGitHubDev("ChristopherDavenport", "Christopher Davenport"), + tlGitHubDev("djspiewak", "Daniel Spiewak"), Developer("vasilmkd", "Vasil Vasilev", "vasil@vasilev.io", url("https://github.com/vasilmkd")) ) val Scala213 = "2.13.8" ThisBuild / crossScalaVersions := Seq("3.0.2", "2.12.15", Scala213) - -ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("8")) - -ThisBuild / githubWorkflowUseSbtThinClient := false -ThisBuild / githubWorkflowTargetBranches := Seq("main") - -ThisBuild / homepage := Some(url("https://github.com/typelevel/discipline-specs2")) -ThisBuild / scmInfo := Some( - ScmInfo( - url("https://github.com/typelevel/discipline-specs2"), - "git@github.com:typelevel/discipline-specs2.git" - ) -) +ThisBuild / tlVersionIntroduced := Map("3" -> "1.1.6") ThisBuild / licenses := Seq("MIT" -> url("https://opensource.org/licenses/MIT")) ThisBuild / startYear := Some(2019) -ThisBuild / endYear := Some(2021) - -val MicrositesCond = s"matrix.scala == '$Scala213'" - -ThisBuild / githubWorkflowBuildPreamble ++= Seq( - WorkflowStep.Use( - UseRef.Public("ruby", "setup-ruby", "v1"), - params = Map("ruby-version" -> "2.6"), - cond = Some(MicrositesCond) - ), - WorkflowStep.Run(List("gem install jekyll -v 4"), cond = Some(MicrositesCond)) -) - -ThisBuild / githubWorkflowBuild := Seq( - WorkflowStep.Sbt( - List("test", "mimaReportBinaryIssues"), - name = Some("Validate unit tests and binary compatibility") - ), - WorkflowStep.Sbt(List("docs/makeMicrosite"), cond = Some(MicrositesCond)) -) +ThisBuild / tlSiteApiUrl := Some( + url("https://www.javadoc.io/doc/org.typelevel/discipline-specs2_2.13")) val disciplineV = "1.4.0" val specs2V = "4.13.2" val macrotaskExecutorV = "1.0.0" -lazy val `discipline-specs2` = - project.in(file(".")).aggregate(coreJVM, coreJS).enablePlugins(NoPublishPlugin) +lazy val root = tlCrossRootProject.aggregate(core) lazy val core = crossProject(JSPlatform, JVMPlatform) .crossType(CrossType.Pure) @@ -73,12 +32,12 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) libraryDependencies += "org.typelevel" %%% "discipline-core" % disciplineV, Compile / doc / sources := { val old = (Compile / doc / sources).value - if (isDotty.value) Seq() else old + if (tlIsScala3.value) Seq() else old } ) .jvmSettings( libraryDependencies += { - if (isDotty.value) + if (tlIsScala3.value) ("org.specs2" %%% "specs2-scalacheck" % specs2V) .cross(CrossVersion.for3Use2_13) .exclude("org.scalacheck", "scalacheck_2.13") @@ -87,8 +46,9 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) } ) .jsSettings( + tlVersionIntroduced ~= { _ ++ List("2.12", "2.13").map(_ -> "1.1.0").toMap }, libraryDependencies += { - if (isDotty.value) + if (tlIsScala3.value) ("org.specs2" %%% "specs2-scalacheck" % specs2V) .cross(CrossVersion.for3Use2_13) .exclude("org.scalacheck", "scalacheck_sjs1_2.13") @@ -99,54 +59,4 @@ lazy val core = crossProject(JSPlatform, JVMPlatform) libraryDependencies += "org.scala-js" %%% "scala-js-macrotask-executor" % macrotaskExecutorV ) -lazy val coreJVM = core.jvm -lazy val coreJS = core.js - -lazy val docs = project - .in(file("docs")) - .enablePlugins(MicrositesPlugin, NoPublishPlugin) - .settings(micrositeSettings) - .dependsOn(coreJVM) - -lazy val micrositeSettings = { - import microsites._ - Seq( - micrositeName := "discipline-specs2", - micrositeDescription := "Specs2 Integration for Discipline", - micrositeAuthor := "typelevel", - micrositeGithubOwner := "typelevel", - micrositeGithubRepo := "discipline-specs2", - micrositeBaseUrl := "/discipline-specs2", - micrositeDocumentationUrl := "https://www.javadoc.io/doc/org.typelevel/discipline-specs2_2.13", - micrositeGitterChannelUrl := "typelevel/cats", - micrositeFooterText := None, - micrositeHighlightTheme := "atom-one-light", - micrositePalette := Map( - "brand-primary" -> "#3e5b95", - "brand-secondary" -> "#294066", - "brand-tertiary" -> "#2d5799", - "gray-dark" -> "#49494B", - "gray" -> "#7B7B7E", - "gray-light" -> "#E5E5E6", - "gray-lighter" -> "#F4F3F4", - "white-color" -> "#FFFFFF" - ), - micrositeExtraMdFiles := Map( - file("CHANGELOG.md") -> ExtraMdFileConfig( - "changelog.md", - "page", - Map("title" -> "changelog", "section" -> "changelog", "position" -> "100") - ), - file("CODE_OF_CONDUCT.md") -> ExtraMdFileConfig( - "code-of-conduct.md", - "page", - Map("title" -> "code of conduct", "section" -> "code of conduct", "position" -> "101") - ), - file("LICENSE") -> ExtraMdFileConfig( - "license.md", - "page", - Map("title" -> "license", "section" -> "license", "position" -> "102") - ) - ) - ) -} +lazy val docs = project.in(file("site")).enablePlugins(TypelevelSitePlugin).dependsOn(core.jvm) diff --git a/core/src/main/scala/org/typelevel/discipline/specs2/Discipline.scala b/core/src/main/scala/org/typelevel/discipline/specs2/Discipline.scala index 3297efd..5af965c 100644 --- a/core/src/main/scala/org/typelevel/discipline/specs2/Discipline.scala +++ b/core/src/main/scala/org/typelevel/discipline/specs2/Discipline.scala @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Typelevel + * Copyright (c) 2019 Typelevel * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in diff --git a/core/src/main/scala/org/typelevel/discipline/specs2/mutable/Discipline.scala b/core/src/main/scala/org/typelevel/discipline/specs2/mutable/Discipline.scala index 3824857..0df66a2 100644 --- a/core/src/main/scala/org/typelevel/discipline/specs2/mutable/Discipline.scala +++ b/core/src/main/scala/org/typelevel/discipline/specs2/mutable/Discipline.scala @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Typelevel + * Copyright (c) 2019 Typelevel * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in diff --git a/core/src/test/scala/org/typelevel/discipline/laws.scala b/core/src/test/scala/org/typelevel/discipline/laws.scala index 72b15d9..0893194 100644 --- a/core/src/test/scala/org/typelevel/discipline/laws.scala +++ b/core/src/test/scala/org/typelevel/discipline/laws.scala @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Typelevel + * Copyright (c) 2019 Typelevel * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in diff --git a/core/src/test/scala/org/typelevel/discipline/specs2/DisciplineSpec.scala b/core/src/test/scala/org/typelevel/discipline/specs2/DisciplineSpec.scala index 0a92696..1ab79b2 100644 --- a/core/src/test/scala/org/typelevel/discipline/specs2/DisciplineSpec.scala +++ b/core/src/test/scala/org/typelevel/discipline/specs2/DisciplineSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Typelevel + * Copyright (c) 2019 Typelevel * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in diff --git a/core/src/test/scala/org/typelevel/discipline/specs2/mutable/MutableDisciplineSpec.scala b/core/src/test/scala/org/typelevel/discipline/specs2/mutable/MutableDisciplineSpec.scala index 4b9c2b6..9824965 100644 --- a/core/src/test/scala/org/typelevel/discipline/specs2/mutable/MutableDisciplineSpec.scala +++ b/core/src/test/scala/org/typelevel/discipline/specs2/mutable/MutableDisciplineSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Typelevel + * Copyright (c) 2019 Typelevel * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in diff --git a/core/src/test/scala/org/typelevel/discipline/specs2/mutable/PendingUntilFixedRegressionSpec.scala b/core/src/test/scala/org/typelevel/discipline/specs2/mutable/PendingUntilFixedRegressionSpec.scala index 987f716..c4667f8 100644 --- a/core/src/test/scala/org/typelevel/discipline/specs2/mutable/PendingUntilFixedRegressionSpec.scala +++ b/core/src/test/scala/org/typelevel/discipline/specs2/mutable/PendingUntilFixedRegressionSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021 Typelevel + * Copyright (c) 2019 Typelevel * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in diff --git a/docs/docs/index.md b/docs/docs/index.md deleted file mode 100644 index 393632a..0000000 --- a/docs/docs/index.md +++ /dev/null @@ -1,17 +0,0 @@ ---- -layout: home - ---- - -# discipline-specs2 - Specs2 Integration for Discipline [![Continuous Integration](https://github.com/typelevel/discipline-specs2/actions/workflows/ci.yml/badge.svg)](https://github.com/typelevel/discipline-specs2/actions/workflows/ci.yml) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.typelevel/discipline-specs2_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.typelevel/discipline-specs2_2.12) ![Code of Consuct](https://img.shields.io/badge/Code%20of%20Conduct-Scala-blue.svg) - -## Quick Start - -To use discipline-specs2 in an existing SBT project with Scala 2.12, 2.13 or 3.1, add the following dependencies to your -`build.sbt` depending on your needs: - -```scala -libraryDependencies ++= Seq( - "org.typelevel" %% "discipline-specs2" % "1.3.1" -) -``` diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..bc0a1e2 --- /dev/null +++ b/docs/index.md @@ -0,0 +1,14 @@ +# discipline-specs2 - Specs2 Integration for Discipline + +[![Continuous Integration](https://github.com/typelevel/discipline-specs2/actions/workflows/ci.yml/badge.svg)](https://github.com/typelevel/discipline-specs2/actions/workflows/ci.yml) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.typelevel/discipline-specs2_2.12/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.typelevel/discipline-specs2_2.12) ![Code of Consuct](https://img.shields.io/badge/Code%20of%20Conduct-Scala-blue.svg) + +## Quick Start + +To use discipline-specs2 in an existing SBT project with Scala 2.12, 2.13 or 3.1, add the following dependencies to your +`build.sbt` depending on your needs: + +```scala +libraryDependencies ++= Seq( + "org.typelevel" %% "discipline-specs2" % "@VERSION@" +) +``` diff --git a/project/plugins.sbt b/project/plugins.sbt index 00fb6e1..f250522 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,6 +1,4 @@ -addSbtPlugin("com.47deg" % "sbt-microsites" % "1.3.4") -addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") -addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.1.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.7.1") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") -addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.23.0") +val sbtTypelevelVersion = "0.4.0" +addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion) +addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion)