Skip to content

Commit

Permalink
[CI] Make container images configurable in soundness and matrix jobs … (
Browse files Browse the repository at this point in the history
#2851)

…and remove docc plugin

# Motivation

Some repositories might want to run their soundness and matrix jobs
checks on different container images e.g. a repo might build against the
nightly toolchains only so their soundness jobs should also use nightly
images. Other repos might want to build against a different linux
distribution since their usual deployment target is not Ubuntu based.

Additionally, we currently require our repos to depend on the docc
plugin for building documentation which adds an unnecessary dependency
to all of our packages.

# Modification

This PR makes the container images for the soundness and matrix jobs
configurable. Furthermore, it modifies the docs check script to add the
docc-plugin dependency and removes the current dependency from our
manifest.

# Result

Our workflows can be adopted by more repositories.
  • Loading branch information
FranzBusch authored Aug 29, 2024
1 parent e1b2a99 commit 76f39c1
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 8 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/soundness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,18 @@ on:
type: boolean
description: "Boolean to enable the API breakage check job. Defaults to true."
default: true
api_breakage_check_container_image:
type: string
description: "Container image for the API breakage check job. Defaults to latest Swift Ubuntu image."
default: "swift:5.10-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:5.10-noble"
unacceptable_language_check_enabled:
type: boolean
description: "Boolean to enable the acceptable language check job. Defaults to true."
Expand Down Expand Up @@ -51,7 +59,7 @@ jobs:
if: ${{ inputs.api_breakage_check_enabled }}
runs-on: ubuntu-latest
container:
image: swift:5.10-noble
image: ${{ inputs.api_breakage_check_container_image }}
timeout-minutes: 20
steps:
- name: Checkout repository
Expand All @@ -71,7 +79,7 @@ jobs:
if: ${{ inputs.docs_check_enabled }}
runs-on: ubuntu-latest
container:
image: swift:5.10-noble
image: ${{ inputs.docs_check_container_image }}
timeout-minutes: 20
steps:
- name: Checkout repository
Expand Down
32 changes: 27 additions & 5 deletions .github/workflows/swift_matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,54 @@ on:
type: boolean
description: "Boolean to enable the 5.8 Swift version matrix job. Defaults to true."
default: true
matrix_linux_5_8_container_image:
type: string
description: "Container image for the 5.8 Swift version matrix job. Defaults to matching Swift Ubuntu image."
default: "swift:5.8-jammy"
matrix_linux_5_8_command_override:
type: string
description: "The command of the 5.8 Swift version linux matrix job to execute."
matrix_linux_5_9_enabled:
type: boolean
description: "Boolean to enable the 5.9 Swift version matrix job. Defaults to true."
default: true
matrix_linux_5_9_container_image:
type: string
description: "Container image for the 5.9 Swift version matrix job. Defaults to matching Swift Ubuntu image."
default: "swift:5.9-jammy"
matrix_linux_5_9_command_override:
type: string
description: "The command of the 5.9 Swift version linux matrix job to execute."
matrix_linux_5_10_enabled:
type: boolean
description: "Boolean to enable the 5.10 Swift version matrix job. Defaults to true."
default: true
matrix_linux_5_10_container_image:
type: string
description: "Container image for the 5.10 Swift version matrix job. Defaults to matching Swift Ubuntu image."
default: "swift:5.10-jammy"
matrix_linux_5_10_command_override:
type: string
description: "The command of the 5.10 Swift version linux matrix job to execute."
matrix_linux_nightly_6_0_enabled:
type: boolean
description: "Boolean to enable the nightly 6.0 Swift version matrix job. Defaults to true."
default: true
matrix_linux_nightly_6_0_container_image:
type: string
description: "Container image for the nightly 6.0 Swift version matrix job. Defaults to matching Swift Ubuntu image."
default: "swiftlang/swift:nightly-6.0-jammy"
matrix_linux_nightly_6_0_command_override:
type: string
description: "The command of the nightly 6.0 Swift version linux matrix job to execute."
matrix_linux_nightly_main_enabled:
type: boolean
description: "Boolean to enable the nightly main Swift version matrix job. Defaults to true."
default: true
matrix_linux_nightly_main_container_image:
type: string
description: "Container image for the nightly main Swift version matrix job. Defaults to matching Swift Ubuntu image."
default: "swiftlang/swift:nightly-main-jammy"
matrix_linux_nightly_main_command_override:
type: string
description: "The command of the nightly main Swift version linux matrix job to execute."
Expand All @@ -61,29 +81,31 @@ jobs:
matrix:
# We are specifying only the major and minor of the docker images to automatically pick up the latest patch release
swift:
- image: swift:5.8-jammy
- image: ${{ inputs.matrix_linux_5_8_container_image }}
swift_version: "5.8"
enabled: ${{ inputs.matrix_linux_5_8_enabled }}
- image: swift:5.9-jammy
- image: ${{ inputs.matrix_linux_5_9_container_image }}
swift_version: "5.9"
enabled: ${{ inputs.matrix_linux_5_9_enabled }}
- image: swift:5.10-jammy
- image: ${{ inputs.matrix_linux_5_10_container_image }}
swift_version: "5.10"
enabled: ${{ inputs.matrix_linux_5_10_enabled }}
- image: swiftlang/swift:nightly-6.0-jammy
- image: ${{ inputs.matrix_linux_nightly_6_0_container_image }}
swift_version: "nightly-6.0"
enabled: ${{ inputs.matrix_linux_nightly_6_0_enabled }}
- image: swiftlang/swift:nightly-main-jammy
- image: ${{ inputs.matrix_linux_nightly_main_container_image }}
swift_version: "nightly-main"
enabled: ${{ inputs.matrix_linux_nightly_main_enabled }}
container:
image: ${{ matrix.swift.image }}
steps:
- name: Checkout repository
if: ${{ matrix.swift.enabled }}
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Mark the workspace as safe
if: ${{ matrix.swift.enabled }}
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Run matrix job
Expand Down
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,6 @@ if Context.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.1.0"),
.package(url: "https://github.com/apple/swift-collections.git", from: "1.0.2"),
.package(url: "https://github.com/apple/swift-system.git", from: "1.2.0"),
.package(url: "https://github.com/apple/swift-docc-plugin", "1.0.0"..<"1.4.0"),
]
} else {
package.dependencies += [
Expand Down
7 changes: 7 additions & 0 deletions scripts/check-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ log() { printf -- "** %s\n" "$*" >&2; }
error() { printf -- "** ERROR: %s\n" "$*" >&2; }
fatal() { error "$@"; exit 1; }

log "Editing Package.swift..."
cat <<EOF >> "Package.swift"
package.dependencies.append(
.package(url: "https://github.com/apple/swift-docc-plugin", "1.0.0"..<"1.4.0")
)
EOF

log "Checking documentation targets..."
for target in $(yq -r '.builder.configs[].documentation_targets[]' .spi.yml); do
log "Checking target $target..."
Expand Down

0 comments on commit 76f39c1

Please sign in to comment.