Skip to content

Commit

Permalink
Cross compile docs-tests on Scala 3 LTS & Next
Browse files Browse the repository at this point in the history
  • Loading branch information
Gedochao committed Feb 23, 2024
1 parent 05eaedd commit 1d0b07c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ jobs:
- name: Build documentation
run: .github/scripts/build-website.sh
- name: Test documentation
run: ./mill -i docs-tests.test
run: ./mill -i 'docs-tests[]'.test
- name: Convert Mill test reports to JUnit XML format
if: success() || failure()
run: .github/scripts/generate-junit-reports.sc docs-tests 'Scala CLI Docs Tests' test-report.xml out/
Expand Down
18 changes: 9 additions & 9 deletions DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,36 +235,36 @@ We have a built-in tool to validate `.md` files called [Sclicheck](/sclicheck/Re
All `Sclicheck` tests can be run with `Mill` + `munit`: (and this is what we run on the CI, too)

```bash
./mill -i docs-tests.test
./mill -i 'docs-tests[]'.test
```

The former also includes testing gifs and `Sclicheck` itself.
To just check the documents, run:

```bash
./mill -i docs-tests.test 'sclicheck.DocTests.*'
./mill -i 'docs-tests[]'.test 'sclicheck.DocTests.*'
```

You can also check all root docs, commands, reference docs, guides or cookbooks:

```bash
./mill -i docs-tests.test 'sclicheck.DocTests.root*'
./mill -i docs-tests.test 'sclicheck.DocTests.guide*'
./mill -i docs-tests.test 'sclicheck.DocTests.command*'
./mill -i docs-tests.test 'sclicheck.DocTests.cookbook*'
./mill -i docs-tests.test 'sclicheck.DocTests.reference*'
./mill -i 'docs-tests[]'.test 'sclicheck.DocTests.root*'
./mill -i 'docs-tests[]'.test 'sclicheck.DocTests.guide*'
./mill -i 'docs-tests[]'.test 'sclicheck.DocTests.command*'
./mill -i 'docs-tests[]'.test 'sclicheck.DocTests.cookbook*'
./mill -i 'docs-tests[]'.test 'sclicheck.DocTests.reference*'
```

Similarly, you can check single files:

```bash
./mill -i docs-tests.test 'sclicheck.DocTests.<category> <doc-name>'
./mill -i 'docs-tests[]'.test 'sclicheck.DocTests.<category> <doc-name>'
```

For example, to run the check on `compile.md`

```bash
./mill -i docs-tests.test 'sclicheck.DocTests.command compile'
./mill -i 'docs-tests[]'.test 'sclicheck.DocTests.command compile'
```

## Scala CLI logos
Expand Down
9 changes: 6 additions & 3 deletions build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,11 @@ object integration extends CliIntegration {
}
}

object `docs-tests` extends SbtModule with ScalaCliScalafixModule with HasTests { main =>
def scalaVersion = Scala.defaultInternal
object `docs-tests` extends Cross[DocsTests](Scala.allScala3){
def defaultCrossSegments = Seq(Scala.defaultInternal)
}

trait DocsTests extends CrossSbtModule with ScalaCliScalafixModule with HasTests { main =>
def ivyDeps = Agg(
Deps.fansi,
Deps.osLib,
Expand All @@ -144,7 +147,7 @@ object `docs-tests` extends SbtModule with ScalaCliScalafixModule with HasTests
}
def extraEnv = T {
Seq(
"SCLICHECK_SCALA_CLI" -> cli(Scala.defaultInternal).standaloneLauncher().path.toString,
"SCLICHECK_SCALA_CLI" -> cli(crossScalaVersion).standaloneLauncher().path.toString,
"SCALA_CLI_CONFIG" -> (tmpDirBase().path / "config" / "config.json").toString
)
}
Expand Down
2 changes: 1 addition & 1 deletion modules/docs-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Sclicheck accepts following arguments: `[--dest <dest>] [--step] [--stopAtFailur

Sclicheck can be run from the Scala CLI sources root with
```text
$ ./mill -i docs-tests.run …args…
$ ./mill -i 'docs-tests[]'.run …args…
```

## Example
Expand Down

0 comments on commit 1d0b07c

Please sign in to comment.