Skip to content

Commit 84b3e6e

Browse files
authored
[CI] Add support for GitHub Actions (swiftlang#9391)
Known issues: * swiftlang#9393 * We are only building, and not running testing due to timeout. * Testing for Swift SDK for Android and static sdk are currently disabled.
1 parent ae9ba6d commit 84b3e6e

File tree

14 files changed

+332
-105
lines changed

14 files changed

+332
-105
lines changed

.github/ISSUE_TEMPLATE/BUG_REPORT.yml

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,54 @@ name: Bug Report
22
description: Something isn't working as expected
33
labels: [bug]
44
body:
5-
- type: checkboxes
6-
id: cat-preferences
7-
attributes:
8-
label: "Is it reproducible with SwiftPM command-line tools: `swift build`, `swift test`, `swift package` etc?"
9-
description: "Issues related to closed-source software are not tracked by this repository and will be closed. For Xcode and `xcodebuild`, please file a feedback at https://feedbackassistant.apple.com instead."
10-
options:
11-
- label: Confirmed reproduction steps with SwiftPM CLI. The description text _must_ include reproduction steps with either of command-line SwiftPM commands, `swift build`, `swift test`, `swift package` etc.
12-
required: true
13-
- type: textarea
14-
attributes:
15-
label: Description
16-
validations:
17-
required: true
18-
- type: textarea
19-
attributes:
20-
label: Expected behavior
21-
description: What you expected to happen.
22-
validations:
23-
required: false
24-
- type: textarea
25-
attributes:
26-
label: Actual behavior
27-
description: What actually happened.
28-
validations:
29-
required: false
30-
- type: textarea
31-
attributes:
32-
label: Steps to reproduce
33-
placeholder: |
34-
1. ...
35-
2. ...
36-
validations:
37-
required: false
38-
- type: input
39-
attributes:
40-
label: Swift Package Manager version/commit hash
41-
validations:
42-
required: false
43-
- type: textarea
44-
attributes:
45-
label: Swift & OS version (output of `swift --version ; uname -a`)
46-
validations:
47-
required: false
5+
- type: checkboxes
6+
id: cat-preferences
7+
attributes:
8+
label: >-
9+
Is it reproducible with SwiftPM command-line tools: `swift build`,
10+
`swift test`, `swift package` etc?
11+
description: >-
12+
Issues related to closed-source software are not tracked by this
13+
repository and will be closed. For Xcode and `xcodebuild`, please
14+
file a feedback at https://feedbackassistant.apple.com instead."
15+
options:
16+
- label: >-
17+
Confirmed reproduction steps with SwiftPM CLI. The description
18+
text _must_ include reproduction steps with either of command-line
19+
SwiftPM commands, `swift build`, `swift test`, `swift package` etc.
20+
required: true
21+
- type: textarea
22+
attributes:
23+
label: Description
24+
validations:
25+
required: true
26+
- type: textarea
27+
attributes:
28+
label: Expected behavior
29+
description: What you expected to happen.
30+
validations:
31+
required: false
32+
- type: textarea
33+
attributes:
34+
label: Actual behavior
35+
description: What actually happened.
36+
validations:
37+
required: false
38+
- type: textarea
39+
attributes:
40+
label: Steps to reproduce
41+
placeholder: |
42+
1. ...
43+
2. ...
44+
validations:
45+
required: false
46+
- type: input
47+
attributes:
48+
label: Swift Package Manager version/commit hash
49+
validations:
50+
required: false
51+
- type: textarea
52+
attributes:
53+
label: Swift & OS version (output of `swift --version ; uname -a`)
54+
validations:
55+
required: false

.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,38 @@ name: Feature Request
22
description: A suggestion for a new feature
33
labels: [enhancement]
44
body:
5-
- type: textarea
6-
attributes:
7-
label: Description
8-
validations:
9-
required: true
10-
- type: textarea
11-
attributes:
12-
label: Expected behavior
13-
description: What you expected to happen.
14-
validations:
15-
required: false
16-
- type: textarea
17-
attributes:
18-
label: Actual behavior
19-
description: What actually happened.
20-
validations:
21-
required: false
22-
- type: textarea
23-
attributes:
24-
label: Steps to reproduce
25-
placeholder: |
26-
1. ...
27-
2. ...
28-
validations:
29-
required: false
30-
- type: input
31-
attributes:
32-
label: Swift Package Manager version/commit hash
33-
validations:
34-
required: false
35-
- type: textarea
36-
attributes:
37-
label: Swift & OS version (output of `swift --version && uname -a`)
38-
validations:
39-
required: false
5+
- type: textarea
6+
attributes:
7+
label: Description
8+
validations:
9+
required: true
10+
- type: textarea
11+
attributes:
12+
label: Expected behavior
13+
description: What you expected to happen.
14+
validations:
15+
required: false
16+
- type: textarea
17+
attributes:
18+
label: Actual behavior
19+
description: What actually happened.
20+
validations:
21+
required: false
22+
- type: textarea
23+
attributes:
24+
label: Steps to reproduce
25+
placeholder: |
26+
1. ...
27+
2. ...
28+
validations:
29+
required: false
30+
- type: input
31+
attributes:
32+
label: Swift Package Manager version/commit hash
33+
validations:
34+
required: false
35+
- type: textarea
36+
attributes:
37+
label: Swift & OS version (output of `swift --version && uname -a`)
38+
validations:
39+
required: false

.github/scripts/prebuild.ps1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
##===----------------------------------------------------------------------===##
2+
##
3+
## This source file is part of the Swift open source project
4+
##
5+
## Copyright (c) 2025 Apple Inc. and the Swift project authors
6+
## Licensed under Apache License v2.0 with Runtime Library Exception
7+
##
8+
## See http://swift.org/LICENSE.txt for license information
9+
## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
##
11+
##===----------------------------------------------------------------------===##
12+
13+
param (
14+
[switch]$SkipAndroid,
15+
[switch]$InstallCMake
16+
)
17+
18+
# winget isn't easily made available in containers, so use chocolatey
19+
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
20+
21+
if ($InstallCMake) {
22+
choco install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' --apply-install-arguments-to-dependencies
23+
choco install -y ninja
24+
25+
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
26+
refreshenv
27+
28+
# Let swiftc find the path to link.exe in the CMake smoke test
29+
$env:Path += ";$(Split-Path -Path "$(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" "-latest" -products Microsoft.VisualStudio.Product.BuildTools -find VC\Tools\MSVC\*\bin\HostX64\x64\link.exe)" -Parent)"
30+
}
31+
32+
if (-not $SkipAndroid) {
33+
choco install -y android-ndk
34+
35+
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
36+
refreshenv
37+
38+
# Work around a bug in the package causing the env var to be set incorrectly
39+
$env:ANDROID_NDK_ROOT = $env:ANDROID_NDK_ROOT.replace('-windows.zip','')
40+
}

.github/scripts/prebuild.sh

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#!/bin/bash
2+
##===----------------------------------------------------------------------===##
3+
##
4+
## This source file is part of the Swift open source project
5+
##
6+
## Copyright (c) 2025 Apple Inc. and the Swift project authors
7+
## Licensed under Apache License v2.0 with Runtime Library Exception
8+
##
9+
## See http://swift.org/LICENSE.txt for license information
10+
## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
11+
##
12+
##===----------------------------------------------------------------------===##
13+
14+
set -e
15+
16+
if [[ $(uname) == Darwin ]] ; then
17+
if [[ "$INSTALL_CMAKE" == "1" ]] ; then
18+
mkdir -p "$RUNNER_TOOL_CACHE"
19+
if ! command -v cmake >/dev/null 2>&1 ; then
20+
curl -fsSLO https://github.com/Kitware/CMake/releases/download/v4.1.2/cmake-4.1.2-macos-universal.tar.gz
21+
echo '3be85f5b999e327b1ac7d804cbc9acd767059e9f603c42ec2765f6ab68fbd367 cmake-4.1.2-macos-universal.tar.gz' > cmake-4.1.2-macos-universal.tar.gz.sha256
22+
sha256sum -c cmake-4.1.2-macos-universal.tar.gz.sha256
23+
tar -xf cmake-4.1.2-macos-universal.tar.gz
24+
ln -s "$PWD/cmake-4.1.2-macos-universal/CMake.app/Contents/bin/cmake" "$RUNNER_TOOL_CACHE/cmake"
25+
fi
26+
if ! command -v ninja >/dev/null 2>&1 ; then
27+
curl -fsSLO https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-mac.zip
28+
echo 'da7797794153629aca5570ef7c813342d0be214ba84632af886856e8f0063dd9 ninja-mac.zip' > ninja-mac.zip.sha256
29+
sha256sum -c ninja-mac.zip.sha256
30+
unzip ninja-mac.zip
31+
rm -f ninja-mac.zip
32+
mv ninja "$RUNNER_TOOL_CACHE/ninja"
33+
fi
34+
fi
35+
elif command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy
36+
export DEBIAN_FRONTEND=noninteractive
37+
38+
apt-get update -y
39+
40+
# Build dependencies
41+
apt-get install -y libsqlite3-dev libncurses-dev
42+
43+
# Debug symbols
44+
apt-get install -y libc6-dbg
45+
46+
if [[ "$INSTALL_CMAKE" == "1" ]] ; then
47+
apt-get install -y cmake ninja-build
48+
fi
49+
50+
# Android NDK
51+
dpkg_architecture="$(dpkg --print-architecture)"
52+
if [[ "$SKIP_ANDROID" != "1" ]] && [[ "$dpkg_architecture" == amd64 ]] ; then
53+
eval "$(cat /etc/os-release)"
54+
case "$VERSION_CODENAME" in
55+
bookworm|jammy)
56+
: # Not available
57+
;;
58+
noble)
59+
apt-get install -y google-android-ndk-r26c-installer
60+
;;
61+
*)
62+
echo "Unable to fetch Android NDK for unknown Linux distribution: $VERSION_CODENAME" >&2
63+
exit 1
64+
esac
65+
else
66+
echo "Skipping Android NDK installation on $dpkg_architecture" >&2
67+
fi
68+
elif command -v dnf >/dev/null 2>&1 ; then # rhel-ubi9
69+
dnf update -y
70+
71+
# Build dependencies
72+
dnf install -y sqlite-devel ncurses-devel
73+
74+
# Debug symbols
75+
dnf debuginfo-install -y glibc
76+
elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2
77+
yum update -y
78+
79+
# Build dependencies
80+
yum install -y sqlite-devel ncurses-devel
81+
82+
# Debug symbols
83+
yum install -y yum-utils
84+
debuginfo-install -y glibc
85+
fi

.github/workflows/automerge.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Create PR to merge main into release branch
2+
# In the first period after branching the release branch,
3+
# we typically want to include many changes from `main` in the release branch.
4+
# This workflow automatically creates a PR to merge the main into the release branch.
5+
# Later in the release cycle we should stop this practice to avoid landing risky changes by disabling this workflow.
6+
# To do so, disable the workflow as described in https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/disabling-and-enabling-a-workflow
7+
permissions:
8+
contents: read
9+
on:
10+
schedule:
11+
- cron: '0 9 * * MON'
12+
workflow_dispatch:
13+
jobs:
14+
create_merge_pr:
15+
name: Create PR to merge main into release branch
16+
uses: swiftlang/github-workflows/.github/workflows/create_automerge_pr.yml@main
17+
with:
18+
head_branch: main
19+
base_branch: release/6.3
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
if: (github.event_name == 'schedule' && github.repository == 'swiftlang/swift-package-manager') || (github.event_name != 'schedule') # Ensure that we don't run this on a schedule in a fork

.github/workflows/pull_request.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Pull request
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
pull_request:
8+
types: [opened, reopened, synchronize]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
tests:
16+
name: Test
17+
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
18+
with:
19+
linux_os_versions: '["amazonlinux2", "bookworm", "noble", "jammy", "rhel-ubi9"]'
20+
linux_swift_versions: '["nightly-main"]'
21+
linux_pre_build_command: ./.github/scripts/prebuild.sh
22+
linux_build_command: 'swift build'
23+
windows_swift_versions: '["nightly-main"]'
24+
windows_pre_build_command: 'Invoke-Program .\.github\scripts\prebuild.ps1'
25+
windows_build_command: 'Invoke-Program swift build'
26+
enable_ios_checks: true
27+
enable_macos_checks: true
28+
macos_exclude_xcode_versions: "[{\"xcode_version\": \"16.3\"}, {\"xcode_version\": \"16.4\"}]"
29+
macos_build_command: 'swift build'
30+
31+
soundness:
32+
name: Soundness
33+
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
34+
with:
35+
license_header_check_project_name: "Swift"
36+
license_header_check_enabled: false
37+
unacceptable_language_check_enabled: false
38+
api_breakage_check_enabled: false
39+
format_check_enabled: false
40+
shell_check_enabled: false

.license_header_template

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@@===----------------------------------------------------------------------===@@
2+
@@
3+
@@ This source file is part of the Swift open source project
4+
@@
5+
@@ Copyright (c) YEARS Apple Inc. and the Swift project authors
6+
@@ Licensed under Apache License v2.0 with Runtime Library Exception
7+
@@
8+
@@ See http://swift.org/LICENSE.txt for license information
9+
@@ See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
@@
11+
@@===----------------------------------------------------------------------===@@

.licenseignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
**/*.mlmodel
2+
**/*.pbxproj
3+
**/*.png
4+
**/*.xcworkspacedata
5+
**/Package.swift
6+
.dir-locals.el
7+
.editorconfig
8+
.swift-version
9+
CODEOWNERS
10+
Package.swift

0 commit comments

Comments
 (0)