-
Notifications
You must be signed in to change notification settings - Fork 8
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
Migrate documentation to Laika (sbt-typelevel-site) #17
Merged
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
df305f9
Migrate documentation to Laika (sbt-typelevel-site)
CJSmith-0141 2352d3e
run github workflow generate to add docs project
CJSmith-0141 256cdf0
Updates sbt plugins
CJSmith-0141 a737d5f
Adds landing page and logo
CJSmith-0141 a951d24
moves CSS to own file
CJSmith-0141 8b1bca7
fix ansi to html documentation output
CJSmith-0141 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,11 +80,11 @@ jobs: | |
|
||
- name: Make target directories | ||
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') | ||
run: mkdir -p modules/scalacheck/native/target modules/framework-cats/native/target modules/framework/jvm/target modules/core/native/target modules/framework/native/target modules/core/js/target modules/framework/js/target modules/core/jvm/target modules/core-cats/native/target modules/discipline/native/target modules/core-cats/js/target modules/framework-cats/js/target modules/framework-cats/jvm/target modules/discipline/js/target modules/scalacheck/jvm/target modules/discipline/jvm/target modules/core-cats/jvm/target modules/scalacheck/js/target project/target | ||
run: mkdir -p modules/scalacheck/native/target modules/framework-cats/native/target modules/framework/jvm/target modules/docs/jvm/target modules/core/native/target modules/framework/native/target modules/core/js/target modules/framework/js/target modules/core/jvm/target modules/core-cats/native/target modules/discipline/native/target modules/core-cats/js/target modules/framework-cats/js/target modules/framework-cats/jvm/target modules/discipline/js/target modules/scalacheck/jvm/target modules/discipline/jvm/target modules/core-cats/jvm/target modules/scalacheck/js/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 modules/scalacheck/native/target modules/framework-cats/native/target modules/framework/jvm/target modules/core/native/target modules/framework/native/target modules/core/js/target modules/framework/js/target modules/core/jvm/target modules/core-cats/native/target modules/discipline/native/target modules/core-cats/js/target modules/framework-cats/js/target modules/framework-cats/jvm/target modules/discipline/js/target modules/scalacheck/jvm/target modules/discipline/jvm/target modules/core-cats/jvm/target modules/scalacheck/js/target project/target | ||
run: tar cf targets.tar modules/scalacheck/native/target modules/framework-cats/native/target modules/framework/jvm/target modules/docs/jvm/target modules/core/native/target modules/framework/native/target modules/core/js/target modules/framework/js/target modules/core/jvm/target modules/core-cats/native/target modules/discipline/native/target modules/core-cats/js/target modules/framework-cats/js/target modules/framework-cats/jvm/target modules/discipline/js/target modules/scalacheck/jvm/target modules/discipline/jvm/target modules/core-cats/jvm/target modules/scalacheck/js/target project/target | ||
|
||
- name: Upload target directories | ||
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') | ||
|
@@ -265,5 +265,42 @@ jobs: | |
- name: Submit Dependencies | ||
uses: scalacenter/sbt-dependency-submission@v2 | ||
with: | ||
modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 | ||
modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 weaver-docs_2.12 weaver-docs_2.13 weaver-docs_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 | ||
configs-ignore: test scala-tool scala-doc-tool test-internal | ||
|
||
site: | ||
name: Generate Site | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
java: [temurin@11] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout current branch (full) | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Java (temurin@11) | ||
id: setup-java-temurin-11 | ||
if: matrix.java == 'temurin@11' | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 11 | ||
cache: sbt | ||
|
||
- name: sbt update | ||
if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' | ||
run: sbt +update | ||
|
||
- name: Generate site | ||
run: sbt 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
div.terminal { | ||
color: white; | ||
background-color: black; | ||
} | ||
|
||
div.terminal pre { | ||
background-color: black; | ||
color: white; | ||
padding: 20px; | ||
overflow: auto | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
div.terminal { | ||
color: white; | ||
background-color: black; | ||
} | ||
div.terminal pre { | ||
background-color: black; | ||
color: white; | ||
padding: 20px; | ||
overflow: auto | ||
} | ||
</style> | ||
<body> | ||
```scala mdoc:passthrough | ||
import weaver._ | ||
import cats.effect.IO | ||
|
||
object ExpectationsSuite extends SimpleIOSuite { | ||
|
||
object A { | ||
object B { | ||
object C { | ||
def test(a: Int) = a + 5 | ||
} | ||
} | ||
} | ||
|
||
pureTest("Simple expectations (success)") { | ||
val z = 15 | ||
|
||
expect(A.B.C.test(z) == z + 5) | ||
} | ||
|
||
pureTest("Simple expectations (failure)") { | ||
val z = 15 | ||
|
||
expect(A.B.C.test(z) % 7 == 0) | ||
} | ||
|
||
|
||
pureTest("And/Or composition (success)") { | ||
expect(1 != 2) and expect(2 != 1) or expect(2 != 3) | ||
} | ||
|
||
pureTest("And/Or composition (failure") { | ||
(expect(1 != 2) and expect(2 == 1)) or expect(2 == 3) | ||
} | ||
|
||
pureTest("Varargs composition (success)") { | ||
// expect(1 + 1 == 2) && expect (2 + 2 == 4) && expect(4 * 2 == 8) | ||
expect.all(1 + 1 == 2, 2 + 2 == 4, 4 * 2 == 8) | ||
} | ||
|
||
pureTest("Varargs composition (failure)") { | ||
// expect(1 + 1 == 2) && expect (2 + 2 == 4) && expect(4 * 2 == 8) | ||
expect.all(1 + 1 == 2, 2 + 2 == 5, 4 * 2 == 8) | ||
} | ||
|
||
pureTest("Working with collections (success)") { | ||
forEach(List(1, 2, 3))(i => expect(i < 5)) and | ||
forEach(Option("hello"))(msg => expect.same(msg, "hello")) and | ||
exists(List("a", "b", "c"))(i => expect(i == "c")) and | ||
exists(Vector(true, true, false))(i => expect(i == false)) | ||
} | ||
|
||
pureTest("Working with collections (failure 1)") { | ||
forEach(Vector("hello", "world"))(msg => expect.same(msg, "hello")) | ||
} | ||
|
||
pureTest("Working with collections (failure 2)") { | ||
exists(Option(39))(i => expect(i > 50)) | ||
} | ||
|
||
import cats.Eq | ||
case class Test(d: Double) | ||
|
||
implicit val eqTest: Eq[Test] = Eq.by[Test, Double](_.d) | ||
|
||
pureTest("Strict equality (success)") { | ||
expect.eql("hello", "hello") and | ||
expect.eql(List(1, 2, 3), List(1, 2, 3)) and | ||
expect.eql(Test(25.0), Test(25.0)) | ||
} | ||
|
||
pureTest("Strict equality (failure 1)") { | ||
expect.eql("hello", "world") | ||
} | ||
|
||
pureTest("Strict equality (failure 2)") { | ||
expect.eql(List(1, 2, 3), List(1, 19, 3)) | ||
} | ||
|
||
pureTest("Strict equality (failure 3)") { | ||
expect.eql(Test(25.0), Test(50.0)) | ||
} | ||
|
||
// Note that we don't have an instance of Eq[Hello] | ||
// anywhere in scope | ||
class Hello(val d: Double) { | ||
override def toString = s"Hello to $d" | ||
|
||
override def equals(other: Any) = | ||
if(other != null && other.isInstanceOf[Hello]) | ||
other.asInstanceOf[Hello].d == this.d | ||
else | ||
false | ||
} | ||
|
||
pureTest("Relaxed equality comparison (success)") { | ||
expect.same(new Hello(25.0), new Hello(25.0)) | ||
} | ||
|
||
pureTest("Relaxed equality comparison (failure)") { | ||
expect.same(new Hello(25.0), new Hello(50.0)) | ||
} | ||
|
||
pureTest("Non macro-based expectations") { | ||
val condition : Boolean = false | ||
if (condition) success else failure("Condition failed") | ||
} | ||
|
||
test("Failing fast expectations") { | ||
for { | ||
h <- IO.pure("hello") | ||
_ <- expect(h.isEmpty).failFast | ||
} yield success | ||
} | ||
} | ||
println(weaver.docs.Output.runSuites(ExpectationsSuite)) | ||
``` | ||
</body> | ||
</head> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
laika.navigationOrder = [ | ||
overview, | ||
features, | ||
samples, | ||
faqs | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
laika.title = Frequently Asked Questions | ||
laika.navigationOrder = [ | ||
ide_faqs.md, | ||
other_effects.md | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
laika.title = Features | ||
laika.navigationOrder = [ | ||
expectations.md, | ||
tracing_failures.md, | ||
resources.md, | ||
global_resources.md, | ||
logging.md, | ||
tagging.md, | ||
scalacheck.md, | ||
discipline.md, | ||
parallelism.md, | ||
funsuite.md, | ||
filtering.md, | ||
specs2.md | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take it this is where you've struggled ? Is Laika somehow able to run this snippet via a call to mdoc ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this passthrough is in a markdown document, Laika hangs. Mdoc doesn't have an issue. By moving it to an html document laika ignores the file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mmm that's not ideal :/ , the point of this mdoc invocation is to exemplify the output of the framework. Not that it's critical to the docs but it's kinda nice to have.
Probs worth pinging some of the laïka maintainers for advice ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a problem with the ansi to html transformation making invalid html, fixed by making the html output just dealing with color, instead of trying to get the order of transitions correct in all cases.
see 8b1bca7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@CJSmith-0141, would you mind just uploading a screenshot of the microsite on the PR description ?