|
85 | 85 |
|
86 | 86 | - name: Test sourcelinks to stdlib |
87 | 87 | run: true # ./project/scripts/sbt scaladoc/sourceLinksIntegrationTest:test |
| 88 | + |
| 89 | + check-error-code-snippets: |
| 90 | + runs-on: ubuntu-latest |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v6 |
| 93 | + - uses: coursier/cache-action@v7 |
| 94 | + - uses: VirtusLab/scala-cli-setup@v1 |
| 95 | + - with: |
| 96 | + jvm: temurin:17 |
| 97 | + - name: Publish compiler locally |
| 98 | + run: | |
| 99 | + version=$(./project/scripts/sbt "print scala3-compiler-bootstrapped-new/version" | tail -n1) |
| 100 | + echo "SCALA_VERSION=$version" >> $GITHUB_ENV |
| 101 | + echo "Would test snippets using Scala $version" |
| 102 | +
|
| 103 | + # Publish locally minimal set of artifacts that would be required to test snippets |
| 104 | + sbt "set every doc := new File(\"unused\");\ |
| 105 | + all \ |
| 106 | + scala-library-bootstrapped/publishLocal \ |
| 107 | + scala3-compiler-bootstrapped-new/publishLocal \ |
| 108 | + scala3-interfaces/publishLocal \ |
| 109 | + scala3-library-bootstrapped-new/publishLocal \ |
| 110 | + " |
| 111 | + - name: Test error code snippets |
| 112 | + shell: bash |
| 113 | + run: scala-cli test -S ${{ env.SCALA_VERSION }} --with-compiler project/scripts/checkErrorCodeSnippets.test.scala -- +l +a +c |
| 114 | + - if: failure() |
| 115 | + run: | |
| 116 | + cat << EOF >> $GITHUB_STEP_SUMMARY |
| 117 | + Snippets validation for error codes failed |
| 118 | +
|
| 119 | + If you've modified messages of positions of error codes, you might need to update the expected outputs, to do it run: following command: |
| 120 | + scala -S ${{ env.SCALA_VERSION }} project/scripts/checkErrorCodeSnippets.scala --with-compiler --main-class=updateAllErrorCodeOutputs |
| 121 | +
|
| 122 | + Single error code validation can be performed using: |
| 123 | + scala -S ${{ env.SCALA_VERSION }} project/scripts/checkErrorCodeSnippets.scala --with-compiler -- docs/_docs/reference/error-codes/E001.md [--verbose --update-output] |
| 124 | +
|
| 125 | + To check the validation use dedicated test suite: |
| 126 | + scala test -S ${{ env.SCALA_VERSION }} --with-compiler project/scripts/checkErrorCodeSnippets.test.scala -- +l +a +c |
| 127 | + EOF |
0 commit comments