-
Notifications
You must be signed in to change notification settings - Fork 48
Docs: provide option to skip analysis in doc-check #282
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
Merged
FranzBusch
merged 1 commit into
swiftlang:main
from
bkhouri:t/main/gh281_add_doc_check_input_options
Jun 25, 2026
Merged
Changes from all commits
Commits
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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,162 @@ | ||
| # Documentation Check | ||
|
|
||
| The Soundness workflow can verify that your Swift package's [DocC](https://www.swift.org/documentation/docc/) documentation builds without warnings. Two jobs are available: | ||
|
|
||
| - **`docs-check`** — runs on Linux. Enabled by default. | ||
| - **`docs-check-macos`** — runs on a self-hosted macOS runner. Opt-in. | ||
|
|
||
| Running both lets you catch documentation issues that only surface on one toolchain. | ||
|
|
||
| Documentation warnings (and, by default, DocC analyzer findings) cause the job to fail. | ||
|
|
||
| ## Requirements | ||
|
|
||
| ### For both jobs | ||
|
|
||
| 1. **A `Package.swift`** (or any `Package*.swift`) at the repository root. | ||
|
|
||
| 2. **At least one documentation target**, supplied via either: | ||
| - a `documentation_targets` entry in a `.spi.yml` file at the repository root. | ||
| - the `docs_check_targets` / `docs_check_macos_targets` input, **or** | ||
|
|
||
| If neither is provided, the job exits successfully without checking anything. | ||
|
|
||
| The `.spi.yml` file is also where you can declare per-target DocC parameters via `custom_documentation_parameters`. Read the [official documentation](https://swiftpackageindex.com/SwiftPackageIndex/SPIManifest/1.12.0/documentation/spimanifest/commonusecases) for the full schema. For example: | ||
|
|
||
| ```yaml | ||
| version: 1 | ||
| builder: | ||
| configs: | ||
| - documentation_targets: [MyLibrary, MyOtherLibrary] | ||
| custom_documentation_parameters: | ||
| - --include-extended-types | ||
| ``` | ||
|
|
||
| Target names must match real SwiftPM target names declared in `Package.swift`. | ||
|
|
||
| You do not need to add `swift-docc-plugin` to your package — CI provides it for you. | ||
|
|
||
| ### Additional requirement for the macOS job | ||
|
|
||
| A self-hosted runner must be registered with the label set `[self-hosted, macos, <version>, <arch>]` matching the values you pass to `docs_check_macos_version` and `docs_check_macos_arch`, with the requested Xcode version installed. | ||
|
|
||
| ## Enabling the check | ||
|
|
||
| Add (or extend) a workflow file under `.github/workflows/` in your repository: | ||
|
|
||
| ```yaml | ||
| name: Pull request | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| soundness: | ||
| name: Soundness | ||
| uses: swiftlang/github-workflows/.github/workflows/soundness.yml@<to-be-updated>> | ||
| with: | ||
| docs_check_enabled: true | ||
| ``` | ||
|
|
||
| This enables the Linux documentation check along with the other soundness checks. The macOS variant remains off unless you opt in. | ||
|
|
||
| ## Configuration | ||
|
|
||
| ### Linux job (`docs-check`) | ||
|
|
||
| | Input | Type | Default | Description | | ||
| |---|---|---|---| | ||
| | `docs_check_enabled` | boolean | `true` | Enable or disable the job. | | ||
| | `docs_check_container_image` | string | `swift:6.2-noble` | Docker image used to run the check. | | ||
| | `docs_check_targets` | string | `""` | Space-separated list of documentation targets to check. When empty, targets are read from `.spi.yml` (if present). | | ||
| | `docs_check_additional_arguments` | string | `""` | Extra arguments to pass to DocC. | | ||
| | `docs_check_analyze` | boolean | `true` | Set to `false` to skip DocC's analyzer pass. | | ||
| | `linux_pre_build_command` | string | `""` | Shell command to run before the check (e.g., installing system dependencies). | | ||
|
|
||
| ### macOS job (`docs-check-macos`) | ||
|
|
||
| | Input | Type | Default | Description | | ||
| |---|---|---|---| | ||
| | `docs_check_macos_enabled` | boolean | `false` | Enable or disable the job. | | ||
| | `docs_check_macos_version` | string | `tahoe` | macOS version label of the runner to target. | | ||
| | `docs_check_macos_arch` | string | `ARM64` | Architecture label of the runner to target. | | ||
| | `docs_check_macos_xcode_version` | string | `26.0` | Xcode version to use. | | ||
| | `docs_check_macos_targets` | string | `""` | Space-separated list of documentation targets to check. When empty, targets are read from `.spi.yml` (if present). | | ||
| | `docs_check_macos_additional_arguments` | string | `""` | Extra arguments to pass to DocC. | | ||
| | `docs_check_macos_analyze` | boolean | `true` | Set to `false` to skip DocC's analyzer pass. | | ||
|
|
||
| The macOS job requires a self-hosted runner registered with the label set `[self-hosted, macos, <version>, <arch>]`. | ||
|
|
||
| ## Common scenarios | ||
|
|
||
| ### Enable the macOS check | ||
|
|
||
| ```yaml | ||
| jobs: | ||
| soundness: | ||
| uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main | ||
| with: | ||
| docs_check_macos_enabled: true | ||
| docs_check_macos_version: "tahoe" | ||
| docs_check_macos_arch: "ARM64" | ||
| docs_check_macos_xcode_version: "26.0" | ||
| ``` | ||
|
|
||
| ### Check only specific targets | ||
|
|
||
| By default the check documents every target listed in `.spi.yml`. To override that list without editing `.spi.yml`, provide the target names explicitly: | ||
|
|
||
| ```yaml | ||
| jobs: | ||
| soundness: | ||
| uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main | ||
| with: | ||
| docs_check_targets: "MyLibrary MyOtherLibrary" | ||
| ``` | ||
|
|
||
| ### Pin a different Swift toolchain or pass extra DocC flags | ||
|
|
||
| ```yaml | ||
| jobs: | ||
| soundness: | ||
| uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main | ||
| with: | ||
| docs_check_container_image: "swift:nightly-noble" | ||
| docs_check_additional_arguments: "--include-extended-types" | ||
| linux_pre_build_command: "apt-get update && apt-get install -y libxml2-dev" | ||
| ``` | ||
|
|
||
| ### Skip the DocC analyzer | ||
|
|
||
| ```yaml | ||
| jobs: | ||
| soundness: | ||
| uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main | ||
| with: | ||
| docs_check_analyze: false | ||
| ``` | ||
|
|
||
| ### Disable the check | ||
|
|
||
| If you want to skip the documentation check entirely (regardless of whether your package has documentation targets), turn it off: | ||
|
|
||
| ```yaml | ||
| jobs: | ||
| soundness: | ||
| uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main | ||
| with: | ||
| docs_check_enabled: false | ||
| ``` | ||
|
|
||
| If you simply have no documentation targets to check, you can leave the job enabled — it will exit successfully without doing anything. | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| | Symptom | Likely cause | | ||
| |---|---| | ||
| | Job logs `No '.spi.yml' found, no documentation targets to check.` and exits successfully. | Neither `docs_check_targets` nor a `.spi.yml` was provided. Add one of them if you expected the check to run. | | ||
| | `Package.swift not found.` | The check expects a SwiftPM package at the repo root. | | ||
| | Warnings cause the job to fail. | Intentional. Resolve the DocC warnings, or pass DocC flags via `.spi.yml`'s `custom_documentation_parameters` to suppress them. | | ||
| | macOS job stays queued. | No self-hosted runner matches the requested labels. Verify the `version` and `arch` inputs against your runner inventory. | | ||
| | macOS job cannot find Xcode. | The requested Xcode version is not installed on the runner. | | ||
This file contains hidden or 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 @@ | ||
| version: 1 | ||
| builder: | ||
| configs: | ||
| - documentation_targets: | ||
| - theDocs |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.