Skip to content

Commit d9f41f0

Browse files
authored
Merge branch 'swiftlang:main' into env
2 parents eef5c53 + 5eee019 commit d9f41f0

10 files changed

Lines changed: 361 additions & 43 deletions

.github/workflows/create_automerge_pr.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,16 @@ jobs:
7474
fetch-depth: 0
7575
- name: Check if there are commits to merge
7676
id: create_merge_commit
77+
env:
78+
HEAD_BRANCH: ${{ inputs.head_branch }}
79+
BASE_BRANCH: ${{ inputs.base_branch }}
7780
run: |
7881
# Without this, we can't perform git operations in GitHub actions.
7982
git config --global --add safe.directory "$(realpath .)"
8083
git config --local user.name 'swift-ci'
8184
git config --local user.email 'swift-ci@users.noreply.github.com'
8285
83-
if [[ "$(git rev-list --left-only --count origin/${{ inputs.head_branch }}...origin/${{ inputs.base_branch }})" == 0 ]]; then
86+
if [[ "$(git rev-list --left-only --count origin/${HEAD_BRANCH}...origin/${BASE_BRANCH})" == 0 ]]; then
8487
echo "Nothing to merge"
8588
echo "has_commits_to_merge=false" >> "$GITHUB_OUTPUT"
8689
exit
@@ -92,17 +95,20 @@ jobs:
9295
if: ${{ steps.create_merge_commit.outputs.has_commits_to_merge == 'true' }}
9396
env:
9497
GH_TOKEN: ${{ github.token }}
98+
HEAD_BRANCH: ${{ inputs.head_branch }}
99+
BASE_BRANCH: ${{ inputs.base_branch }}
100+
PR_MESSAGE: ${{ inputs.pr_message }}
95101
run: |
96102
# Create a branch for the PR instead of opening a PR that merges head_branch directly so that we have a fixed
97103
# target in the PR and don't modify the PR as new commits are put on the head branch.
98104
PR_BRANCH="automerge/merge-main-$(date +%Y-%m-%d_%H-%M)"
99-
git checkout ${{ inputs.head_branch }}
105+
git checkout "${HEAD_BRANCH}"
100106
git checkout -b "$PR_BRANCH"
101107
git push --set-upstream origin "$PR_BRANCH"
102108
103109
gh pr create \
104-
--base "${{ inputs.base_branch }}" \
110+
--base "${BASE_BRANCH}" \
105111
--head "$PR_BRANCH" \
106-
--title 'Merge `${{ inputs.head_branch }}` into `${{ inputs.base_branch }}`' \
107-
--body '${{ inputs.pr_message }}' \
112+
--title "Merge \`${HEAD_BRANCH}\` into \`${BASE_BRANCH}\`" \
113+
--body "${PR_MESSAGE}" \
108114
--draft
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Check for Dependencies in PR
2+
3+
on:
4+
workflow_call:
5+
6+
permissions:
7+
issues: read
8+
pull-requests: read
9+
10+
jobs:
11+
check_dependencies:
12+
runs-on: ubuntu-latest
13+
name: "Check GitHub Actions Dependencies"
14+
steps:
15+
- uses: gregsdennis/dependencies-action@v1.4.2
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/performance_test.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,26 @@ jobs:
4242
# https://github.com/actions/checkout/issues/766
4343
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
4444
- name: Measure PR performance
45+
env:
46+
PACKAGE_PATH: ${{ inputs.package_path }}
47+
HEAD_REF: ${{ github.head_ref }}
4548
run: |
46-
swift package --package-path ${{ inputs.package_path }} --allow-writing-to-directory ${{ inputs.package_path }}/.benchmarkBaselines/ benchmark baseline update "${{ github.head_ref }}"
49+
swift package --package-path "${PACKAGE_PATH}" --allow-writing-to-directory "${PACKAGE_PATH}/.benchmarkBaselines/" benchmark baseline update "${HEAD_REF}"
4750
- name: Measure base branch performance
51+
env:
52+
PACKAGE_PATH: ${{ inputs.package_path }}
53+
BASE_REF: ${{ github.base_ref }}
4854
run: |
49-
git checkout ${{ github.base_ref }}
50-
swift package --package-path ${{ inputs.package_path }} --allow-writing-to-directory ${{ inputs.package_path }}/.benchmarkBaselines/ benchmark baseline update "${{ github.base_ref }}"
55+
git checkout "${BASE_REF}"
56+
swift package --package-path "${PACKAGE_PATH}" --allow-writing-to-directory "${PACKAGE_PATH}/.benchmarkBaselines/" benchmark baseline update "${BASE_REF}"
5157
- name: Compare performance measurements
5258
id: compare_performance
59+
env:
60+
PACKAGE_PATH: ${{ inputs.package_path }}
61+
BASE_REF: ${{ github.base_ref }}
62+
HEAD_REF: ${{ github.head_ref }}
5363
run: |
54-
if ! swift package --package-path ${{ inputs.package_path }} benchmark baseline check "${{ github.base_ref }}" "${{ github.head_ref }}" --format markdown > /tmp/comparison.md 2>/tmp/comparison-stderr.txt; then
64+
if ! swift package --package-path "${PACKAGE_PATH}" benchmark baseline check "${BASE_REF}" "${HEAD_REF}" --format markdown > /tmp/comparison.md 2>/tmp/comparison-stderr.txt; then
5565
echo "has_significant_changes=true" >> "$GITHUB_OUTPUT"
5666
else
5767
echo "has_significant_changes=false" >> "$GITHUB_OUTPUT"

.github/workflows/pull_request.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@ name: Pull request
22

33
permissions:
44
contents: read
5+
issues: read
6+
pull-requests: read
57

68
on:
79
pull_request:
8-
types: [opened, reopened, synchronize]
10+
types: [opened, edited, reopened, labeled, unlabeled, synchronize]
911

1012
jobs:
13+
github_actiion_pr_dependency_check:
14+
name: GitHub Action Dependency Check
15+
uses: ./.github/workflows/github_actions_dependencies.yml
16+
1117
tests_with_docker_embedded_swift:
1218
name: Test Embedded Swift SDKs
1319
uses: ./.github/workflows/swift_package_test.yml
20+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
1421
with:
1522
# Wasm
1623
enable_linux_checks: false
@@ -23,6 +30,7 @@ jobs:
2330
tests_with_docker:
2431
name: Test with Docker
2532
uses: ./.github/workflows/swift_package_test.yml
33+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
2634
with:
2735
# Linux
2836
linux_os_versions: '["jammy", "rhel-ubi9", "amazonlinux2"]'
@@ -46,6 +54,7 @@ jobs:
4654
tests_without_docker:
4755
name: Test without Docker
4856
uses: ./.github/workflows/swift_package_test.yml
57+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
4958
with:
5059
# Skip Linux which doesn't currently support docker-less workflow
5160
enable_linux_checks: false
@@ -61,10 +70,13 @@ jobs:
6170
Invoke-Program swift build
6271
enable_windows_docker: false
6372
windows_os_versions: '["windows-2022", "windows-11-arm"]'
73+
# FreeBSD
74+
enable_freebsd_checks: true
6475

6576
tests_macos:
6677
name: Test
6778
uses: ./.github/workflows/swift_package_test.yml
79+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
6880
with:
6981
enable_linux_checks: false
7082
enable_windows_checks: false
@@ -77,6 +89,7 @@ jobs:
7789
build_tests_ios:
7890
name: Build iOS Tests
7991
uses: ./.github/workflows/swift_package_test.yml
92+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
8093
with:
8194
enable_linux_checks: false
8295
enable_windows_checks: false
@@ -89,6 +102,7 @@ jobs:
89102
soundness:
90103
name: Soundness
91104
uses: ./.github/workflows/soundness.yml
105+
if: ${{ github.event_name == 'opened' || github.event_name == 'reopened' || github.event_name == 'synchronize' }}
92106
with:
93107
api_breakage_check_enabled: false
94108
license_header_check_project_name: "Swift.org"

.github/workflows/scripts/cross-pr-checkout.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ struct CrossRepoPR {
142142
func getCrossRepoPrs(repository: String, prNumber: String) async throws -> [CrossRepoPR] {
143143
var result: [CrossRepoPR] = []
144144
let prInfo = try await getPRInfo(repository: repository, prNumber: prNumber)
145-
for line in prInfo.body?.split(separator: "\n") ?? [] {
145+
for line in prInfo.body?.split(whereSeparator: \.isNewline) ?? [] {
146146
guard line.lowercased().starts(with: "linked pr:") else {
147147
continue
148148
}

.github/workflows/scripts/install-and-build-with-sdk.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ command -v jq >/dev/null || install_package jq
199199
SWIFT_API_INSTALL_ROOT="https://www.swift.org/api/v1/install"
200200

201201
# Transforms a minor Swift release version into its latest patch version
202-
# and gets the checksum for the patch version's Static Linux and/or Wasm Swift SDK.
202+
# and gets the checksum for the patch version's Android, Static Linux, or Wasm Swift SDK.
203203
#
204204
# $1 (string): A minor Swift version, e.g. "6.1"
205205
# Output: A string of the form "<patch-version>|<android-checksum>|<static-checksum>|<static-version>|<wasm-checksum>
@@ -233,7 +233,7 @@ find_latest_swift_version() {
233233
.[]
234234
| select(.name == $version)
235235
| .platforms[]
236-
| select(.platform == "android")
236+
| select(.platform == "android-sdk")
237237
| .checksum
238238
')
239239

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
##===----------------------------------------------------------------------===##
2+
##
3+
## This source file is part of the Swift.org open source project
4+
##
5+
## Copyright (c) 2026 Apple Inc. and the Swift project authors
6+
## Licensed under Apache License v2.0 with Runtime Library Exception
7+
##
8+
## See https://swift.org/LICENSE.txt for license information
9+
## See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
##
11+
##===----------------------------------------------------------------------===##
12+
. $PSScriptRoot\install-swift.ps1
13+
14+
if ([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture -eq "Arm64") {
15+
$SWIFT='https://download.swift.org/swift-6.3-release/windows10-arm64/swift-6.3-RELEASE/swift-6.3-RELEASE-windows10-arm64.exe'
16+
$SWIFT_SHA256='eca190022838d48984d04f8fdedef613e6252f694df2079e7eb6c4137b8bbdac'
17+
} else {
18+
$SWIFT='https://download.swift.org/swift-6.3-release/windows10/swift-6.3-RELEASE/swift-6.3-RELEASE-windows10.exe'
19+
$SWIFT_SHA256='a1370df009de920070aef0c87d4ff80279515870ddbe6e8f035b2a5707444f13'
20+
}
21+
22+
Install-Swift -Url $SWIFT -Sha256 $SWIFT_SHA256

.github/workflows/soundness.yml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -132,21 +132,25 @@ jobs:
132132
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
133133
- name: Pre-build
134134
if: ${{ inputs.linux_pre_build_command }}
135+
# zizmor: ignore[template-injection]
135136
run: ${{ inputs.linux_pre_build_command }}
136137
- name: Run API breakage check
137138
shell: bash
139+
env:
140+
API_BREAKAGE_CHECK_BASELINE: ${{ inputs.api_breakage_check_baseline }}
141+
API_BREAKAGE_CHECK_ALLOWLIST_PATH: ${{ inputs.api_breakage_check_allowlist_path }}
138142
run: |
139-
if [[ -z '${{ inputs.api_breakage_check_baseline }}' ]]; then
143+
if [[ -z "${API_BREAKAGE_CHECK_BASELINE}" ]]; then
140144
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
141145
BASELINE_REF='pull-base-ref'
142146
else
143-
BASELINE_REF='${{ inputs.api_breakage_check_baseline }}'
147+
BASELINE_REF="${API_BREAKAGE_CHECK_BASELINE}"
144148
fi
145149
echo "Using baseline: $BASELINE_REF"
146-
if [[ -z '${{ inputs.api_breakage_check_allowlist_path }}' ]]; then
150+
if [[ -z "${API_BREAKAGE_CHECK_ALLOWLIST_PATH}" ]]; then
147151
swift package diagnose-api-breaking-changes "$BASELINE_REF"
148152
else
149-
swift package diagnose-api-breaking-changes "$BASELINE_REF" --breakage-allowlist-path '${{ inputs.api_breakage_check_allowlist_path }}'
153+
swift package diagnose-api-breaking-changes "$BASELINE_REF" --breakage-allowlist-path "${API_BREAKAGE_CHECK_ALLOWLIST_PATH}"
150154
fi
151155
152156
docs-check:
@@ -178,11 +182,13 @@ jobs:
178182
fi
179183
- name: Pre-build
180184
if: ${{ inputs.linux_pre_build_command }}
185+
# zizmor: ignore[template-injection]
181186
run: ${{ inputs.linux_pre_build_command }}
182187
- name: Run documentation check
183188
env:
184189
ADDITIONAL_DOCC_ARGUMENTS: ${{ inputs.docs_check_additional_arguments }}
185-
run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-docs.sh
190+
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
191+
run: ${SCRIPT_ROOT}/.github/workflows/scripts/check-docs.sh
186192

187193
docs-check-macos:
188194
name: Documentation check (macOS)
@@ -210,15 +216,18 @@ jobs:
210216
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
211217
fi
212218
- name: Select Xcode
213-
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ inputs.docs_check_macos_xcode_version }}.app" >> $GITHUB_ENV
219+
env:
220+
XCODE_VERSION: ${{ inputs.docs_check_macos_xcode_version }}
221+
run: echo "DEVELOPER_DIR=/Applications/Xcode_${XCODE_VERSION}.app" >> $GITHUB_ENV
214222
- name: Swift version
215223
run: xcrun swift --version
216224
- name: Clang version
217225
run: xcrun clang --version
218226
- name: Run documentation check
219227
env:
220228
ADDITIONAL_DOCC_ARGUMENTS: ${{ inputs.docs_check_macos_additional_arguments }}
221-
run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-docs.sh
229+
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
230+
run: ${SCRIPT_ROOT}/.github/workflows/scripts/check-docs.sh
222231

223232
unacceptable-language-check:
224233
name: Unacceptable language check
@@ -248,7 +257,8 @@ jobs:
248257
- name: Run unacceptable language check
249258
env:
250259
UNACCEPTABLE_WORD_LIST: ${{ inputs.unacceptable_language_check_word_list}}
251-
run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-unacceptable-language.sh
260+
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
261+
run: ${SCRIPT_ROOT}/.github/workflows/scripts/check-unacceptable-language.sh
252262

253263
license-header-check:
254264
name: License headers check
@@ -278,7 +288,8 @@ jobs:
278288
- name: Run license header check
279289
env:
280290
PROJECT_NAME: ${{ inputs.license_header_check_project_name }}
281-
run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-license-header.sh
291+
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
292+
run: ${SCRIPT_ROOT}/.github/workflows/scripts/check-license-header.sh
282293

283294
broken-symlink-check:
284295
name: Broken symlinks check
@@ -306,7 +317,9 @@ jobs:
306317
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
307318
fi
308319
- name: Run broken symlinks check
309-
run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-broken-symlinks.sh
320+
env:
321+
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
322+
run: ${SCRIPT_ROOT}/.github/workflows/scripts/check-broken-symlinks.sh
310323

311324
format-check:
312325
name: Format check
@@ -339,7 +352,9 @@ jobs:
339352
# https://github.com/actions/checkout/issues/766
340353
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
341354
- name: Run format check
342-
run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-swift-format.sh
355+
env:
356+
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
357+
run: ${SCRIPT_ROOT}/.github/workflows/scripts/check-swift-format.sh
343358

344359
shell-check:
345360
name: Shell check
@@ -390,12 +405,14 @@ jobs:
390405
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
391406
fi
392407
- name: Run yamllint
408+
env:
409+
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
393410
run: |
394411
which yamllint || (apt -q update && apt install -yq yamllint)
395412
cd ${GITHUB_WORKSPACE}
396413
if [ ! -f ".yamllint.yml" ]; then
397414
echo "Downloading default yamllint config file"
398-
cat ${{ steps.script_path.outputs.root }}/.github/workflows/configs/yamllint.yml > .yamllint.yml
415+
cat "${SCRIPT_ROOT}/.github/workflows/configs/yamllint.yml" > .yamllint.yml
399416
fi
400417
yamllint --strict --config-file .yamllint.yml .
401418
@@ -425,11 +442,13 @@ jobs:
425442
echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT
426443
fi
427444
- name: Run flake8
445+
env:
446+
SCRIPT_ROOT: ${{ steps.script_path.outputs.root }}
428447
run: |
429448
pip3 install flake8 flake8-import-order
430449
cd ${GITHUB_WORKSPACE}
431450
if [ ! -f ".flake8" ]; then
432451
echo "Downloading default flake8 config file"
433-
cat ${{ steps.script_path.outputs.root }}/.github/workflows/configs/.flake8 > .flake8
452+
cat "${SCRIPT_ROOT}/.github/workflows/configs/.flake8" > .flake8
434453
fi
435454
flake8

0 commit comments

Comments
 (0)