Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: Swift
name: iOS CI

on:
push:
Expand All @@ -15,8 +15,6 @@ jobs:
runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: Build
run: swift build -v
- name: Run tests
run: swift test -v
- uses: actions/checkout@v4
- name: Build and test on iOS Simulator
run: bash ci/test-ios.sh
8 changes: 6 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import PackageDescription

let package = Package(
name: "StableCollectionViewLayout",
platforms: [
.iOS(.v9),
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
Expand All @@ -22,12 +25,13 @@ let package = Package(
.target(
name: "StableCollectionViewLayout",
dependencies: [],
path: "StableCollectionViewLayout"
path: "StableCollectionViewLayout/Sources"
),
.testTarget(
name: "StableCollectionViewLayoutTests",
dependencies: ["StableCollectionViewLayout"],
path: "StableCollectionViewLayoutTests"
path: "StableCollectionViewLayoutTests",
exclude: ["Info.plist"]
),
]
)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ Also, you can create the own subclass of `StableCollectionViewLayout` and use it
The preferred installation method is with [CocoaPods](https://cocoapods.org). Add the following to your `Podfile`:

```ruby
pod 'StableCollectionViewLayout', '~> 1.0.2'
pod 'StableCollectionViewLayout', '~> 1.0.3'
```

### Carthage

For [Carthage](https://github.com/Carthage/Carthage), add the following to your `Cartfile`:

```ogdl
github "aimalygin/StableCollectionViewLayout" ~> 1.0.2
github "aimalygin/StableCollectionViewLayout" ~> 1.0.3
```

### Swift Package Manager
Expand All @@ -70,4 +70,4 @@ To integrate using Xcode:
File -> Swift Packages -> Add Package Dependency

Enter package URL: https://github.com/aimalygin/StableCollectionViewLayout, and select the latest release.
```
```
58 changes: 58 additions & 0 deletions ci/test-ios.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash
set -euo pipefail

PROJECT="${PROJECT:-StableCollectionViewLayout.xcodeproj}"
SCHEME="${SCHEME:-StableCollectionViewLayoutTests}"
DERIVED_DATA_PATH="${DERIVED_DATA_PATH:-${PWD}/DerivedData}"
DESTINATION_NAME="${DESTINATION_NAME:-}"

if [[ -n "${DESTINATION_NAME}" ]]; then
DESTINATION="platform=iOS Simulator,name=${DESTINATION_NAME},OS=latest"
else
DESTINATION_ID="$(
xcrun simctl list devices available -j | /usr/bin/python3 -c '
import json
import sys

preferred_names = (
"iPhone 17",
"iPhone 16",
"iPhone 15",
"iPhone 14",
"iPhone 13",
"iPhone 12",
"iPhone 11",
)
data = json.load(sys.stdin)
devices = []

for runtime, runtime_devices in data.get("devices", {}).items():
if not runtime.startswith("com.apple.CoreSimulator.SimRuntime.iOS-"):
continue

for device in runtime_devices:
if device.get("isAvailable"):
devices.append(device)

for preferred_name in preferred_names:
for device in devices:
if device.get("name") == preferred_name:
print(device["udid"])
sys.exit(0)

if devices:
print(devices[0]["udid"])
sys.exit(0)

sys.exit("No available iOS simulator found")
'
)"
DESTINATION="id=${DESTINATION_ID}"
fi

xcodebuild test \
-project "${PROJECT}" \
-scheme "${SCHEME}" \
-destination "${DESTINATION}" \
-derivedDataPath "${DERIVED_DATA_PATH}" \
CODE_SIGNING_ALLOWED=NO
Loading