Skip to content

Commit

Permalink
Fix CI for Swift Package Manager (#33)
Browse files Browse the repository at this point in the history
* SPM

* Remove carthage support

* Delete MapboxCoreNavigation.podspec

* Fix ExampleSwift

* Add to changelog

* Examples & tests in xcodeproj

* Clean up

* Append

* Update XcodeProj/MapboxNavigationTests/MapboxNavigationTests.swift

* Update XcodeProj/RouteTest/Fixture.swift

Co-authored-by: Giordano Menegazzi <[email protected]>

* Remove Carthage from workflow

* Fix merge

* Test plan

* Revert let voiceController change

* Revert CustomViewController changes

* Remove redundant import

* Restore iOS 12 support

* add tests and make them pass

* restructure project

* update gitignore

* Add TestPlan

* reduce swift-tools version as github images is not up to date

* install latest swift version for github actions run

* run via xcrun

* use xcodebuild with toolchain flag

* fix flag

* configure newest Xcode app

* investigate xcode-select

* xcode-select switch to correct path

* print all /Applications

* explicitly request macos-14

* try again

* pipe through xcbeautify

* enable github actions renderer in xcbeautify

* update name of workflow

* use spaces for indentation

* fix last missing indentation change

---------

Co-authored-by: Maarten Zonneveld <[email protected]>
Co-authored-by: Giordano Menegazzi <[email protected]>
  • Loading branch information
3 people authored Apr 12, 2024
1 parent d1e2581 commit a768d89
Show file tree
Hide file tree
Showing 311 changed files with 644 additions and 8,806 deletions.
40 changes: 10 additions & 30 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,41 +8,21 @@ on:

jobs:
build:
name: Build and Test default scheme using any available iPhone simulator
runs-on: macos-latest
name: Build and Test using Xcode 15.3 on iPhone 15 Pro
runs-on: macos-14

steps:
- name: Configure Xcode 15.3
run: |
sudo xcode-select -s /Applications/Xcode_15.3.app
- name: Print Xcode Version
run: |
xcode-select --print-path
- name: Checkout
uses: actions/checkout@v3
- name: Set Default Scheme
run: |
scheme_list=$(xcodebuild -list -json | tr -d "\n")
default="All Tests"
echo $default | cat >default
echo Using default scheme: $default
- name: "Carthage Bootstrap"
uses: olejnjak/carthage-workaround@v1
with:
action: bootstrap --platform iOS --use-xcframeworks --cache-builds
- name: Build
env:
scheme: ${{ 'default' }}
platform: ${{ 'iOS Simulator' }}
run: |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
if [ $scheme = default ]; then scheme=$(cat default); fi
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild build-for-testing -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device"
set -o pipefail && xcodebuild build -scheme maplibre-navigation-ios -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' | xcbeautify --renderer github-actions
- name: Test
env:
scheme: ${{ 'default' }}
platform: ${{ 'iOS Simulator' }}
run: |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
if [ $scheme = default ]; then scheme=$(cat default); fi
if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
xcodebuild test-without-building -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -destination "platform=$platform,name=$device"
set -o pipefail && xcodebuild test -scheme maplibre-navigation-ios -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' | xcbeautify --renderer github-actions
153 changes: 141 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,150 @@
MapboxNavigation.xcworkspace
# Created by https://www.toptal.com/developers/gitignore/api/xcode,swiftpackagemanager,swiftpm,swift,macos,carthage
# Edit at https://www.toptal.com/developers/gitignore?templates=xcode,swiftpackagemanager,swiftpm,swift,macos,carthage

### Carthage ###
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

### macOS ###
# General
.DS_Store
.idea
.AppleDouble
.LSOverride

xcuserdata
# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Swift ###
# Xcode
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.xcuserstate
*.xcscmblueprint
IDEWorkspaceChecks.plist
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

Pods/
## Obj-C/Swift specific
*.hmap

Carthage/Build
Carthage/Checkouts
/documentation
/build
## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# CocoaPods
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
# Pods/
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# Accio dependency management
Dependencies/
.accio/

# fastlane
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

### SwiftPackageManager ###
Packages
xcuserdata
*.xcodeproj


### SwiftPM ###


### Xcode ###

## Xcode 8 and earlier

### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings

Examples/Swift/Navigation_Example.mobileprovision
# End of https://www.toptal.com/developers/gitignore/api/xcode,swiftpackagemanager,swiftpm,swift,macos,carthage
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0
5.9
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1400"
version = "1.3">
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand All @@ -14,10 +14,24 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5ADFBC81DDCC7840011824B"
BuildableName = "MapboxCoreNavigation.framework"
BlueprintName = "MapboxCoreNavigation"
ReferencedContainer = "container:MapboxNavigation.xcodeproj">
BlueprintIdentifier = "MapboxNavigation"
BuildableName = "MapboxNavigation"
BlueprintName = "MapboxNavigation"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "MapboxCoreNavigationTests"
BuildableName = "MapboxCoreNavigationTests"
BlueprintName = "MapboxCoreNavigationTests"
ReferencedContainer = "container:">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
Expand All @@ -26,31 +40,28 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5ADFBC81DDCC7840011824B"
BuildableName = "MapboxCoreNavigation.framework"
BlueprintName = "MapboxCoreNavigation"
ReferencedContainer = "container:MapboxNavigation.xcodeproj">
</BuildableReference>
</MacroExpansion>
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5ADFBD11DDCC7840011824B"
BuildableName = "MapboxCoreNavigationTests.xctest"
BlueprintIdentifier = "MapboxCoreNavigationTests"
BuildableName = "MapboxCoreNavigationTests"
BlueprintName = "MapboxCoreNavigationTests"
ReferencedContainer = "container:MapboxNavigation.xcodeproj">
ReferencedContainer = "container:">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "MapboxNavigationTests"
BuildableName = "MapboxNavigationTests"
BlueprintName = "MapboxNavigationTests"
ReferencedContainer = "container:">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "MapboxNavigationTests/testLowAlert()">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
</TestAction>
Expand All @@ -64,15 +75,6 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5ADFBC81DDCC7840011824B"
BuildableName = "MapboxCoreNavigation.framework"
BlueprintName = "MapboxCoreNavigation"
ReferencedContainer = "container:MapboxNavigation.xcodeproj">
</BuildableReference>
</MacroExpansion>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand All @@ -83,10 +85,10 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "C5ADFBC81DDCC7840011824B"
BuildableName = "MapboxCoreNavigation.framework"
BlueprintName = "MapboxCoreNavigation"
ReferencedContainer = "container:MapboxNavigation.xcodeproj">
BlueprintIdentifier = "MapboxNavigation"
BuildableName = "MapboxNavigation"
BlueprintName = "MapboxNavigation"
ReferencedContainer = "container:">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- Remove MapboxVoiceController and Mapbox Speech dependency. If you would like to use MapboxSpeech, you can copy the deleted MapboxVoiceController into your project.
- Updated MapLibre Native dependency to ios-v6.0.0 (https://github.com/maplibre/maplibre-native/releases/tag/ios-v6.0.0). Implementers need to change the prefix MGL to MLN for all MapLibre Native classes that are referenced.
- Only snap location to route if the location is within the `RouteControllerUserLocationSnappingDistance`
- Add support for Swift Package Manager while dropping Carthage and Cocoapods.

## v2.0.0 (May 23, 2023)
- Upgrade minimum iOS version from 11.0 to 12.0.
Expand Down
4 changes: 0 additions & 4 deletions Cartfile

This file was deleted.

3 changes: 0 additions & 3 deletions Cartfile.private

This file was deleted.

8 changes: 0 additions & 8 deletions Cartfile.resolved

This file was deleted.

8 changes: 0 additions & 8 deletions Examples/Objective-C/AppDelegate.h

This file was deleted.

Loading

0 comments on commit a768d89

Please sign in to comment.