Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
169 changes: 156 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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
118 changes: 14 additions & 104 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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)
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion core/src/test/scala/org/typelevel/discipline/laws.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Loading