-
Notifications
You must be signed in to change notification settings - Fork 167
Add support for GitHub Actions #1414
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| #!/bin/bash | ||
| ##===----------------------------------------------------------------------===## | ||
| ## | ||
| ## This source file is part of the Swift open source project | ||
| ## | ||
| ## Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
| ## Licensed under Apache License v2.0 with Runtime Library Exception | ||
| ## | ||
| ## See http://swift.org/LICENSE.txt for license information | ||
| ## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
| ## | ||
| ##===----------------------------------------------------------------------===## | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| fail=0 | ||
|
|
||
| while IFS= read -r file; do | ||
| # Skip empty or binary files | ||
| if [ ! -s "$file" ] || [[ "$file" == *png ]] || [[ "$file" == *mlmodel ]] || [[ "$file" == *mlpackage* ]] ; then | ||
| continue | ||
| fi | ||
|
|
||
| # --- Check for trailing whitespace (spaces or tabs before end of line) --- | ||
| # Using POSIX-compatible regex; no -P flag needed. | ||
| if grep -nE '[[:space:]]+$' "$file" >/dev/null; then | ||
| echo "❌ Trailing whitespace in: $file" | ||
| # Print offending lines (indent for readability) | ||
| grep -nE '[[:space:]]+$' "$file" | sed 's/^/ /' | ||
| fail=1 | ||
| fi | ||
|
|
||
| # --- Check for final newline --- | ||
| # tail -c handles both GNU and BSD variants | ||
| lastchar=$(tail -c 1 "$file" | od -An -tx1 | tr -d ' \n') | ||
| if [[ "$lastchar" != "0a" ]]; then | ||
| echo "❌ Missing final newline: $file" | ||
| fail=1 | ||
| fi | ||
|
|
||
| done < <(git ls-files) | ||
|
|
||
| if [[ $fail -eq 0 ]]; then | ||
| echo "✅ All tracked files are clean (no trailing whitespace, final newline present)." | ||
| else | ||
| echo "⚠️ Some files failed checks." | ||
| exit 1 | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| ##===----------------------------------------------------------------------===## | ||
| ## | ||
| ## This source file is part of the Swift open source project | ||
| ## | ||
| ## Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
| ## Licensed under Apache License v2.0 with Runtime Library Exception | ||
| ## | ||
| ## See http://swift.org/LICENSE.txt for license information | ||
| ## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
| ## | ||
| ##===----------------------------------------------------------------------===## | ||
|
|
||
| param ( | ||
| [switch]$SkipAndroid, | ||
| [switch]$InstallCMake | ||
| ) | ||
|
|
||
| # winget isn't easily made available in containers, so use chocolatey | ||
| 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')) | ||
|
|
||
| if ($InstallCMake) { | ||
| choco install -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' --apply-install-arguments-to-dependencies | ||
| choco install -y ninja | ||
|
|
||
| Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 | ||
| refreshenv | ||
|
|
||
| # Let swiftc find the path to link.exe in the CMake smoke test | ||
| $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)" | ||
| } | ||
|
|
||
| if (-not $SkipAndroid) { | ||
| choco install -y android-ndk | ||
|
|
||
| Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1 | ||
| refreshenv | ||
|
|
||
| # Work around a bug in the package causing the env var to be set incorrectly | ||
| $env:ANDROID_NDK_ROOT = $env:ANDROID_NDK_ROOT.replace('-windows.zip','') | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #!/bin/bash | ||
| ##===----------------------------------------------------------------------===## | ||
| ## | ||
| ## This source file is part of the Swift open source project | ||
| ## | ||
| ## Copyright (c) 2025 Apple Inc. and the Swift project authors | ||
| ## Licensed under Apache License v2.0 with Runtime Library Exception | ||
| ## | ||
| ## See http://swift.org/LICENSE.txt for license information | ||
| ## See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors | ||
| ## | ||
| ##===----------------------------------------------------------------------===## | ||
|
|
||
| set -e | ||
|
|
||
| if [[ $(uname) == Darwin ]] ; then | ||
| if [[ "$INSTALL_CMAKE" == "1" ]] ; then | ||
| mkdir -p "$RUNNER_TOOL_CACHE" | ||
| if ! command -v cmake >/dev/null 2>&1 ; then | ||
| curl -fsSLO https://github.com/Kitware/CMake/releases/download/v4.1.2/cmake-4.1.2-macos-universal.tar.gz | ||
| echo '3be85f5b999e327b1ac7d804cbc9acd767059e9f603c42ec2765f6ab68fbd367 cmake-4.1.2-macos-universal.tar.gz' > cmake-4.1.2-macos-universal.tar.gz.sha256 | ||
| sha256sum -c cmake-4.1.2-macos-universal.tar.gz.sha256 | ||
| tar -xf cmake-4.1.2-macos-universal.tar.gz | ||
| ln -s "$PWD/cmake-4.1.2-macos-universal/CMake.app/Contents/bin/cmake" "$RUNNER_TOOL_CACHE/cmake" | ||
| fi | ||
| if ! command -v ninja >/dev/null 2>&1 ; then | ||
| curl -fsSLO https://github.com/ninja-build/ninja/releases/download/v1.13.1/ninja-mac.zip | ||
| echo 'da7797794153629aca5570ef7c813342d0be214ba84632af886856e8f0063dd9 ninja-mac.zip' > ninja-mac.zip.sha256 | ||
| sha256sum -c ninja-mac.zip.sha256 | ||
| unzip ninja-mac.zip | ||
| rm -f ninja-mac.zip | ||
| mv ninja "$RUNNER_TOOL_CACHE/ninja" | ||
| fi | ||
| fi | ||
| elif command -v apt-get >/dev/null 2>&1 ; then # bookworm, noble, jammy | ||
| export DEBIAN_FRONTEND=noninteractive | ||
|
|
||
| apt-get update -y | ||
|
|
||
| # Build dependencies | ||
| apt-get install -y libsqlite3-dev libncurses-dev | ||
|
|
||
| # Debug symbols | ||
| apt-get install -y libc6-dbg | ||
|
|
||
| if [[ "$INSTALL_CMAKE" == "1" ]] ; then | ||
| apt-get install -y cmake ninja-build | ||
| fi | ||
|
|
||
| # Android NDK | ||
| dpkg_architecture="$(dpkg --print-architecture)" | ||
| if [[ "$SKIP_ANDROID" != "1" ]] && [[ "$dpkg_architecture" == amd64 ]] ; then | ||
| eval "$(cat /etc/os-release)" | ||
| case "$VERSION_CODENAME" in | ||
| bookworm|jammy) | ||
| : # Not available | ||
| ;; | ||
| noble) | ||
| apt-get install -y google-android-ndk-r26c-installer | ||
| ;; | ||
| *) | ||
| echo "Unable to fetch Android NDK for unknown Linux distribution: $VERSION_CODENAME" >&2 | ||
| exit 1 | ||
| esac | ||
| else | ||
| echo "Skipping Android NDK installation on $dpkg_architecture" >&2 | ||
| fi | ||
| elif command -v dnf >/dev/null 2>&1 ; then # rhel-ubi9 | ||
| dnf update -y | ||
|
|
||
| # Build dependencies | ||
| dnf install -y sqlite-devel ncurses-devel | ||
|
|
||
| # Debug symbols | ||
| dnf debuginfo-install -y glibc | ||
| elif command -v yum >/dev/null 2>&1 ; then # amazonlinux2 | ||
| yum update -y | ||
|
|
||
| # Build dependencies | ||
| yum install -y sqlite-devel ncurses-devel | ||
|
|
||
| # Debug symbols | ||
| yum install -y yum-utils | ||
| debuginfo-install -y glibc | ||
| fi |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| name: Pull request | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, reopened, synchronize] | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| tests: | ||
| name: Test | ||
| uses: swiftlang/github-workflows/.github/workflows/[email protected] | ||
| with: | ||
| linux_host_archs: '["x86_64", "aarch64"]' | ||
| linux_swift_versions: '["nightly-main", "nightly-6.3"]' | ||
| windows_swift_versions: '["nightly-main", "nightly-6.3"]' | ||
| enable_macos_checks: true | ||
| soundness: | ||
| name: Soundness | ||
| uses: swiftlang/github-workflows/.github/workflows/[email protected] | ||
| with: | ||
| license_header_check_project_name: "Swift" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -28,7 +28,7 @@ class SignalTests: XCTestCase { | |||||
|
|
||||||
| /// Runs `signal-test-app` and confirms that it exits with code 99. | ||||||
| /// | ||||||
| /// `signal-test-app` sends a kill signal to itself and uses ``Signal`` to intercept that signal | ||||||
| /// `signal-test-app` sends a terminate signal to itself and uses ``Signal`` to intercept that signal | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "kill" and "terminate" are terms of art in the case of signals to stop process execution. In this case it might be better to spell out the specific signal being sent to avoid any other interpretation
Suggested change
|
||||||
| /// and set the exit code to 99. | ||||||
| func testTrappingSignal() throws { | ||||||
| let signalTestAppPath = productDirectory.appendingPathComponent("signal-test-app").path | ||||||
|
|
||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This checker is explicitly trying to find these invalid words in these cases, so I don't think we want them changed. Not 100% sure how to say "this is acceptable" for the soundness checking in a multi-line Swift string here though |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,7 +24,7 @@ Signal.on(Signal.all) { _ in | |
| } | ||
|
|
||
| DispatchQueue.global().asyncAfter(deadline: .now() + 1) { | ||
| kill(getpid(), SIGABRT) | ||
| kill(getpid(), SIGABRT) # ignore-unacceptable-language | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't compile |
||
| } | ||
|
|
||
| print("Signal test app running.") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These checks feel unrelated to the PRs main purpose and could IMO be added later.