Skip to content

Commit

Permalink
Merge pull request #428 from armanbilge/topic/laika
Browse files Browse the repository at this point in the history
Migrate site to Laika
  • Loading branch information
sh0hei authored Jun 12, 2022
2 parents 4dc76e7 + 4e68cc3 commit 684f069
Show file tree
Hide file tree
Showing 29 changed files with 151 additions and 295 deletions.
138 changes: 106 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ name: Continuous Integration

on:
pull_request:
branches: ['**']
branches: ['**', '!update/**', '!pr/**']
push:
branches: ['**']
branches: ['**', '!update/**', '!pr/**']
tags: [v*]

env:
Expand All @@ -30,6 +30,7 @@ jobs:
os: [ubuntu-latest]
scala: [3.1.1, 2.12.15, 2.13.8]
java: [temurin@8]
project: [rootJS, rootJVM]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout current branch (full)
Expand Down Expand Up @@ -65,49 +66,41 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7

- name: Install Jekyll
run: gem install jekyll -v 4.0.0

- name: Check that workflows are up to date
run: sbt '++${{ matrix.scala }}' 'project /' githubWorkflowCheck
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' 'project /' githubWorkflowCheck

- name: Check headers and formatting
if: matrix.java == 'temurin@8'
run: sbt '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: scalaJSLink
if: matrix.project == 'rootJS'
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' Test/scalaJSLinkerResult

- name: Test
run: sbt '++${{ matrix.scala }}' test
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' test

- name: Check binary compatibility
if: matrix.java == 'temurin@8'
run: sbt '++${{ matrix.scala }}' mimaReportBinaryIssues
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' mimaReportBinaryIssues

- name: Generate API documentation
if: matrix.java == 'temurin@8'
run: sbt '++${{ matrix.scala }}' doc

- name: Make microsite
if: matrix.scala == '2.13.8'
run: sbt '++${{ matrix.scala }}' makeMicrosite
run: sbt 'project ${{ matrix.project }}' '++${{ matrix.scala }}' doc

- name: Make target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: mkdir -p target docs/target core/.js/target laws/.js/target core/.jvm/target tests/.js/target laws/.jvm/target tests/.jvm/target project/target
run: mkdir -p target unidocs/target .js/target site/target core/.js/target laws/.js/target core/.jvm/target tests/.js/target .jvm/target .native/target laws/.jvm/target tests/.jvm/target project/target

- name: Compress target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
run: tar cf targets.tar target docs/target core/.js/target laws/.js/target core/.jvm/target tests/.js/target laws/.jvm/target tests/.jvm/target project/target
run: tar cf targets.tar target unidocs/target .js/target site/target core/.js/target laws/.js/target core/.jvm/target tests/.js/target .jvm/target .native/target laws/.jvm/target tests/.jvm/target project/target

- name: Upload target directories
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
uses: actions/upload-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}
name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }}
path: targets.tar

publish:
Expand Down Expand Up @@ -154,32 +147,62 @@ jobs:
~/Library/Caches/Coursier/v1
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Download target directories (3.1.1)
- name: Download target directories (3.1.1, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJS

- name: Inflate target directories (3.1.1, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (3.1.1, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1-rootJVM

- name: Inflate target directories (3.1.1, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.15, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJS

- name: Inflate target directories (2.12.15, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.15, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-3.1.1
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15-rootJVM

- name: Inflate target directories (3.1.1)
- name: Inflate target directories (2.12.15, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.12.15)
- name: Download target directories (2.13.8, rootJS)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.12.15
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJS

- name: Inflate target directories (2.12.15)
- name: Inflate target directories (2.13.8, rootJS)
run: |
tar xf targets.tar
rm targets.tar
- name: Download target directories (2.13.8)
- name: Download target directories (2.13.8, rootJVM)
uses: actions/download-artifact@v2
with:
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8
name: target-${{ matrix.os }}-${{ matrix.java }}-2.13.8-rootJVM

- name: Inflate target directories (2.13.8)
- name: Inflate target directories (2.13.8, rootJVM)
run: |
tar xf targets.tar
rm targets.tar
Expand All @@ -198,4 +221,55 @@ jobs:
- name: Publish
run: sbt '++${{ matrix.scala }}' tlRelease

- run: sbt '++${{ matrix.scala }}' publishMicrosite
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: Download Java (temurin@8)
id: download-java-temurin-8
if: matrix.java == 'temurin@8'
uses: typelevel/download-java@v1
with:
distribution: temurin
java-version: 8

- name: Setup Java (temurin@8)
if: matrix.java == 'temurin@8'
uses: actions/setup-java@v2
with:
distribution: jdkfile
java-version: 8
jdkFile: ${{ steps.download-java-temurin-8.outputs.jdkFile }}

- 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 }}' docs/tlSite

- name: Publish site
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: site/target/docs/site
keep_files: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<img src="https://github.com/typelevel/cats-mtl/raw/main/docs/src/main/resources/microsite/img/cats-mtl-logo-microsite.png" width="200px" height="231px" align="right">
<img src="https://typelevel.org/cats-mtl/img/cats-mtl-logo.png" width="200px" height="231px" align="right">

## Cats MTL

Expand Down
128 changes: 23 additions & 105 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import microsites._

ThisBuild / tlBaseVersion := "1.2"
ThisBuild / startYear := Some(2021)
ThisBuild / homepage := Some(url("https://typelevel.org/cats-mtl/"))
ThisBuild / developers := List(
tlGitHubDev("SystemFw", "Fabio Labella"),
tlGitHubDev("andyscott", "Andy Scott"),
Expand All @@ -17,24 +14,6 @@ val Scala213 = "2.13.8"
ThisBuild / crossScalaVersions := Seq("3.1.1", "2.12.15", Scala213)
ThisBuild / tlVersionIntroduced := Map("3" -> "1.2.1")

ThisBuild / githubWorkflowBuildPreamble ++= Seq(
WorkflowStep.Use(
UseRef.Public("ruby", "setup-ruby", "v1"),
name = Some("Setup Ruby"),
params = Map("ruby-version" -> "2.7")),
WorkflowStep.Run(List("gem install jekyll -v 4.0.0"), name = Some("Install Jekyll"))
)

ThisBuild / githubWorkflowBuild +=
WorkflowStep.Sbt(
List("makeMicrosite"),
name = Some("Make microsite"),
cond = Some(s"matrix.scala == '$Scala213'"))

ThisBuild / githubWorkflowPublishPostamble += WorkflowStep.Sbt(List("publishMicrosite"))

ThisBuild / testFrameworks += new TestFramework("munit.Framework")

lazy val commonJvmSettings = Seq(
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oDF")
)
Expand All @@ -45,90 +24,17 @@ lazy val commonJsSettings = Seq(

val CatsVersion = "2.7.0"

lazy val root = project
.in(file("."))
.aggregate(coreJVM, coreJS, lawsJVM, lawsJS, docs, testsJVM, testsJS)
.settings(name := "root")
.enablePlugins(NoPublishPlugin)
lazy val root = tlCrossRootProject.aggregate(core, laws, tests)

lazy val core = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.settings(name := "cats-mtl")
.settings(
libraryDependencies += "org.typelevel" %%% "cats-core" % CatsVersion,
Compile / packageSrc / mappings ++= {
val base = (Compile / sourceManaged).value
(Compile / managedSources).value.map(file => file -> file.relativeTo(base).get.getPath)
}
libraryDependencies += "org.typelevel" %%% "cats-core" % CatsVersion
)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)

lazy val coreJVM = core.jvm
lazy val coreJS = core.js

lazy val docsMappingsAPIDir =
settingKey[String]("Name of subdirectory in site target directory for api docs")

lazy val docs = project
.enablePlugins(MicrositesPlugin, ScalaUnidocPlugin, MdocPlugin, NoPublishPlugin)
.settings(name := "cats-mtl-docs")
.settings(
crossScalaVersions := (ThisBuild / crossScalaVersions).value.filter(_.startsWith("2.")),
micrositeName := "Cats MTL",
micrositeDescription := "Monad Transformers made easy",
micrositeAuthor := "Typelevel contributors",
micrositeHighlightTheme := "atom-one-light",
// micrositeHomepage := "http://typelevel.org/cats",
micrositeBaseUrl := "cats-mtl",
micrositeDocumentationUrl := "api",
micrositeGithubOwner := "typelevel",
micrositeDocumentationLabelDescription := "Scaladoc",
micrositeExtraMdFiles := Map(
file("CONTRIBUTING.md") -> ExtraMdFileConfig(
"contributing.md",
"home",
Map("title" -> "Contributing", "section" -> "contributing", "position" -> "50")),
file("README.md") -> ExtraMdFileConfig(
"index.md",
"home",
Map("title" -> "Home", "section" -> "home", "position" -> "0")
)
),
micrositeExtraMdFilesOutput := resourceManaged.value / "main" / "jekyll",
micrositeGithubRepo := "cats-mtl",
micrositePalette := Map(
"brand-primary" -> "#7B7998",
"brand-secondary" -> "#393E63",
"brand-tertiary" -> "#323759",
"gray-dark" -> "#49494B",
"gray" -> "#7B7B7E",
"gray-light" -> "#E5E5E6",
"gray-lighter" -> "#F4F3F4",
"white-color" -> "#FFFFFF"
),
mdocIn := (Compile / sourceDirectory).value / "mdoc",
autoAPIMappings := true,
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(coreJVM, lawsJVM),
docsMappingsAPIDir := "api",
addMappingsToSiteDir(ScalaUnidoc / packageDoc / mappings, docsMappingsAPIDir),
scalacOptions := scalacOptions.value.filterNot(_ == "-Werror"),
ghpagesNoJekyll := false,
tlFatalWarningsInCi := false,
ScalaUnidoc / unidoc / scalacOptions ++= Seq(
"-Xfatal-warnings",
"-doc-source-url",
scmInfo.value.get.browseUrl + "/tree/main€{FILE_PATH}.scala",
"-sourcepath",
(LocalRootProject / baseDirectory).value.getAbsolutePath,
"-diagrams"
),
git.remoteRepo := "[email protected]:typelevel/cats-mtl.git",
makeSite / includeFilter := "*.html" | "*.css" | "*.png" | "*.jpg" | "*.gif" | "*.js" | "*.swf" | "*.yml" | "*.md"
)
.settings(commonJvmSettings)
.dependsOn(coreJVM)

lazy val laws = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.dependsOn(core)
Expand All @@ -137,20 +43,32 @@ lazy val laws = crossProject(JSPlatform, JVMPlatform)
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)

lazy val lawsJVM = laws.jvm
lazy val lawsJS = laws.js

lazy val tests = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Pure)
.dependsOn(core, laws)
.enablePlugins(NoPublishPlugin)
.settings(name := "cats-mtl-tests")
.settings(libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-testkit" % CatsVersion,
"org.typelevel" %%% "discipline-munit" % "1.0.9"))
.settings(
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-testkit" % CatsVersion,
"org.scalameta" %%% "munit" % "0.7.29",
"org.typelevel" %%% "discipline-munit" % "1.0.9"))
.jsSettings(commonJsSettings)
.jvmSettings(commonJvmSettings)
.jsSettings(Test / scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule)))

lazy val testsJVM = tests.jvm
lazy val testsJS = tests.js
lazy val unidocs = project
.in(file("unidocs"))
.enablePlugins(TypelevelUnidocPlugin)
.settings(
name := "cats-mtl-docs",
ScalaUnidoc / unidoc / unidocProjectFilter := inProjects(core.jvm, laws.jvm)
)

lazy val docs = project
.in(file("site"))
.enablePlugins(TypelevelSitePlugin)
.settings(
tlFatalWarnings := false,
laikaConfig ~= (_.withRawContent)
)
.dependsOn(core.jvm)
1 change: 1 addition & 0 deletions docs/contributing.md
7 changes: 0 additions & 7 deletions docs/src/main/mdoc/design.md → docs/design.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
---
layout: page
title: "Design"
section: "design"
position: 6
---

cats-mtl Design
===============
Overall, cats-mtl has similar design to cats:
Expand Down
Loading

0 comments on commit 684f069

Please sign in to comment.