Skip to content

Commit

Permalink
Transferring mapbox search ios repo
Browse files Browse the repository at this point in the history
  • Loading branch information
IamGreut committed Dec 1, 2021
1 parent 086ac4d commit 550c166
Show file tree
Hide file tree
Showing 1,316 changed files with 36,190 additions and 228 deletions.
371 changes: 371 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,371 @@
# For a detailed guide to building and testing on iOS, read the docs:
# https://circleci.com/docs/2.0/testing-ios/
version: 2.1

orbs:
slack: circleci/[email protected]

workflows:
version: 2
develop-build:
jobs:
- pre-check:
filters:
tags:
only: /v.*/
- build:
requires:
- pre-check
filters:
tags:
only: /v.*/
- spm-build:
requires:
- pre-check
- release-pre-check:
requires:
- pre-check
filters:
tags:
only: /v.*/
branches:
ignore: /.*/
# only: /release\/[0-9]+\.[0-9]+\.[0-9]+.*/
- build-for-release:
requires:
- release-pre-check
filters:
tags:
only: /v.*/
- release-documentation:
requires:
- release-pre-check
filters:
tags:
only: /v.*/
- documentation-pr:
requires:
- release-documentation
filters:
tags:
only: /v.*/
- release-ios:
requires:
- build-for-release
- documentation-pr
filters:
tags:
only: /v.*/
- request-post-SDK_Registry-release:
type: approval
requires:
- release-ios
filters:
tags:
only: /v.*/
- post-SDK_Registry-release:
requires:
- request-post-SDK_Registry-release
filters:
tags:
only: /v.*/
# - request-nightly-build:
# type: approval
# requires:
# - pre-check
# - nightly-build:
# requires:
# - request-nightly-build

nightly-build:
jobs:
- nightly-build
triggers:
- schedule:
cron: "0 0 * * 1-6"
filters:
branches:
only:
- develop

jobs:
pre-check:
macos:
xcode: 12.5.0
steps:
- checkout
- ios-install-carthage-dependencies
- run: python3 scripts/cmp_deps_across_managers.py

release-pre-check:
macos:
xcode: 12.5.0
steps:
- parse-release-version
- run:
name: Check existing public release
command: curl -L https://api.mapbox.com/downloads/v2/carthage/search-sdk/MapboxSearch.json | grep -v "$VERSION"

build:
macos:
xcode: 12.0.0 # Specify the Xcode version to use
environment:
FL_OUTPUT_DIR: ../output
steps:
- checkout
- setup-authentication
- ios-prestart-simulator
- upgrade-carthage
- install-swiftlint
- run:
name: Build dependencies
command: make dependencies
- run:
name: Test frameworks
command: make ci-dev-test
- run: make codecov
- run:
name: Prepare artifacts
command: cd output && zip -r Demo.xcresult.zip Demo.xcresult && rm -rf Demo.xcresult
when: always
- slack/notify:
event: fail
mentions: "@search-sdk-ios"
template: basic_fail_1

# Collect XML test results data to show in the UI, and save the same XML
# files under test-results folder in the Artifacts tab
- store_artifacts:
path: output
- store_test_results:
path: output
- store_artifacts:
path: ~/Library/Logs/DiagnosticReports
- store_artifacts:
path: ~/Library/Logs/scan

release-documentation:
macos:
xcode: 12.5.0
steps:
- checkout
- parse-release-version
- setup-authentication
- install-mbx-ci-darwin
- restore_cache:
keys:
- gem-cache-v1-{{ checksum "Gemfile.lock" }}
- run: |
bundle config set --local path 'vendor/bundle'
bundle install
- save_cache:
key: gem-cache-v1-{{ checksum "Gemfile.lock" }}
paths:
- vendor/bundle
- run: git remote set-url origin https://x-access-token:$(mbx-ci github writer token)@github.com/mapbox/mapbox-search-ios.git
- run: make release-docs

documentation-pr:
macos:
xcode: 12.5.0
steps:
- checkout
- parse-release-version
- setup-authentication
- install-mbx-ci-darwin
- run:
name: Update documentation
command: |
git clone https://x-access-token:$(mbx-ci github writer token)@github.com/mapbox/ios-sdk.git --branch publisher-production --depth=1
cd ios-sdk
BRANCH_NAME="search-sdk/ios/${VERSION}"
git checkout -b "${BRANCH_NAME}"
echo "$(jq ".VERSION_IOS_SEARCH_SDK = \"$VERSION\"" src/constants.json)" > src/constants.json
echo "$(jq ". + [\"${VERSION}\"]" src/data/ios-search-sdk-versions.json)" > src/data/ios-search-sdk-versions.json
git config user.email "[email protected]"
git config user.name "Release SDK bot"
git add src/constants.json src/data/ios-search-sdk-versions.json
git commit -m "Add Search SDK for iOS ${VERSION} release"
git push --set-upstream origin "${BRANCH_NAME}" --force-with-lease
build-for-release:
macos:
xcode: 12.5.0
steps:
- checkout
- setup-authentication
- upgrade-carthage
- parse-release-version
- run: make ios
- persist_to_workspace:
root: Products
paths:
- MapboxSearch.zip
- MapboxSearchUI.zip
- slack/notify:
event: fail
mentions: "@search-sdk-ios"
template: basic_fail_1

release-ios:
macos:
xcode: 12.5.0
steps:
- checkout
- setup-authentication
- parse-release-version
- run: brew install awscli gh
- attach_workspace:
at: Products
- run: ls -lGh Products/
- install-mbx-ci-darwin
- run: mbx-ci aws setup
- run: make update-registry
- run: make list-registry-latest
- run:
name: Create PR to SDK Registry
command: |
pip3 install pyyaml
scripts/create_registry_pr.sh
- run:
name: Create PR to iOS Documentation repo
command: scripts/create_documentation_pr.sh

post-SDK_Registry-release:
macos:
xcode: 12.5.0
steps:
- checkout
- parse-release-version
- setup-authentication
- install-mbx-ci-darwin
- run: scripts/generate_podspecs.sh
- run:
name: Push podspecs to CocoaPods CDN Trunk
command: |
pod trunk push MapboxSearch.podspec
md5 -s MapboxSearch
pod search MapboxSearchUI --no-pager
cat ~/.cocoapods/repos/trunk/all_pods_versions_6_6_f.txt
sed -i '' -E "s/(MapboxSearch.*)/\1\/${VERSION}/g" ~/.cocoapods/repos/trunk/all_pods_versions_6_6_f.txt
pod trunk push MapboxSearchUI.podspec
- run: brew install gh taiki-e/tap/parse-changelog
- run: scripts/release_binary_manifest.sh

spm-build:
macos:
xcode: 12.5.0
steps:
- checkout
- setup-authentication
- run: brew install xcodegen
- run: make validate-spm-build

nightly-build:
macos:
xcode: 12.5.0
environment:
FL_OUTPUT_DIR: ../output
steps:
- checkout
- setup-authentication
- ios-prestart-simulator
- upgrade-carthage
- install-swiftlint
- run:
name: Install third-party dependencies
command: bundle install
- run:
name: Build dependencies
command: make dependencies
# - run:
# name: Trigger Metrics job
# command: scripts/trigger_metrics.sh
# - run:
# name: Check Carthage integration
# command: echo 'github "mapbox/mapbox-search-ios" "develop"' > Cartfile; carthage update --use-netrc --use-xcframeworks
- run:
name: Build and upload Demo application
command: bundle exec fastlane beta
- slack/notify:
event: fail
mentions: "@search-sdk-ios"
template: basic_fail_1

commands:
setup-authentication:
description: >
Xcode scm provider has more limitations than the system one, e.g.
CircleCI inputs only private key, however Xcode requires both private and public keys in ~/.ssh folder
mbx-ci tool injects key "id_rsa_3bcd47bf579ce536b04d5f125ed3b33e" with potential name be changed
This oneliner generates public key for an existing private
steps:
- run:
name: Generate SSH Public Key from private
command: for key in $(find ~/.ssh/ -type f -name "id_rsa*" ! -name "*.pub"); do ssh-keygen -y -f $key > $key.pub; done
- add_ssh_keys:
fingerprints:
- 3b:cd:47:bf:57:9c:e5:36:b0:4d:5f:12:5e:d3:b3:3e
- run:
name: Allow SPM SSH communication with github.com
command: |
for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts || true
- run:
name: Allow cloning from github.com via HTTPS
command: git config --global --unset url."ssh://[email protected]".insteadOf
- run:
name: Prepare .netrc file
command: |
echo "machine api.mapbox.com" >> ~/.netrc
echo "login mapbox" >> ~/.netrc
echo "password $SDK_REGISTRY_TOKEN" >> ~/.netrc
- run:
name: Inject Mapbox token
command: echo $SDK_REGISTRY_TOKEN > ~/.mapbox

ios-install-carthage-dependencies:
steps:
- setup-authentication
- run: make deps

ios-prestart-simulator:
steps:
- run:
name: pre-start simulator
command: xcrun instruments -w "iPhone 11 Pro (14.0) [" || true

upgrade-carthage:
steps:
- run:
name: Force update Homebrew
command: cd "$(brew --repository)" && git fetch && git reset --hard origin/master
- run: brew update-reset
- run: brew upgrade carthage

parse-release-version:
description: >
Parse release version based on $CIRCLE_TAG variable (supports v-prefix form)
and release-branch in 'release/1.0.0-beta.1' form (as well as 'release/v1.0.0-beta.1')
steps:
- run:
name: Parse SDK version from release branch
command: |
echo "export VERSION=$(echo ${CIRCLE_TAG:-$CIRCLE_BRANCH} | grep -o '\d.*')" >> "$BASH_ENV"
cat $BASH_ENV
install-mbx-ci-darwin:
steps:
- run:
name: Install mbx-ci
command: |
curl -Ls https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-darwin-amd64 > /usr/local/bin/mbx-ci
chmod 755 /usr/local/bin/mbx-ci
install-swiftlint:
steps:
- run:
name: Install SwiftLint 0.44.0
command: |
curl -LO https://github.com/realm/SwiftLint/releases/download/0.44.0/SwiftLint.pkg
sudo installer -pkg SwiftLint.pkg -target /
rm SwiftLint.pkg
8 changes: 8 additions & 0 deletions .fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
app_identifier("com.mapbox.MapboxSearchDemoApplication") # The bundle identifier of your app
apple_id("[email protected]") # Your Apple email address

itc_team_id("34158803") # App Store Connect Team ID
team_id("GJZR2MEM28") # Developer Portal Team ID

# For more information about the Appfile, see:
# https://docs.fastlane.tools/advanced/#appfile
Loading

0 comments on commit 550c166

Please sign in to comment.