mirror of
https://github.com/MessageKit/MessageKit.git
synced 2026-02-06 19:03:19 +00:00
Cherry pick CI and infra changes from development to apply to master
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
# .circleci/config.yml
|
||||
|
||||
# Specify the config version - version 2 is latest.
|
||||
version: 2
|
||||
|
||||
# Define the jobs for the current project.
|
||||
jobs:
|
||||
build-and-test:
|
||||
|
||||
environment:
|
||||
- DESTINATION: "platform=iOS Simulator,name=iPhone 11 Pro"
|
||||
|
||||
# Specify the Xcode version to use.
|
||||
macos:
|
||||
xcode: "11.3.1"
|
||||
|
||||
# Define the steps required to build the project.
|
||||
steps:
|
||||
|
||||
# Get the code from the VCS provider.
|
||||
- checkout
|
||||
- run:
|
||||
name: Update Homebrew
|
||||
command: brew update
|
||||
- run:
|
||||
name: Bootstrap Carthage
|
||||
command: carthage bootstrap --platform ios
|
||||
- run:
|
||||
name: Build framework
|
||||
command: xcodebuild build -project MessageKit.xcodeproj -scheme MessageKit -destination "$DESTINATION" CODE_SIGNING_REQUIRED=NO | xcpretty -c
|
||||
- run:
|
||||
name: Build and run tests
|
||||
command: xcodebuild test -project MessageKit.xcodeproj -scheme MessageKitTests -destination "$DESTINATION" CODE_SIGNING_REQUIRED=NO | xcpretty -c
|
||||
- run:
|
||||
name: Fetch CocoaPods Specs
|
||||
command: curl -sS https://cocoapods-specs.circleci.com/fetch-cocoapods-repo-from-s3.sh | bash
|
||||
- run:
|
||||
name: Update Pods
|
||||
command: cd Example && pod install
|
||||
- run:
|
||||
name: Build and analyze Example
|
||||
command: xcodebuild build analyze -workspace Example/ChatExample.xcworkspace -scheme ChatExample -destination "$DESTINATION" ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | xcpretty -c
|
||||
|
||||
# Run tests.
|
||||
#- run:
|
||||
# name: Run tests
|
||||
# command: fastlane scan
|
||||
# environment:
|
||||
# SCAN_DEVICE: iPhone 6
|
||||
# SCAN_SCHEME: WebTests
|
||||
|
||||
# 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_test_results:
|
||||
# path: test_output/report.xml
|
||||
#- store_artifacts:
|
||||
# path: /tmp/test-results
|
||||
# destination: scan-test-results
|
||||
#- store_artifacts:
|
||||
# path: ~/Library/Logs/scan
|
||||
# destination: scan-logs
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build-and-deploy:
|
||||
jobs:
|
||||
- build-and-test
|
||||
@@ -0,0 +1,31 @@
|
||||
name: PR Example app
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Build Example app
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- name: Checkout the Git repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Pods
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: Example/Pods
|
||||
key: ${{ runner.os }}-example-${{ env.cache-name }}-pods-${{ hashFiles('**/Example/Podfile.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-example-${{ env.cache-name }}-pods-
|
||||
${{ runner.os }}-example-${{ env.cache-name }}-
|
||||
${{ runner.os }}-example-
|
||||
- name: Cache Gems
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: ${{ runner.os }}-example-${{ env.cache-name }}-gems-${{ hashFiles('**/Example/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-example-${{ env.cache-name }}-gems-
|
||||
${{ runner.os }}-example-${{ env.cache-name }}-
|
||||
${{ runner.os }}-example-
|
||||
- name: Build and run example project
|
||||
run: ./GitHubActions/build.sh example
|
||||
@@ -0,0 +1,22 @@
|
||||
name: PR Framework
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Build Framework
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- name: Checkout the Git repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Carthage
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: Carthage
|
||||
key: ${{ runner.os }}-framework-${{ env.cache-name }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-framework-${{ env.cache-name }}-carthage-
|
||||
${{ runner.os }}-framework-${{ env.cache-name }}-
|
||||
${{ runner.os }}-framework-
|
||||
- name: Build framework
|
||||
run: ./GitHubActions/build.sh framework
|
||||
@@ -0,0 +1,22 @@
|
||||
name: PR Tests
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
name: Run Tests
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- name: Checkout the Git repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Carthage
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: Carthage
|
||||
key: ${{ runner.os }}-tests-${{ env.cache-name }}-carthage-${{ hashFiles('**/Cartfile.resolved') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-tests-${{ env.cache-name }}-carthage-
|
||||
${{ runner.os }}-tests-${{ env.cache-name }}-
|
||||
${{ runner.os }}-tests-
|
||||
- name: Build and run tests
|
||||
run: ./GitHubActions/build.sh tests
|
||||
@@ -0,0 +1,24 @@
|
||||
name: PR Danger
|
||||
|
||||
on: pull_request
|
||||
|
||||
jobs:
|
||||
danger:
|
||||
name: Run Danger
|
||||
runs-on: macOS-latest
|
||||
steps:
|
||||
- name: Checkout the Git repository
|
||||
uses: actions/checkout@v2
|
||||
- name: Cache Gems
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: ${{ runner.os }}-danger-${{ env.cache-name }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-danger-${{ env.cache-name }}-gems-
|
||||
${{ runner.os }}-danger-${{ env.cache-name }}-
|
||||
${{ runner.os }}-danger-
|
||||
- name: Run build script
|
||||
run: gem install bundler && bundle install && bundle exec danger --fail-on-errors=true
|
||||
env:
|
||||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1 +0,0 @@
|
||||
5.0
|
||||
-53
@@ -1,53 +0,0 @@
|
||||
language: objective-c
|
||||
osx_image: xcode8.1
|
||||
|
||||
env:
|
||||
global:
|
||||
- LANG=en_US.UTF-8
|
||||
|
||||
- PROJECT="MessageKit.xcodeproj"
|
||||
- IOS_SCHEME="MessageKit"
|
||||
- IOS_SDK=iphonesimulator10.1
|
||||
|
||||
matrix:
|
||||
|
||||
- DESTINATION="OS=9.0,name=iPhone 6 Plus" SDK="$IOS_SDK" SCHEME="$IOS_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" RUN_UI_TESTS="YES"
|
||||
- DESTINATION="OS=9.1,name=iPhone 6s" SDK="$IOS_SDK" SCHEME="$IOS_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" RUN_UI_TESTS="NO"
|
||||
- DESTINATION="OS=9.2,name=iPhone 6s" SDK="$IOS_SDK" SCHEME="$IOS_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" RUN_UI_TESTS="NO"
|
||||
- DESTINATION="OS=9.3,name=iPad Pro" SDK="$IOS_SDK" SCHEME="$IOS_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" RUN_UI_TESTS="NO"
|
||||
|
||||
- DESTINATION="OS=10.0,name=iPhone 6s" SDK="$IOS_SDK" SCHEME="$IOS_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="YES" POD_LINT="NO" RUN_UI_TESTS="YES"
|
||||
- DESTINATION="OS=10.1,name=iPhone 7" SDK="$IOS_SDK" SCHEME="$IOS_SCHEME" RUN_TESTS="YES" BUILD_EXAMPLE="NO" POD_LINT="NO" RUN_UI_TESTS="NO"
|
||||
|
||||
script:
|
||||
|
||||
- if [ $POD_LINT == "YES" ]; then
|
||||
pod lib lint;
|
||||
fi
|
||||
|
||||
|
||||
- if [ $BUILD_EXAMPLE == "YES" ]; then
|
||||
xcodebuild build analyze -project Example/ChatExample.xcodeproj -scheme ChatExample -sdk "$SDK" -destination "$DESTINATION" ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | xcpretty -c;
|
||||
fi
|
||||
|
||||
|
||||
- if [ $RUN_TESTS == "YES" ]; then
|
||||
xcodebuild analyze test -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | xcpretty -c;
|
||||
else
|
||||
xcodebuild build analyze -project "$PROJECT" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | xcpretty -c;
|
||||
fi
|
||||
|
||||
|
||||
- if [ $RUN_UI_TESTS == "YES" ]; then
|
||||
xcodebuild test -project Example/ChatExample.xcodeproj -scheme ChatExampleUITests -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO | xcpretty -c;
|
||||
fi
|
||||
|
||||
|
||||
# Build for reporting test coverage
|
||||
- if [ $RUN_TESTS == "YES" ]; then
|
||||
xcodebuild test -project MessageKit.xcodeproj -scheme MessageKit -destination "platform=iOS Simulator,name=iPhone 7" CODE_SIGNING_REQUIRED=NO;
|
||||
fi
|
||||
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2017-2020 MessageKit
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# 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.
|
||||
|
||||
# This runs on CI
|
||||
mergeable_state = github.pr_json["mergeable_state"]
|
||||
|
||||
# Make it more obvious that a PR a draft
|
||||
if mergeable_state == "draft"
|
||||
warn("PR is marked as Draft")
|
||||
end
|
||||
|
||||
# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title
|
||||
if github.pr_body.length < 5
|
||||
fail("Please provide a summary in the Pull Request description")
|
||||
end
|
||||
|
||||
declared_hashtag = github.pr_title.include?("#trivial")
|
||||
hasChangelogEntry = git.modified_files.include?("CHANGELOG.md")
|
||||
if !hasChangelogEntry && !declared_hashtag
|
||||
fail("Please include a CHANGELOG entry. \nYou can find it at [CHANGELOG.md](https://github.com/MessageKit/MessageKit/blob/master/CHANGELOG.md).")
|
||||
end
|
||||
|
||||
# Warn when there is a big PR
|
||||
if git.lines_of_code > 1000
|
||||
warn("Big Pull Request - Please consider splitting up your changes into smaller Pull Requests.")
|
||||
end
|
||||
|
||||
swiftlint.config_file = '.swiftlint.yml'
|
||||
swiftlint.lint_files inline_mode:true, fail_on_error:true
|
||||
@@ -0,0 +1,26 @@
|
||||
#
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2017-2020 MessageKit
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# 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.
|
||||
|
||||
source 'https://rubygems.org'
|
||||
gem 'danger', '~> 6.2'
|
||||
gem 'danger-swiftlint', '~> 0.24'
|
||||
@@ -0,0 +1,66 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
claide (1.0.3)
|
||||
claide-plugins (0.9.2)
|
||||
cork
|
||||
nap
|
||||
open4 (~> 1.3)
|
||||
colored2 (3.1.2)
|
||||
cork (0.3.0)
|
||||
colored2 (~> 3.1)
|
||||
danger (6.3.1)
|
||||
claide (~> 1.0)
|
||||
claide-plugins (>= 0.9.2)
|
||||
colored2 (~> 3.1)
|
||||
cork (~> 0.1)
|
||||
faraday (~> 0.9)
|
||||
faraday-http-cache (~> 2.0)
|
||||
git (~> 1.6)
|
||||
kramdown (~> 2.0)
|
||||
kramdown-parser-gfm (~> 1.0)
|
||||
no_proxy_fix
|
||||
octokit (~> 4.7)
|
||||
terminal-table (~> 1)
|
||||
danger-swiftlint (0.24.2)
|
||||
danger
|
||||
rake (> 10)
|
||||
thor (~> 0.19)
|
||||
faraday (0.17.3)
|
||||
multipart-post (>= 1.2, < 3)
|
||||
faraday-http-cache (2.0.0)
|
||||
faraday (~> 0.8)
|
||||
git (1.6.0)
|
||||
rchardet (~> 1.8)
|
||||
kramdown (2.1.0)
|
||||
kramdown-parser-gfm (1.1.0)
|
||||
kramdown (~> 2.0)
|
||||
multipart-post (2.1.1)
|
||||
nap (1.1.0)
|
||||
no_proxy_fix (0.1.2)
|
||||
octokit (4.17.0)
|
||||
faraday (>= 0.9)
|
||||
sawyer (~> 0.8.0, >= 0.5.3)
|
||||
open4 (1.3.4)
|
||||
public_suffix (4.0.3)
|
||||
rake (13.0.1)
|
||||
rchardet (1.8.0)
|
||||
sawyer (0.8.2)
|
||||
addressable (>= 2.3.5)
|
||||
faraday (> 0.8, < 2.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thor (0.20.3)
|
||||
unicode-display_width (1.7.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
danger (~> 6.2)
|
||||
danger-swiftlint (~> 0.24)
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2017-2020 MessageKit
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# 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.
|
||||
|
||||
set -e
|
||||
function trap_handler {
|
||||
echo -e "\n\nOh no! You walked directly into the slavering fangs of a lurking grue!"
|
||||
echo "**** You have died ****"
|
||||
exit 255
|
||||
}
|
||||
trap trap_handler INT TERM EXIT
|
||||
|
||||
MODE="$1"
|
||||
|
||||
if [ "$MODE" = "tests" -o "$MODE" = "all" ]; then
|
||||
echo "Running MessageKit tests."
|
||||
carthage bootstrap --platform ios
|
||||
set -o pipefail && xcodebuild test -project MessageKit.xcodeproj -scheme MessageKitTests -destination "platform=iOS Simulator,name=iPhone 11 Pro" CODE_SIGNING_REQUIRED=NO | xcpretty -c
|
||||
success="1"
|
||||
fi
|
||||
|
||||
if [ "$MODE" = "framework" -o "$MODE" = "all" ]; then
|
||||
echo "Building MessageKit Framework."
|
||||
carthage bootstrap --platform ios
|
||||
set -o pipefail && xcodebuild build -project MessageKit.xcodeproj -scheme MessageKit -destination "platform=iOS Simulator,name=iPhone 11 Pro" CODE_SIGNING_REQUIRED=NO | xcpretty -c
|
||||
success="1"
|
||||
fi
|
||||
|
||||
if [ "$MODE" = "example" -o "$MODE" = "all" ]; then
|
||||
echo "Building & testing MessageKit Example app."
|
||||
cd Example
|
||||
gem install bundler
|
||||
bundle check || bundle install
|
||||
bundle exec pod install
|
||||
set -o pipefail && xcodebuild build analyze -workspace ChatExample.xcworkspace -scheme ChatExample -destination "platform=iOS Simulator,name=iPhone 11 Pro" ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | xcpretty -c
|
||||
success="1"
|
||||
fi
|
||||
|
||||
if [ "$success" = "1" ]; then
|
||||
trap - EXIT
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Unrecognised mode '$MODE'."
|
||||
Reference in New Issue
Block a user