Skip to content

Commit

Permalink
Adds ci (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
Miiha authored Sep 6, 2023
1 parent 779c7ef commit 89970e7
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 35 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- '*'
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
macos:
name: macOS 13 (Xcode 14.3.1)
runs-on: macos-13
strategy:
matrix:
config: ['debug', 'release']
steps:
- uses: actions/checkout@v3
- name: Select Xcode 14.3.1
run: sudo xcode-select -s /Applications/Xcode_14.3.1.app
- name: Run tests
run: make test-swift
- name: Build platforms ${{ matrix.config }}
run: CONFIG=${{ matrix.config }} make build-all-platforms
- name: Build for library evolution
run: make build-for-library-evolution
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,98 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"revision" : "882ac01eb7ef9e36d4467eb4b1151e74fcef85ab",
"version" : "0.9.1"
"revision" : "ec62f32d21584214a4b27c8cee2b2ad70ab2c38a",
"version" : "0.11.0"
}
},
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths",
"state" : {
"revision" : "bb436421f57269fbcfe7360735985321585a86e5",
"version" : "0.10.1"
"revision" : "fc45e7b2cfece9dd80b5a45e6469ffe67fe67984",
"version" : "0.14.1"
}
},
{
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "692ec4f5429a667bdd968c7260dfa2b23adfeffc",
"version" : "0.1.4"
"revision" : "0fbaebfc013715dab44d715a4d350ba37f297e4d",
"version" : "0.4.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "f504716c27d2e5d4144fa4794b12129301d17729",
"version" : "1.0.3"
"revision" : "937e904258d22af6e447a0b72c0bc67583ef64a2",
"version" : "1.0.4"
}
},
{
"identity" : "swift-composable-architecture",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-composable-architecture",
"state" : {
"revision" : "6cf778a7da64de9508596a435aa0a5647885d71a",
"version" : "0.49.2"
"revision" : "9f4202ab5b8422aa90f0ed983bf7652c3af7abf0",
"version" : "0.59.0"
}
},
{
"identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "479750bd98fac2e813fffcf2af0728b5b0085795",
"version" : "0.1.1"
}
},
{
"identity" : "swift-custom-dump",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-custom-dump",
"state" : {
"revision" : "819d9d370cd721c9d87671e29d947279292e4541",
"version" : "0.6.0"
"revision" : "4a87bb75be70c983a9548597e8783236feb3401e",
"version" : "0.11.1"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "8282b0c59662eb38946afe30eb403663fc2ecf76",
"version" : "0.1.4"
"revision" : "16fd42ae04c6e7f74a6a86395d04722c641cccee",
"version" : "0.6.0"
}
},
{
"identity" : "swift-identified-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-identified-collections",
"state" : {
"revision" : "bfb0d43e75a15b6dfac770bf33479e8393884a36",
"version" : "0.4.1"
"revision" : "d01446a78fb768adc9a78cbb6df07767c8ccfc29",
"version" : "0.8.0"
}
},
{
"identity" : "swiftui-navigation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swiftui-navigation",
"state" : {
"revision" : "46acf5ecc1cabdb28d7fe03289f6c8b13a023f52",
"version" : "0.4.5"
"revision" : "2aa885e719087ee19df251c08a5980ad3e787f12",
"version" : "0.8.0"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "16b23a295fa322eb957af98037f86791449de60f",
"version" : "0.8.1"
"revision" : "50843cbb8551db836adec2290bb4bc6bac5c1865",
"version" : "0.9.0"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions Examples/Example/Example.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -487,7 +487,7 @@
repositoryURL = "https://github.com/pointfreeco/swift-composable-architecture";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.49.0;
minimumVersion = 0.59.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
68 changes: 68 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
CONFIG = debug
PLATFORM_IOS = iOS Simulator,id=$(call udid_for,iPhone,iOS-16)
PLATFORM_MACOS = macOS
PLATFORM_MAC_CATALYST = macOS,variant=Mac Catalyst
PLATFORM_TVOS = tvOS Simulator,id=$(call udid_for,TV,tvOS-16)
PLATFORM_WATCHOS = watchOS Simulator,id=$(call udid_for,Watch,watchOS-9)

default: test

build-all-platforms:
for platform in \
"$(PLATFORM_IOS)" \
"$(PLATFORM_MACOS)" \
"$(PLATFORM_MAC_CATALYST)" \
"$(PLATFORM_TVOS)" \
"$(PLATFORM_WATCHOS)"; \
do \
xcrun xcodebuild build \
-workspace ComposableUserNotifications.xcworkspace \
-scheme ComposableUserNotifications \
-configuration $(CONFIG) \
-destination platform="$$platform" || exit 1; \
done;

test-swift:
swift test
swift test -c release

build-for-static-stdlib:
@swift build -c debug --static-swift-stdlib
@swift build -c release --static-swift-stdlib

test-integration:
xcrun xcodebuild test \
-scheme "Integration" \
-destination platform="$(PLATFORM_IOS)" || exit 1; \

build-for-library-evolution:
swift build \
-c release \
--target ComposableUserNotifications \
-Xswiftc -emit-module-interface \
-Xswiftc -enable-library-evolution

build-for-static-stdlib-docker:
@docker run \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.8-focal \
bash -c "swift build -c debug --static-swift-stdlib"
@docker run \
-v "$(PWD):$(PWD)" \
-w "$(PWD)" \
swift:5.8-focal \
bash -c "swift build -c release --static-swift-stdlib"

format:
swift format \
--ignore-unparsable-files \
--in-place \
--recursive \
./Package.swift ./Sources ./Tests

.PHONY: test test-swift build-for-library-evolution format

define udid_for
$(shell xcrun simctl list --json devices available $(1) | jq -r '.devices | to_entries | map(select(.value | add)) | sort_by(.key) | .[] | select(.key | contains("$(2)")) | .value | last.udid')
endef
25 changes: 17 additions & 8 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,44 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/combine-schedulers",
"state" : {
"revision" : "ff42ec9061d864de7982162011321d3df5080c10",
"version" : "0.1.2"
"revision" : "ec62f32d21584214a4b27c8cee2b2ad70ab2c38a",
"version" : "0.11.0"
}
},
{
"identity" : "swift-clocks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-clocks",
"state" : {
"revision" : "20b25ca0dd88ebfb9111ec937814ddc5a8880172",
"version" : "0.2.0"
"revision" : "0fbaebfc013715dab44d715a4d350ba37f297e4d",
"version" : "0.4.0"
}
},
{
"identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-concurrency-extras",
"state" : {
"revision" : "479750bd98fac2e813fffcf2af0728b5b0085795",
"version" : "0.1.1"
}
},
{
"identity" : "swift-dependencies",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-dependencies",
"state" : {
"revision" : "8282b0c59662eb38946afe30eb403663fc2ecf76",
"version" : "0.1.4"
"revision" : "16fd42ae04c6e7f74a6a86395d04722c641cccee",
"version" : "0.6.0"
}
},
{
"identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
"state" : {
"revision" : "16b23a295fa322eb957af98037f86791449de60f",
"version" : "0.8.1"
"revision" : "50843cbb8551db836adec2290bb4bc6bac5c1865",
"version" : "0.9.0"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "0.1.2"),
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "0.6.0"),
],
targets: [
.target(
Expand Down
1 change: 0 additions & 1 deletion Sources/ComposableUserNotifications/Interface.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import CoreLocation
import UserNotifications
import XCTestDynamicOverlay

Expand Down
8 changes: 5 additions & 3 deletions Sources/ComposableUserNotifications/Model.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ extension Notification {
return .calendar(Trigger.Calendar(rawValue: trigger))
case let trigger as UNTimeIntervalNotificationTrigger:
return .timeInterval(Trigger.TimeInterval(rawValue: trigger))
#if os(iOS) || os(watchOS)
#if (os(iOS) || os(watchOS)) && !targetEnvironment(macCatalyst)
case let trigger as UNLocationNotificationTrigger:
return .location(Trigger.Location(rawValue: trigger))
#endif
Expand Down Expand Up @@ -83,6 +83,7 @@ extension Notification {
case timeInterval(TimeInterval)
case calendar(Calendar)

@available(macCatalyst, unavailable)
@available(macOS, unavailable)
@available(tvOS, unavailable)
case location(Location)
Expand All @@ -95,7 +96,7 @@ extension Notification {
return lhs == rhs
case let (.calendar(lhs), .calendar(rhs)):
return lhs == rhs
#if os(iOS) || os(watchOS) || targetEnvironment(macCatalyst)
#if os(iOS) || os(watchOS)
case let (.location(lhs), .location(rhs)):
return lhs == rhs
#endif
Expand All @@ -115,7 +116,7 @@ extension Notification.Trigger {
return value.repeats
case let .calendar(value):
return value.repeats
#if os(iOS) || os(watchOS) || targetEnvironment(macCatalyst)
#if os(iOS) || os(watchOS)
case let .location(value):
return value.repeats
#endif
Expand Down Expand Up @@ -205,6 +206,7 @@ extension Notification.Trigger {
}

@available(macOS, unavailable)
@available(macCatalyst, unavailable)
@available(tvOS, unavailable)
public struct Location: Equatable {
public let rawValue: UNLocationNotificationTrigger?
Expand Down

0 comments on commit 89970e7

Please sign in to comment.