Skip to content

Document Scala compiler error codes #29720

Document Scala compiler error codes

Document Scala compiler error codes #29720

Workflow file for this run

name: scaladoc
on:
push:
branches-ignore:
- 'language-reference-stable'
- 'gh-readonly-queue/**'
pull_request:
branches-ignore:
- 'language-reference-stable'
merge_group:
permissions:
contents: read
jobs:
build:
env:
AZURE_STORAGE_SAS_TOKEN: ${{ secrets.AZURE_STORAGE_SAS_TOKEN }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
runs-on: ubuntu-latest
if: "github.event_name == 'merge_group'
|| ( github.event_name == 'pull_request'
&& !contains(github.event.pull_request.body, '[skip ci]')
&& !contains(github.event.pull_request.body, '[skip docs]')
)
|| contains(github.event.ref, 'scaladoc')
|| contains(github.event.ref, 'main')"
steps:
- name: Git Checkout
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
cache: 'sbt'
- uses: sbt/setup-sbt@v1
- name: Compile and test scala3doc-js
run: ./project/scripts/sbt scaladoc-js-main/test
#- name: Compile and test
# run: |
# ./project/scripts/sbt scaladoc/test
# ./project/scripts/sbt dist/Universal/stage
# ./project/scripts/cmdScaladocTests
- name: Locally publish self
run: ./project/scripts/sbt scaladoc/publishLocal
- name: Generate self documentation
run: ./project/scripts/sbt scaladoc/generateSelfDocumentation
- name: Generate testcases documentation
run: ./project/scripts/sbt scaladoc/generateTestcasesDocumentation
- name: Generate reference documentation
run: ./project/scripts/sbt scaladoc/generateReferenceDocumentation
- name: Generate Scala 3 documentation
run: ./project/scripts/sbt scaladoc/generateScalaDocumentation
stdlib-sourcelinks-test:
runs-on: ubuntu-latest
# if false - disable flaky test
if: "false && (( github.event_name == 'pull_request'
&& !contains(github.event.pull_request.body, '[skip ci]')
&& !contains(github.event.pull_request.body, '[skip docs]')
)
|| contains(github.event.ref, 'scaladoc')
|| contains(github.event.ref, 'scala3doc')
|| contains(github.event.ref, 'main'))"
steps:
- name: Git Checkout
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: 17
- name: Test sourcelinks to stdlib
run: true # ./project/scripts/sbt scaladoc/sourceLinksIntegrationTest:test
check-error-code-snippets:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: coursier/cache-action@v7
- uses: VirtusLab/scala-cli-setup@v1
with:
jvm: temurin:17
apps: sbt
- name: Publish compiler locally
run: |
version=$(./project/scripts/sbt "print scala3-compiler-bootstrapped-new/version" | tail -n1)
echo "SCALA_VERSION=$version" >> $GITHUB_ENV
echo "Would test snippets using Scala $version"
# Publish locally minimal set of artifacts that would be required to test snippets
sbt "set every doc := new File(\"unused\");\
all \
scala-library-bootstrapped/publishLocal \
scala3-compiler-bootstrapped-new/publishLocal \
scala3-interfaces/publishLocal \
scala3-library-bootstrapped-new/publishLocal \
"
- name: Test error code snippets
shell: bash
run: scala-cli test -S ${{ env.SCALA_VERSION }} --with-compiler project/scripts/checkErrorCodeSnippets.test.scala -- +l +a +c
- if: failure()
run: |
cat << EOF >> $GITHUB_STEP_SUMMARY
Snippets validation for error codes failed
If you've modified messages of positions of error codes, you might need to update the expected outputs, to do it run: following command:
scala -S ${{ env.SCALA_VERSION }} project/scripts/checkErrorCodeSnippets.scala --with-compiler --main-class=updateAllErrorCodeOutputs
Single error code validation can be performed using:
scala -S ${{ env.SCALA_VERSION }} project/scripts/checkErrorCodeSnippets.scala --with-compiler -- docs/_docs/reference/error-codes/E001.md [--verbose --update-output]
To check the validation use dedicated test suite:
scala test -S ${{ env.SCALA_VERSION }} --with-compiler project/scripts/checkErrorCodeSnippets.test.scala -- +l +a +c
EOF