Skip to content

Commit 9fbc0a5

Browse files
committed
Updated github workflow
Added build script since this uses UIKit, and SPM doesn't build UIKit
1 parent caa0542 commit 9fbc0a5

File tree

4 files changed

+53
-43
lines changed

4 files changed

+53
-43
lines changed

.github/workflows/build-test.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/build.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ jobs:
1313

1414
steps:
1515
- name: Checkout Repository
16-
uses: actions/checkout@v3
17-
- name: Install
18-
run: pod install
16+
uses: actions/checkout@v4
1917
- name: Build
20-
run: xcodebuild build-for-testing -workspace grid-ios.xcworkspace -scheme grid-ios -destination 'platform=iOS Simulator,OS=latest,name=iPhone 16'
18+
run: |
19+
iphone_names=$(xcrun simctl list devices available --json | jq -r '.devices | to_entries[] | .value[] | select(.name | test("^iPhone [0-9]+")) | .name')
20+
latest_iphone=$(echo "$iphone_names" | sort | tail -n 1)
21+
echo "latest_iphone: $latest_iphone"
22+
xcodebuild build -scheme Grid -destination "platform=iOS Simulator,OS=latest,name=$latest_iphone"
23+
24+
- name: Test
25+
run: |
26+
iphone_names=$(xcrun simctl list devices available --json | jq -r '.devices | to_entries[] | .value[] | select(.name | test("^iPhone [0-9]+")) | .name')
27+
latest_iphone=$(echo "$iphone_names" | sort | tail -n 1)
28+
echo "latest_iphone: $latest_iphone"
29+
xcodebuild test -scheme Grid -destination "platform=iOS Simulator,OS=latest,name=$latest_iphone"
30+

README.md

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -35,36 +35,41 @@ import Grid
3535

3636
### Build ###
3737

38-
[![Build & Test](https://github.com/ngageoint/grid-ios/workflows/Build%20&%20Test/badge.svg)](https://github.com/ngageoint/grid-ios/actions/workflows/build-test.yml)
38+
[![Build](https://github.com/ngageoint/grid-ios/workflows/Build/badge.svg)](https://github.com/ngageoint/grid-ios/actions/workflows/build.yml)
3939

40-
Build this repository using Xcode and/or CocoaPods:
40+
Build and Test (Uses UIKit, so we build with xcodebuild instead of SPM).
4141

42-
pod install
43-
44-
Open grid-ios.xcworkspace in Xcode or build from command line:
45-
46-
xcodebuild -workspace 'grid-ios.xcworkspace' -scheme grid-ios build
47-
48-
Run tests from Xcode or from command line:
49-
50-
xcodebuild test -workspace 'grid-ios.xcworkspace' -scheme grid-ios -destination 'platform=iOS Simulator,name=iPhone 16'
42+
./build.sh
43+
44+
You can build and test if you open the Package.swift in Xcode.
5145

5246
### Include Library ###
5347

5448
Include this repository by specifying it in a Podfile using a supported option.
5549

56-
Pull from [CocoaPods](https://cocoapods.org/pods/grid-ios):
5750

58-
pod 'grid-ios', '~> 2.0.0'
51+
### Include Library ###
52+
53+
Use this library via SPM in your Package.swift:
5954

60-
Pull from GitHub:
55+
dependencies: [
56+
.package(url: "https://github.com/ngageoint/grid-ios.git", branch: "release/2.0.0"),
57+
]
58+
59+
Or as a tagged release:
6160

62-
pod 'grid-ios', :git => 'https://github.com/ngageoint/grid-ios.git', :branch => 'master'
63-
pod 'grid-ios', :git => 'https://github.com/ngageoint/grid-ios.git', :tag => '2.0.0'
61+
dependencies: [
62+
.package(url: "https://github.com/ngageoint/grid-ios.git", from: "2.0.0"),
63+
]
6464

65-
Include as local project:
65+
Reference it in your Package.swift target:
6666

67-
pod 'grid-ios', :path => '../grid-ios'
67+
.target(
68+
name: "MyApp",
69+
dependencies: [
70+
.product(name: "Grid", package: "grid-ios"),
71+
],
72+
),
6873

6974
### Remote Dependencies ###
7075

build.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Find iPhone Simulator
6+
iphone_names=$(xcrun simctl list devices available --json | jq -r '.devices | to_entries[] | .value[] | select(.name | test("^iPhone [0-9]+")) | .name')
7+
if [ -z "$iphone_names" ]; then echo "Error: No iPhone simulators found."; exit 1; fi
8+
9+
latest_iphone=$(echo "$iphone_names" | sort | tail -n 1)
10+
echo "latest_iphone: $latest_iphone"
11+
12+
# Build
13+
xcodebuild build -scheme Grid -destination "platform=iOS Simulator,OS=latest,name=$latest_iphone"
14+
15+
# Test
16+
xcodebuild test -scheme Grid -destination "platform=iOS Simulator,OS=latest,name=$latest_iphone"

0 commit comments

Comments
 (0)