Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce minimum OS versions & gitlab action testing CI #9

Merged
merged 21 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test maplibre-swiftui-dsl-playground

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: macos-13
strategy:
matrix:
scheme: [
MapLibreSwiftUI-Package
]
destination: [
# TODO: Add more destinations
'platform=iOS Simulator,name=iPhone 15,OS=17.0.1'
]

steps:
- name: Install xcbeautify
run: brew install xcbeautify

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0'

- name: Checkout maplibre-swiftui-dsl-playground
uses: actions/checkout@v3

- name: Test ${{ matrix.scheme }} on ${{ matrix.destination }}
run: xcodebuild -scheme ${{ matrix.scheme }} test -skipMacroValidation -destination '${{ matrix.destination }}' | xcbeautify && exit ${PIPESTATUS[0]}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,16 @@
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "MapLibreSwiftMacrosTests"
BuildableName = "MapLibreSwiftMacrosTests"
BlueprintName = "MapLibreSwiftMacrosTests"
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
40 changes: 29 additions & 11 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import CompilerPluginSupport
let package = Package(
name: "MapLibreSwiftUI",
platforms: [
.iOS(.v17), .macOS(.v13),
.iOS(.v15),
.macOS(.v11),
],
products: [
.library(
Expand All @@ -16,13 +17,14 @@ let package = Package(
.library(
name: "MapLibreSwiftDSL",
targets: ["MapLibreSwiftDSL"]),
.library(name: "MapLibre", targets: ["MapLibre"])
.library(
name: "MapLibre",
targets: ["MapLibre"])
],
dependencies: [
// .package(url: "https://github.com/maplibre/maplibre-gl-native-distribution", .upToNextMajor(from: "5.13.0")),
.package(url: "https://github.com/apple/swift-syntax.git", .upToNextMajor(from: "509.0.0")),
.package(url: "https://github.com/pointfreeco/swift-macro-testing", .upToNextMinor(from: "0.1.0")),

],
targets: [
.macro(
Expand All @@ -34,11 +36,15 @@ let package = Package(
),
.target(
name: "MapLibreSwiftMacros",
dependencies: [.target(name: "MapLibreSwiftMacrosImpl")]
dependencies: [
.target(name: "MapLibreSwiftMacrosImpl")
]
),
.binaryTarget(
name: "MapLibre",
url: "https://github.com/maplibre/maplibre-native/releases/download/ios-v6.0.0-preda45706601c7ccc6d922a8fcddfc62ff7c8f480d/MapLibre.dynamic.xcframework.zip",
checksum: "37e621c0c7c1f589f0a125816155ba443000d78b80649d85a9b8b3d19144836c"
),
.binaryTarget(name: "MapLibre",
url: "https://github.com/maplibre/maplibre-native/releases/download/ios-v6.0.0-preda45706601c7ccc6d922a8fcddfc62ff7c8f480d/MapLibre.dynamic.xcframework.zip",
checksum: "37e621c0c7c1f589f0a125816155ba443000d78b80649d85a9b8b3d19144836c"),
.target(
name: "MapLibreSwiftUI",
dependencies: [
Expand All @@ -52,15 +58,27 @@ let package = Package(
.target(name: "InternalUtils"),
.target(name: "MapLibre"),
.target(name: "MapLibreSwiftMacros"),
]),
.target(name: "InternalUtils"),
]
),
.target(
name: "InternalUtils"
),

// MARK: Tests

.testTarget(
name: "MapLibreSwiftDSLTests",
dependencies: [
"MapLibreSwiftDSL",
"MapLibreSwiftDSL"
]
),
.testTarget(
name: "MapLibreSwiftMacrosTests",
dependencies: [
"MapLibreSwiftMacrosImpl",
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
.product(name: "MacroTesting", package: "swift-macro-testing"),
]),
]
),
]
)
13 changes: 7 additions & 6 deletions Sources/MapLibreSwiftUI/Examples/Camera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ struct CameraDirectManipulationPreview: View {

var body: some View {
MapView(styleURL: styleURL, camera: $camera)
.overlay(alignment: .bottomLeading, content: {
.overlay(alignment: .bottom, content: {
switch camera {
case .centerAndZoom(let coord, let zoom):
Text("\(coord.latitude), \(coord.longitude) z\(zoom ?? 0)")
.padding(.all, 8)
.background(in: .rect(cornerRadii: .init(topLeading: 8,bottomLeading: 8,bottomTrailing: 8,topTrailing: 8)), fillStyle: .init())
.safeAreaPadding(.all)
Text("\(coord.latitude), \(coord.longitude) z \(zoom ?? 0)")
.padding()
.background(in: RoundedRectangle(cornerRadius: 8),
fillStyle: .init())
.padding(.bottom, 42)
}
})
.task {
try! await Task.sleep(for: .seconds(3))
try! await Task.sleep(nanoseconds: 3 * NSEC_PER_SEC)

camera = MapView.Camera.centerAndZoom(switzerland, 6)
}
Expand Down