Skip to content

Add AGENTS.md agent guidance with CLAUDE.md symlink #1003

Add AGENTS.md agent guidance with CLAUDE.md symlink

Add AGENTS.md agent guidance with CLAUDE.md symlink #1003

Workflow file for this run

# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
test:
runs-on: macos-26
timeout-minutes: 25
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
- name: Xcode Version
run: xcodebuild -version
- name: Download YOLO models
run: |
# Make download script executable and download YOLO models
chmod +x scripts/download-models.sh && scripts/download-models.sh
- name: Install dependencies
run: swift package resolve
- name: Build and Test
run: |
IOS_SIMULATOR=$(xcrun simctl list devices available | grep -E "iPhone.*" | head -1 | sed -E 's/.*\(([A-Z0-9-]+)\).*/\1/')
if [ -z "$IOS_SIMULATOR" ]; then
IOS_DEVICE_TYPE=$(xcrun simctl list devicetypes | grep -E "iPhone" | tail -1 | sed -E 's/.*\(([^)]+)\).*/\1/')
IOS_RUNTIME=$(xcrun simctl list runtimes available | grep -E "iOS" | tail -1 | sed -E 's/.*\(([^)]+)\).*/\1/')
IOS_SIMULATOR=$(xcrun simctl create "CI iPhone" "$IOS_DEVICE_TYPE" "$IOS_RUNTIME")
fi
DESTINATION="platform=iOS Simulator,id=$IOS_SIMULATOR,arch=arm64"
xcodebuild \
-scheme UltralyticsYOLO \
-sdk iphonesimulator \
-derivedDataPath Build/ \
-destination "$DESTINATION" \
-enableCodeCoverage YES \
IPHONEOS_DEPLOYMENT_TARGET=16.0 \
clean build test
- name: Generate Code Coverage Report
run: |
PROFDATA_PATH=$(find Build/Build/ProfileData -name "Coverage.profdata" -type f | head -1)
BINARY_PATH=""
# Prioritize XCTest bundle executable for library/framework coverage
XCTEST_BUNDLE_PATH=$(find Build/Build/Products -path "*Debug-iphonesimulator/*.xctest" -type d | head -1)
if [ -n "$XCTEST_BUNDLE_PATH" ]; then
TEST_BUNDLE_NAME=$(basename "$XCTEST_BUNDLE_PATH" .xctest)
CANDIDATE_PATH="$XCTEST_BUNDLE_PATH/$TEST_BUNDLE_NAME"
if [ -f "$CANDIDATE_PATH" ]; then
BINARY_PATH="$CANDIDATE_PATH"
echo "Using XCTest executable for coverage: $BINARY_PATH"
fi
fi
# Fallback: If no XCTest executable, try to find an .app bundle executable
if [ -z "$BINARY_PATH" ]; then
echo "No .xctest executable found. Looking for an .app bundle."
APP_BUNDLE_PATH=$(find Build/Build/Products -path "*Debug-iphonesimulator/*.app" -not -path "*.xctest/*" -type d | head -1)
if [ -n "$APP_BUNDLE_PATH" ]; then
APP_NAME=$(basename "$APP_BUNDLE_PATH" .app)
# Try executable with the same name as the .app bundle or the scheme name "YOLO"
if [ -f "$APP_BUNDLE_PATH/$APP_NAME" ]; then
BINARY_PATH="$APP_BUNDLE_PATH/$APP_NAME"
echo "Using .app executable (derived name) for coverage: $BINARY_PATH"
elif [ -f "$APP_BUNDLE_PATH/YOLO" ]; then
BINARY_PATH="$APP_BUNDLE_PATH/YOLO"
echo "Using .app executable (YOLO name) for coverage: $BINARY_PATH"
fi
fi
fi
if [ -n "$BINARY_PATH" ] && [ -f "$BINARY_PATH" ] && [ -n "$PROFDATA_PATH" ] && [ -f "$PROFDATA_PATH" ]; then
echo "Generating lcov report with Binary: $BINARY_PATH and Profile Data: $PROFDATA_PATH"
xcrun llvm-cov export \
-format="lcov" \
-instr-profile "$PROFDATA_PATH" \
"$BINARY_PATH" > info.lcov
if [ -s info.lcov ]; then
echo "Coverage report generated successfully: info.lcov"
else
echo "ERROR: info.lcov was generated but is empty."
exit 1
fi
else
echo "Could not generate coverage report - required binary or profdata file missing or invalid."
echo "Binary Path: $BINARY_PATH"
echo "Profdata Path: $PROFDATA_PATH"
exit 1
fi
- name: Filter Coverage Report
run: |
awk '
/^SF:/ {
file = $0
skip = file ~ /Build\/Build\/Intermediates\.noindex\// ||
file ~ /Sources\/UltralyticsYOLO\/(BoundingBoxView|VideoCapture|YOLOCamera|YOLOInfoViewController|YOLOModelDownloader|YOLOView)\.swift$/
}
!skip { print }
/^end_of_record/ { skip = 0 }
' info.lcov > info.filtered.lcov
mv info.filtered.lcov info.lcov
- name: Upload to Codecov
uses: codecov/codecov-action@v7
with:
files: ./info.lcov
slug: ultralytics/yolo-ios-app
use_oidc: true
disable_search: true
plugins: noop
fail_ci_if_error: true
periphery:
runs-on: macos-26
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- name: Install Periphery
run: brew install periphery
- name: Run Periphery
run: |
IOS_SIMULATOR=$(xcrun simctl list devices available | grep -E "iPhone.*" | head -1 | sed -E 's/.*\(([A-Z0-9-]+)\).*/\1/')
if [ -z "$IOS_SIMULATOR" ]; then
IOS_DEVICE_TYPE=$(xcrun simctl list devicetypes | grep -E "iPhone" | tail -1 | sed -E 's/.*\(([^)]+)\).*/\1/')
IOS_RUNTIME=$(xcrun simctl list runtimes available | grep -E "iOS" | tail -1 | sed -E 's/.*\(([^)]+)\).*/\1/')
IOS_SIMULATOR=$(xcrun simctl create "CI iPhone" "$IOS_DEVICE_TYPE" "$IOS_RUNTIME")
fi
DESTINATION="platform=iOS Simulator,id=$IOS_SIMULATOR,arch=arm64"
periphery scan \
--project YOLOiOSApp/YOLOiOSApp.xcodeproj \
--schemes YOLOiOSApp \
--exclude-tests \
--retain-public \
--report-include 'Sources/UltralyticsYOLO/**/*.swift' \
--format github-actions \
--strict \
-- \
-destination "$DESTINATION"