Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/scripts/check-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ done

if [ -z "${docs_targets}" ] ; then
if [ ! -f .spi.yml ]; then
log "No '.spi.yml' found, no documentation targets to check."
log "No '.spi.yml' found in \"$(pwd)\", no documentation targets to check."
exit 0
fi
fi
Expand All @@ -94,12 +94,12 @@ if ! command -v yq &> /dev/null; then
fi

if [ -z "${docs_targets}" ] ; then
docs_targets=$(yq ".builder.configs[] | select(.documentation_targets[] != \"\") | .documentation_targets[]" .spi.yml)
docs_targets=$(yq -r ".builder.configs[] | select(.documentation_targets[] != \"\") | .documentation_targets[]" .spi.yml)
fi

package_files=$(find . -maxdepth 1 -name 'Package*.swift')
if [ -z "$package_files" ]; then
fatal "Package.swift not found. Please ensure you are running this script from the root of a Swift package."
fatal "Package.swift not found in \"$(pwd)\". Please ensure you are running this script from the root of a Swift package."
fi

# yq 3.1.0-3 doesn't have filter, otherwise we could replace the grep call with "filter(.identity == "swift-docc-plugin") | keys | .[]"
Expand Down
21 changes: 10 additions & 11 deletions .github/workflows/soundness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ on:
api_breakage_check_container_image:
type: string
description: "Container image for the API breakage check job. Defaults to latest Swift Ubuntu image."
default: "swift:6.2-noble"
default: "swift:6.3-noble"
docs_check_enabled:
type: boolean
description: "Boolean to enable the docs check job. Defaults to true."
default: true
docs_check_container_image:
type: string
description: "Container image for the docs check job. Defaults to latest Swift Ubuntu image."
default: "swift:6.2-noble"
default: "swift:6.3-noble"
docs_check_additional_arguments:
type: string
description: "Additional arguments that should be passed to docc"
Expand Down Expand Up @@ -94,7 +94,7 @@ on:
format_check_container_image:
type: string
description: "Container image for the format check job. Defaults to latest Swift Ubuntu image."
default: "swift:6.2-noble"
default: "swift:6.3-noble"
shell_check_enabled:
type: boolean
description: "Boolean to enable the shell check job. Defaults to true."
Expand Down Expand Up @@ -200,23 +200,21 @@ jobs:
else
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
fi
- name: Pre-build
if: ${{ inputs.linux_pre_build_command }}
# zizmor: ignore[template-injection]
run: ${{ inputs.linux_pre_build_command }}
Comment on lines -203 to -206

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have we moved this inline?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question and I'm glad someone asked. The GitHub-workflows PR builds call this soundness check and set a linux_pre_build_command as following:

linux_pre_build_command: "cd tests/TestPackage && ${{ matrix.post_command }}"
docs_check_enabled: true
docs_check_targets: ${{ matrix.override_target_name}}

We essentially do a cd tests/TestPackage to change directory to the Sample package. However, when Run documentation check step was executed, it was against the repository root. This was one solution I found that address the use case, but I also considered adding a new input parameter with docs_check_package_root_directory, that would specify a relative directory to the SwiftPM Package to build for the docs.

- name: Run documentation check
env:
ADDITIONAL_DOCC_ARGUMENTS: ${{ inputs.docs_check_additional_arguments }}
DOCC_ANALYZE: ${{ inputs.docs_check_analyze }}
DOCS_TARGETS: ${{ inputs.docs_check_targets}}
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
run: |
set -x
${{ inputs.linux_pre_build_command }}
analyze_arg=""
doc_target_arg=""
if [[ "${DOCS_TARGETS}" != "" ]] ; then
if [ "${DOCS_TARGETS}" != "" ] ; then
doc_target_arg="--doc-targets ${DOCS_TARGETS}"
fi
if [[ "${DOCC_ANALYZE}" != "true" ]]; then
if [ "${DOCC_ANALYZE}" != "true" ]; then
analyze_arg="--no-analyze"
fi
"${SCRIPT_ROOT}/.github/workflows/scripts/check-docs.sh" ${analyze_arg} ${doc_target_arg} --additional-docc-arguments ${ADDITIONAL_DOCC_ARGUMENTS}
Expand Down Expand Up @@ -263,12 +261,13 @@ jobs:
run: |
analyze_arg=""
doc_target_arg=""
if [[ "${DOCS_TARGETS}" != "" ]] ; then
if [ "${DOCS_TARGETS}" != "" ] ; then
doc_target_arg="--doc-targets ${DOCS_TARGETS}"
fi
if [[ "${DOCC_ANALYZE}" != "true" ]]; then
if [ "${DOCC_ANALYZE}" != "true" ]; then
analyze_arg="--no-analyze"
fi
set -x
"${SCRIPT_ROOT}/.github/workflows/scripts/check-docs.sh" ${analyze_arg} ${doc_target_arg} --additional-docc-arguments ${ADDITIONAL_DOCC_ARGUMENTS}

unacceptable-language-check:
Expand Down
Loading