|
1 |
| -# This workflow will build a Swift project |
| 1 | +# This workflow will build and test a Swift project |
2 | 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
|
3 | 3 |
|
4 |
| -name: Swift |
| 4 | +name: Swift Build and Test |
5 | 5 |
|
6 | 6 | on:
|
7 | 7 | push:
|
|
11 | 11 | workflow_dispatch:
|
12 | 12 |
|
13 | 13 | jobs:
|
14 |
| - build: |
15 |
| - |
16 |
| - runs-on: macos-latest |
| 14 | + build-and-test: |
| 15 | + name: Build and Test Swift Package |
| 16 | + runs-on: macos-15 |
17 | 17 |
|
18 | 18 | steps:
|
19 |
| - - uses: actions/checkout@v4 |
20 |
| - - name: Build |
21 |
| - run: swift build -v |
22 |
| - - name: Run tests |
23 |
| - run: swift test -v |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Setup Xcode |
| 23 | + uses: maxim-lobanov/setup-xcode@v1.6.0 |
| 24 | + with: |
| 25 | + xcode-version: '16.0' # Required for iOS 18.0+ and macOS 15.0+ |
| 26 | + |
| 27 | + - name: Setup Swift environment |
| 28 | + uses: swift-actions/setup-swift@v2.3.0 |
| 29 | + with: |
| 30 | + swift-version: '6.0' # Use Swift 6.0 for better iOS 18 support |
| 31 | + |
| 32 | + - name: Verify build environment |
| 33 | + run: | |
| 34 | + echo "Xcode version:" |
| 35 | + xcodebuild -version |
| 36 | + echo "Swift version:" |
| 37 | + swift --version |
| 38 | + echo "Available SDKs:" |
| 39 | + xcodebuild -showsdks |
| 40 | + echo "Core ML availability test:" |
| 41 | + swift -e 'import CoreML; print("Core ML framework is available")' || { |
| 42 | + echo "Warning: Basic Core ML framework not found" |
| 43 | + } |
| 44 | + |
| 45 | + - name: Cache Swift Package Manager dependencies |
| 46 | + uses: actions/cache@v4 |
| 47 | + with: |
| 48 | + path: | |
| 49 | + ~/.cache/org.swift.swiftpm |
| 50 | + .build |
| 51 | + key: ${{ runner.os }}-swift-${{ hashFiles('**/Package.swift') }} |
| 52 | + restore-keys: | |
| 53 | + ${{ runner.os }}-swift- |
| 54 | + |
| 55 | + - name: Resolve Swift Package Manager dependencies |
| 56 | + run: swift package resolve |
| 57 | + |
| 58 | + - name: Build Swift package |
| 59 | + run: |
| 60 | + swift build |
| 61 | + |
| 62 | + - name: Run Swift package tests |
| 63 | + run: | |
| 64 | + swift test |
| 65 | + |
| 66 | + - name: Validate package structure |
| 67 | + run: swift package describe |
0 commit comments