|
21 | 21 |
|
22 | 22 | schedule: |
23 | 23 | - cron: '40 11 * * *' # once a day @ 11:40am UTC (4:40am PST) |
24 | | - |
25 | | -jobs: |
| 24 | + |
| 25 | +env: |
| 26 | + SCHEME: "TextFileKit-CI" |
| 27 | + |
| 28 | +jobs: |
26 | 29 | macOS: |
27 | 30 | name: macOS |
28 | | - runs-on: macos-latest |
| 31 | + runs-on: macos-15 |
29 | 32 | steps: |
30 | 33 | - uses: actions/checkout@main |
| 34 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 35 | + with: |
| 36 | + xcode-version: latest-stable |
31 | 37 | - name: Build |
32 | | - run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=macOS,name=Any Mac" | xcpretty && exit ${PIPESTATUS[0]} |
| 38 | + run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS,name=Any Mac" | xcpretty && exit ${PIPESTATUS[0]} |
33 | 39 | - name: Unit Tests |
34 | | - run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=macOS" | xcpretty && exit ${PIPESTATUS[0]} |
| 40 | + run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS" | xcpretty && exit ${PIPESTATUS[0]} |
35 | 41 |
|
36 | 42 | macCatalyst: |
37 | 43 | name: macCatalyst |
38 | | - runs-on: macos-latest |
| 44 | + runs-on: macos-15 |
39 | 45 | steps: |
40 | 46 | - uses: actions/checkout@main |
| 47 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 48 | + with: |
| 49 | + xcode-version: latest-stable |
41 | 50 | - name: Build |
42 | | - run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=macOS,variant=Mac Catalyst,name=Any Mac" | xcpretty && exit ${PIPESTATUS[0]} |
| 51 | + run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=macOS,variant=Mac Catalyst,name=Any Mac" | xcpretty && exit ${PIPESTATUS[0]} |
43 | 52 | - name: Unit Tests |
44 | | - run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=macOS,variant=Mac Catalyst" | xcpretty && exit ${PIPESTATUS[0]} |
45 | | - |
| 53 | + run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=macOS,variant=Mac Catalyst" | xcpretty && exit ${PIPESTATUS[0]} |
| 54 | + |
46 | 55 | iOS: |
47 | 56 | name: iOS |
48 | | - runs-on: macos-latest # this must be macos, GitHub does not offer iOS directly but we can use xcodebuild |
| 57 | + runs-on: macos-15 |
49 | 58 | steps: |
50 | 59 | - uses: actions/checkout@main |
| 60 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 61 | + with: |
| 62 | + xcode-version: latest-stable |
51 | 63 | - name: Build |
52 | | - run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=iOS Simulator,name=Any iOS Device" | xcpretty && exit ${PIPESTATUS[0]} |
| 64 | + run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=iOS Simulator,name=Any iOS Device" | xcpretty && exit ${PIPESTATUS[0]} |
| 65 | + - name: Prepare Destination Device Name |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + DESTNAME=$(xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" | perl -nle 'if (m/iOS\sSimulator.*(iPhone.*)\s\}\.*/g) { print $1; }' | head -n 1) |
| 69 | + echo Using device \"$DESTNAME\" |
| 70 | + echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV" |
53 | 71 | - name: Unit Tests |
54 | | - run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=iOS Simulator,name=iPhone 15" | xcpretty && exit ${PIPESTATUS[0]} |
55 | | - |
| 72 | + run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=iOS Simulator,name=$DESTNAME" | xcpretty && exit ${PIPESTATUS[0]} |
| 73 | + |
56 | 74 | tvOS: |
57 | 75 | name: tvOS |
58 | | - runs-on: macos-latest # this must be macos, GitHub does not offer tvOS directly but we can use xcodebuild |
| 76 | + runs-on: macos-15 |
59 | 77 | steps: |
60 | 78 | - uses: actions/checkout@main |
| 79 | + - uses: maxim-lobanov/setup-xcode@v1 |
| 80 | + with: |
| 81 | + xcode-version: latest-stable |
61 | 82 | - name: Build |
62 | | - run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=tvOS Simulator,name=Any tvOS Simulator Device" | xcpretty && exit ${PIPESTATUS[0]} |
| 83 | + run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=tvOS Simulator,name=Any tvOS Simulator Device" | xcpretty && exit ${PIPESTATUS[0]} |
| 84 | + - name: Prepare Destination Device Name |
| 85 | + shell: bash |
| 86 | + run: | |
| 87 | + DESTNAME=$(xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" | perl -nle 'if (m/tvOS\sSimulator.*(Apple\sTV.*)\s\}\.*/g) { print $1; }' | head -n 1) |
| 88 | + echo Using device \"$DESTNAME\" |
| 89 | + echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV" |
63 | 90 | - name: Unit Tests |
64 | | - run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=tvOS Simulator,name=Apple TV 4K (3rd generation)" | xcpretty && exit ${PIPESTATUS[0]} |
65 | | - |
| 91 | + run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=tvOS Simulator,name=$DESTNAME" | xcpretty && exit ${PIPESTATUS[0]} |
| 92 | + |
66 | 93 | watchOS: |
67 | 94 | name: watchOS |
68 | | - runs-on: macos-latest # this must be macos, GitHub does not offer watchOS directly but we can use xcodebuild |
| 95 | + runs-on: macos-15 |
69 | 96 | steps: |
70 | 97 | - uses: actions/checkout@main |
71 | 98 | - uses: maxim-lobanov/setup-xcode@v1 |
72 | 99 | with: |
73 | | - xcode-version: latest-stable # Sometimes a newer version of Xcode is available but isn't yet made default |
| 100 | + xcode-version: latest-stable |
74 | 101 | - name: Build |
75 | | - run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "generic/platform=watchOS Simulator,name=Any watchOS Simulator Device" | xcpretty && exit ${PIPESTATUS[0]} |
| 102 | + run: xcodebuild build -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "generic/platform=watchOS Simulator,name=Any watchOS Simulator Device" | xcpretty && exit ${PIPESTATUS[0]} |
| 103 | + - name: Prepare Destination Device Name |
| 104 | + shell: bash |
| 105 | + run: | |
| 106 | + DESTNAME=$(xcodebuild -showdestinations -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" | perl -nle 'if (m/watchOS\sSimulator.*(Apple\sWatch.*)\s\}\.*/g) { print $1; }' | head -n 1) |
| 107 | + echo Using device \"$DESTNAME\" |
| 108 | + echo "DESTNAME=$DESTNAME" >> "$GITHUB_ENV" |
76 | 109 | - name: Unit Tests |
77 | | - run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "TextFileKit-CI" -destination "platform=watchOS Simulator,name=Apple Watch Series 10 (46mm)" | xcpretty && exit ${PIPESTATUS[0]} |
78 | | - |
79 | | -# xcodebuild test reference: |
80 | | -# https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/testing_with_xcode/chapters/08-automation.html |
| 110 | + run: xcodebuild test -workspace ".swiftpm/xcode/package.xcworkspace" -scheme "$SCHEME" -destination "platform=watchOS Simulator,name=$DESTNAME" | xcpretty && exit ${PIPESTATUS[0]} |
0 commit comments