Skip to content

Commit b8e77ad

Browse files
Prachi Gauriarprachigauriar
authored andcommitted
Disable GitHub Actions for iOS, tvOS, and watchOS
- Due to the poor reliability of GitHub Actions, we are disabling PR checks for iOS and tvOS. - We’ve added Scripts/test-all-platforms, which runs tests against iOS, macOS, and tvOS. - We’ve updated install-git-hooks to install test-all-actions as a pre-push hook
1 parent 46a5dab commit b8e77ad

File tree

6 files changed

+122
-15
lines changed

6 files changed

+122
-15
lines changed

.github/workflows/VerifyChanges.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
steps:
1515
- name: Checkout
1616
uses: actions/checkout@v4
17-
- name: Select Xcode 16.4
17+
- name: Select Xcode 26.0.0
1818
run: |
19-
sudo xcode-select -s /Applications/Xcode_16.4.0.app
19+
sudo xcode-select -s /Applications/Xcode_26.0.0.app
2020
- name: Lint
2121
run: |
2222
Scripts/lint
@@ -28,12 +28,12 @@ jobs:
2828
fail-fast: false
2929
matrix:
3030
include:
31-
- platform: iOS
32-
xcode_destination: "platform=iOS Simulator,name=iPhone SE (3rd generation)"
31+
# - platform: iOS
32+
# xcode_destination: "platform=iOS Simulator,name=iPhone SE (3rd generation)"
3333
- platform: macOS
3434
xcode_destination: "platform=macOS,arch=arm64"
35-
- platform: tvOS
36-
xcode_destination: "platform=tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p)"
35+
# - platform: tvOS
36+
# xcode_destination: "platform=tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p)"
3737
env:
3838
DEV_BUILDS: DevBuilds/Sources
3939
OTHER_XCODE_FLAGS: ${{ matrix.other_xcode_flags }}
@@ -68,9 +68,9 @@ jobs:
6868
sourcepackages-directory: .build/DerivedData/SourcePackages
6969
swiftpm-package-resolved-file: Package.resolved
7070
verbose: true
71-
- name: Select Xcode 16.4
71+
- name: Select Xcode 26.0
7272
run: |
73-
sudo xcode-select -s /Applications/Xcode_16.4.0.app
73+
sudo xcode-select -s /Applications/Xcode_26.0.0.app
7474
- name: Build for Testing
7575
run: |
7676
"$DEV_BUILDS"/build_and_test.sh --action build-for-testing
@@ -116,9 +116,9 @@ jobs:
116116
- name: Download xccovPretty output
117117
uses: actions/download-artifact@v4
118118
with:
119-
name: xccovPrettyOutput-iOS
119+
name: xccovPrettyOutput-macOS
120120
- name: Post Code Coverage Comment
121121
uses: thollander/actions-comment-pull-request@v3
122122
with:
123-
file-path: xccovPretty-iOS.output
124-
comment-tag: codeCoverage-iOS
123+
file-path: xccovPretty-macOS.output
124+
comment-tag: codeCoverage-macOS

.swift-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"lineBreakBetweenDeclarationAttributes": false,
1515
"lineLength": 120,
1616
"maximumBlankLines": 2,
17+
"multilineTrailingCommaBehavior": "alwaysUsed",
1718
"multiElementCollectionTrailingCommas": true,
1819
"noAssignmentInExpressions": {
1920
"allowedFunctions": []

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.1
1+
// swift-tools-version: 6.2
22

33
import PackageDescription
44

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ View our [changelog](CHANGELOG.md) to see what’s new.
3232

3333
## Development Requirements
3434

35-
DevColorExtraction requires a Swift 6.1 toolchain to build. We only test on Apple platforms. We follow
35+
DevColorExtraction requires a Swift 6.2+ toolchain to build. We only test on Apple platforms. We follow
3636
the [Swift API Design Guidelines][SwiftAPIDesignGuidelines]. We take pride in the fact that our
3737
public interfaces are fully documented and tested. We aim for overall test coverage over 97%.
3838

@@ -42,9 +42,24 @@ public interfaces are fully documented and tested. We aim for overall test cover
4242

4343
To set up the development environment:
4444

45-
1. Run `Scripts/install-git-hooks` to install pre-commit hooks that automatically check code
46-
formatting.
45+
1. Run `Scripts/install-git-hooks` to install git hooks that automatically check code
46+
formatting on commits and run comprehensive tests before pushing.
4747
2. Use `Scripts/lint` to manually check code formatting at any time.
48+
3. Use `Scripts/test-all-platforms` to run tests on all supported platforms locally.
49+
50+
51+
## Continuous Integration
52+
53+
DevColorExtraction uses GitHub Actions for continuous integration. The CI pipeline:
54+
55+
- **Linting**: Automatically checks code formatting on all pull requests using `swift format`
56+
- **Testing**: Runs tests on macOS (iOS and tvOS testing are disabled in CI due to reliability
57+
issues)
58+
- **Coverage**: Generates code coverage reports using xccovPretty
59+
60+
For comprehensive cross-platform testing, developers should run `Scripts/test-all-platforms`
61+
locally or rely on the pre-push git hook which automatically runs all platform tests before
62+
pushing changes.
4863

4964

5065
## Bugs and Feature Requests

Scripts/install-git-hooks

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,41 @@ EOF
4343
echo "Pre-commit hook installed successfully!"
4444
}
4545

46+
# Function to install the pre-push hook
47+
install_pre_push_hook() {
48+
local pre_push_hook="$REPO_ROOT/.git/hooks/pre-push"
49+
50+
echo "Installing pre-push hook..."
51+
52+
cat > "$pre_push_hook" << 'EOF'
53+
#!/bin/bash
54+
55+
# Get the directory where this hook is located
56+
HOOK_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
57+
58+
# Go to the repository root (two levels up from .git/hooks)
59+
REPO_ROOT="$(dirname "$(dirname "$HOOK_DIR")")"
60+
61+
# Run the test-all-platforms script
62+
echo "Running tests on all platforms..."
63+
if ! "$REPO_ROOT/Scripts/test-all-platforms"; then
64+
echo "Platform tests failed. Please fix issues before pushing."
65+
exit 1
66+
fi
67+
68+
echo "All platform tests passed."
69+
EOF
70+
71+
chmod +x "$pre_push_hook"
72+
echo "Pre-push hook installed successfully!"
73+
}
74+
4675
# Install the pre-commit hook
4776
install_pre_commit_hook
4877

78+
# Install the pre-push hook
79+
install_pre_push_hook
80+
4981
echo "All git hooks installed successfully!"
5082
echo "The pre-commit hook will run 'Scripts/lint' before each commit."
83+
echo "The pre-push hook will run 'Scripts/test-all-platforms' before each push."

Scripts/test-all-platforms

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
# Colors for output
6+
RED='\033[0;31m'
7+
GREEN='\033[0;32m'
8+
YELLOW='\033[1;33m'
9+
NC='\033[0m' # No Color
10+
11+
# Function to print colored output
12+
print_status() {
13+
echo -e "${YELLOW}[$(date +'%H:%M:%S')] $1${NC}"
14+
}
15+
16+
print_success() {
17+
echo -e "${GREEN}$1${NC}"
18+
}
19+
20+
print_error() {
21+
echo -e "${RED}$1${NC}"
22+
}
23+
24+
# Platforms to test
25+
PLATFORMS=(
26+
"iOS Simulator,name=iPhone 16 Pro"
27+
"macOS"
28+
"tvOS Simulator,name=Apple TV 4K"
29+
)
30+
31+
SCHEME="DevColorExtraction"
32+
FAILED_PLATFORMS=()
33+
34+
print_status "Starting tests on all platforms..."
35+
echo
36+
37+
for platform in "${PLATFORMS[@]}"; do
38+
platform_name=$(echo "$platform" | cut -d',' -f1)
39+
print_status "Testing on $platform_name..."
40+
41+
if xcodebuild test -scheme "$SCHEME" -destination "platform=$platform"; then
42+
print_success "$platform_name tests passed"
43+
else
44+
print_error "$platform_name tests failed"
45+
FAILED_PLATFORMS+=("$platform_name")
46+
fi
47+
echo
48+
done
49+
50+
# Summary
51+
echo "=========================="
52+
if [ ${#FAILED_PLATFORMS[@]} -eq 0 ]; then
53+
print_success "All platform tests passed!"
54+
exit 0
55+
else
56+
print_error "Tests failed on: ${FAILED_PLATFORMS[*]}"
57+
exit 1
58+
fi

0 commit comments

Comments
 (0)