Skip to content

Commit 4f274fa

Browse files
committed
Introduce a macOS DocC soundness check
1 parent 20b826e commit 4f274fa

File tree

2 files changed

+61
-2
lines changed

2 files changed

+61
-2
lines changed

.github/workflows/scripts/check-docs.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
##
44
## This source file is part of the Swift.org open source project
55
##
6-
## Copyright (c) 2024 Apple Inc. and the Swift project authors
6+
## Copyright (c) 2025 Apple Inc. and the Swift project authors
77
## Licensed under Apache License v2.0 with Runtime Library Exception
88
##
99
## See https://swift.org/LICENSE.txt for license information
@@ -23,7 +23,10 @@ if [ ! -f .spi.yml ]; then
2323
fi
2424

2525
if ! command -v yq &> /dev/null; then
26-
apt -q update && apt -yq install yq
26+
case "$(uname -s)" in
27+
Darwin*) echo brew install yq;;
28+
Linux*) echo apt -q update && apt -yq install yq;;
29+
esac
2730
fi
2831

2932
package_files=$(find . -maxdepth 1 -name 'Package*.swift')

.github/workflows/soundness.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,26 @@ on:
3131
type: string
3232
description: "Additional arguments that should be passed to docc"
3333
default: ""
34+
docs_check_macos_enabled:
35+
type: boolean
36+
description: "Boolean to enable the macOS docs check job. Defaults to false."
37+
default: false
38+
docs_check_macos_version:
39+
type: string
40+
description: "macOS version for the macOS docs check job."
41+
default: "sequoia"
42+
docs_check_macos_arch:
43+
type: string
44+
description: "macOS arch for the macOS docs check job."
45+
default: "ARM64"
46+
docs_check_macos_xcode_version:
47+
type: string
48+
description: "Xcode version for the macOS docs check job."
49+
default: "26.0"
50+
docs_check_macos_additional_arguments:
51+
type: string
52+
description: "Additional arguments that should be passed to docc for the macOS docs check job."
53+
default: ""
3454
unacceptable_language_check_enabled:
3555
type: boolean
3656
description: "Boolean to enable the acceptable language check job. Defaults to true."
@@ -164,6 +184,42 @@ jobs:
164184
ADDITIONAL_DOCC_ARGUMENTS: ${{ inputs.docs_check_additional_arguments }}
165185
run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-docs.sh
166186

187+
docs-check-macos:
188+
name: Documentation check (macOS)
189+
if: ${{ inputs.docs_check_macos_enabled }}
190+
runs-on: [self-hosted, macos, "${{ inputs.docs_check_macos_version }}", "${{ inputs.docs_check_macos_arch }}"]
191+
timeout-minutes: 20
192+
steps:
193+
- name: Checkout repository
194+
uses: actions/checkout@v4
195+
with:
196+
persist-credentials: false
197+
submodules: true
198+
- name: Checkout swiftlang/github-workflows repository
199+
if: ${{ github.repository != 'swiftlang/github-workflows' }}
200+
uses: actions/checkout@v4
201+
with:
202+
repository: swiftlang/github-workflows
203+
path: github-workflows
204+
- name: Determine script-root path
205+
id: script_path
206+
run: |
207+
if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then
208+
echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT
209+
else
210+
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
211+
fi
212+
- name: Select Xcode
213+
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ inputs.docs_check_macos_xcode_version }}.app" >> $GITHUB_ENV
214+
- name: Swift version
215+
run: xcrun swift --version
216+
- name: Clang version
217+
run: xcrun clang --version
218+
- name: Run documentation check
219+
env:
220+
ADDITIONAL_DOCC_ARGUMENTS: ${{ inputs.docs_check_macos_additional_arguments }}
221+
run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-docs.sh
222+
167223
unacceptable-language-check:
168224
name: Unacceptable language check
169225
if: ${{ inputs.unacceptable_language_check_enabled }}

0 commit comments

Comments
 (0)