Skip to content

Commit 35a1965

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, tvOS, and watchOS. - We’ve added Scripts/test-all-platforms, which runs tests against iOS, macOS, tvOS, and watchOS. - We’ve updated install-git-hooks to install test-all-actions as a pre-push hook
1 parent 33c75ae commit 35a1965

File tree

7 files changed

+128
-14
lines changed

7 files changed

+128
-14
lines changed

.github/workflows/VerifyChanges.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ jobs:
2828
fail-fast: false
2929
matrix:
3030
include:
31-
- platform: iOS
32-
xcode_destination: "platform=iOS Simulator,name=iPhone 16 Pro"
31+
# - platform: iOS
32+
# xcode_destination: "platform=iOS Simulator,name=iPhone 16 Pro"
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)"
37-
- platform: watchOS
38-
xcode_destination: "platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)"
35+
# - platform: tvOS
36+
# xcode_destination: "platform=tvOS Simulator,name=Apple TV 4K (3rd generation)"
37+
# - platform: watchOS
38+
# xcode_destination: "platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)"
3939
env:
4040
DEV_BUILDS: DevBuilds/Sources
4141
XCCOV_PRETTY_VERSION: 1.2.0

CLAUDE.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ repository.
2323
- **Swift format configuration**: Uses `.swift-format` file with 4-space indentation and 120
2424
character line length
2525

26+
### Platform Testing
27+
28+
- **Test all platforms**: `Scripts/test-all-platforms` (runs tests on iOS, macOS, tvOS, and
29+
watchOS simulators using xcodebuild)
30+
2631
### Git Hooks
2732

28-
- **Install git hooks**: `Scripts/install-git-hooks` (installs pre-commit hook that runs lint
29-
check)
33+
- **Install git hooks**: `Scripts/install-git-hooks` (installs both pre-commit and pre-push
34+
hooks)
3035
- **Pre-commit hook**: Automatically runs `Scripts/lint` before each commit
36+
- **Pre-push hook**: Automatically runs `Scripts/test-all-platforms` before each push
3137

3238
### Documentation
3339

@@ -74,7 +80,8 @@ reproducibility.
7480
- **Test Plans**: Uses `DevTesting.xctestplan` for organized test execution
7581
- **Coverage Target**: Aims for 99%+ test coverage
7682
- **Platform Testing**: Tests run on iOS, macOS, tvOS, and watchOS simulators
77-
- **CI/CD**: GitHub Actions workflow with matrix strategy across platforms
83+
- **CI/CD**: GitHub Actions workflow runs builds on macOS only (iOS, tvOS, and watchOS builds
84+
disabled due to stability/reliability issues)
7885

7986
### Documentation Standards
8087

README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,24 @@ interfaces are fully documented and tested. We aim for overall test coverage ove
3838

3939
To set up the development environment:
4040

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

4560

4661
## 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: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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+
"watchOS Simulator,name=Apple Watch Series 10"
30+
)
31+
32+
SCHEME="DevTesting"
33+
FAILED_PLATFORMS=()
34+
35+
print_status "Starting tests on all platforms..."
36+
echo
37+
38+
for platform in "${PLATFORMS[@]}"; do
39+
platform_name=$(echo "$platform" | cut -d',' -f1)
40+
print_status "Testing on $platform_name..."
41+
42+
if xcodebuild test -scheme "$SCHEME" -destination "platform=$platform"; then
43+
print_success "$platform_name tests passed"
44+
else
45+
print_error "$platform_name tests failed"
46+
FAILED_PLATFORMS+=("$platform_name")
47+
fi
48+
echo
49+
done
50+
51+
# Summary
52+
echo "=========================="
53+
if [ ${#FAILED_PLATFORMS[@]} -eq 0 ]; then
54+
print_success "All platform tests passed!"
55+
exit 0
56+
else
57+
print_error "Tests failed on: ${FAILED_PLATFORMS[*]}"
58+
exit 1
59+
fi

Tests/DevTestingTests/Random Value Generation/URLComponents+RandomTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ struct URLComponents_RandomTests {
4747
let nilFragmentPercentage = Double(nilFragmentCount) / Double(iterationCount)
4848
let nilQueryItemsPercentage = Double(nilQueryItemsCount) / Double(iterationCount)
4949

50-
#expect(nilFragmentPercentage.isApproximatelyEqual(to: 0.5, absoluteTolerance: 0.03))
51-
#expect(nilQueryItemsPercentage.isApproximatelyEqual(to: 0.5, absoluteTolerance: 0.03))
50+
#expect(nilFragmentPercentage.isApproximatelyEqual(to: 0.5, absoluteTolerance: 0.05))
51+
#expect(nilQueryItemsPercentage.isApproximatelyEqual(to: 0.5, absoluteTolerance: 0.05))
5252
}
5353

5454

Tests/DevTestingTests/Random Value Generation/URLQueryItem+RandomTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ struct URLQueryItem_RandomTests {
2929
}
3030

3131
let nilValuePercentage = Double(nilValueCount) / Double(iterationCount)
32-
#expect(nilValuePercentage.isApproximatelyEqual(to: 0.1, absoluteTolerance: 0.03))
32+
#expect(nilValuePercentage.isApproximatelyEqual(to: 0.1, absoluteTolerance: 0.05))
3333
}
3434
}

0 commit comments

Comments
 (0)