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

API changes tracking #2673

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 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
143 changes: 143 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,67 @@
version: 2.1

commands:
save-api-diff-cache:
parameters:
api_diff_cache:
type: string
steps:
- save_cache:
key: nav-api-diff-cache-v5-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ << parameters.api_diff_cache >> }}
paths:
- api_logs

save-api-diff-cache-by-tag:
parameters:
api_diff_cache:
type: string
steps:
- save_cache:
key: nav-api-diff-cache-v5-{{ .Environment.CIRCLE_WORKFLOW_ID }}-<< parameters.api_diff_cache >>
paths:
- api_logs

restore-api-diff-cache:
parameters:
api_diff_cache:
type: string
steps:
- restore_cache:
keys:
- nav-api-diff-cache-v5-{{ .Environment.CIRCLE_WORKFLOW_ID }}-{{ << parameters.api_diff_cache >> }}

restore-api-diff-cache-by-tag:
parameters:
api_diff_cache:
type: string
steps:
- restore_cache:
keys:
- nav-api-diff-cache-v5-{{ .Environment.CIRCLE_WORKFLOW_ID }}-<< parameters.api_diff_cache >>

build-api-diff-report:
steps:
- run:
name: Install Sourcekitten
command: brew update && brew install sourcekitten
- run:
name: Building API Diff Report
command: cd scripts/APIDiffReport && swift build

run_api_log:
parameters:
iOS:
type: string
device:
type: string
steps:
- run:
name: Generating MapboxCoreNavigation API Log
command: cd scripts/APIDiffReport && swift run APIDiffReport log ../.. $CIRCLE_WORKING_DIRECTORY/api_logs/core_navigation_log.json doc --module-name MapboxCoreNavigation -- -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=<< parameters.device >>' -project MapboxNavigation.xcodeproj -scheme MapboxCoreNavigation clean build
- run:
name: Generating MapboxNavigation API Log
command: cd scripts/APIDiffReport && swift run APIDiffReport log ../.. $CIRCLE_WORKING_DIRECTORY/api_logs/navigation_log.json doc --module-name MapboxNavigation -- -sdk iphonesimulator -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=<< parameters.device >>' -project MapboxNavigation.xcodeproj -scheme MapboxNavigation clean build

step-library:
- &restore-cache
restore_cache:
Expand Down Expand Up @@ -164,6 +226,9 @@ jobs:
delete_private_deps:
type: boolean
default: false
generate_api_log:
type: boolean
default: false
macos:
xcode: << parameters.xcode >>
environment:
Expand Down Expand Up @@ -202,6 +267,15 @@ jobs:
condition: << parameters.codecoverage >>
steps:
- run: bash <(curl -s https://codecov.io/bash)
- when:
condition: << parameters.generate_api_log >>
steps:
- build-api-diff-report
- run_api_log:
iOS: << parameters.iOS >>
device: << parameters.device >>
- save-api-diff-cache:
api_diff_cache: .Environment.CIRCLE_SHA1

xcode-11-examples:
parameters:
Expand Down Expand Up @@ -234,6 +308,68 @@ jobs:
steps:
- *trigger-metrics

api-diff-job:
parameters:
xcode:
type: string
default: "11.4.1"
device:
type: string
default: "iPhone 8 Plus"
iOS:
type: string
default: "13.4.1"
base_api_tag:
type: string
default: "v0.40.0"
macos:
xcode: << parameters.xcode >>
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- checkout
- build-api-diff-report
- run:
name: Store latest APIDiffReport
command: cp -R scripts/APIDiffReport ~/.
- run:
name: Checking out Base API
command: git checkout << parameters.base_api_tag >>
- restore-api-diff-cache:
api_diff_cache: .Environment.CIRCLE_SHA1
- run:
name: Move Api Diff
command: |
mv api_logs original_api
- restore-api-diff-cache-by-tag:
api_diff_cache: << parameters.base_api_tag >>
- *prepare-mapbox-file
- *prepare-netrc-file
- *update-carthage-version
- *restore-cache
- *install-dependencies
- *install-dependencies-12
- run:
name: Install prerequisites
command: if [ $(xcversion simulators | grep -cF "iOS << parameters.iOS >> Simulator (installed)") -eq 0 ]; then xcversion simulators --install="iOS << parameters.iOS >>" || true; fi
- *save-cache
- save-api-diff-cache-by-tag:
api_diff_cache: << parameters.base_api_tag >>
Comment on lines +346 to +357
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These steps should be run only if cache above was not restored. I could not find a working solution, so any suggestions are highly welcome.

- run:
name: Restore latest APIDiffReport
command: |
rm -rf scripts/APIDiffReport
cp -R ~/APIDiffReport scripts/.
- run_api_log:
iOS: << parameters.iOS >>
device: << parameters.device >>
- run:
name: Generating MapboxCoreNavigation API Diff
command: cd scripts/APIDiffReport && swift run APIDiffReport diff $CIRCLE_WORKING_DIRECTORY/original_api/core_navigation_log.json -i $CIRCLE_WORKING_DIRECTORY/api_logs/core_navigation_log.json
- run:
name: Generating MapboxNavigation API Diff
command: cd scripts/APIDiffReport && swift run APIDiffReport diff $CIRCLE_WORKING_DIRECTORY/original_api/navigation_log.json -i $CIRCLE_WORKING_DIRECTORY/api_logs/navigation_log.json

workflows:
workflow:
jobs:
Expand All @@ -243,6 +379,7 @@ workflows:
iOS: "14.0"
test: false
device: "iPhone 8 Plus"
generate_api_log: true
- build-job:
name: "Xcode_11.5_iOS_13.5"
xcode: "11.5.0"
Expand Down Expand Up @@ -286,3 +423,9 @@ workflows:
filters:
branches:
only: main
- api-diff-job-approval:
type: approval
- api-diff-job:
requires:
- "Xcode_12.0_iOS_14.0"
- api-diff-job-approval
19 changes: 19 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,22 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


-----

Contains modified version of https://github.com/material-motion/apidiff/blob/e78f92ae310cd4affc86a4510bb7b9f9609662d2/apple/diffreport/Sources/diffreportlib/diffreport.swift

Copyright 2016-present The Material Motion Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Loading