From d0a7abc41684f3bb48a0b7514d255c9dfe9fc6b6 Mon Sep 17 00:00:00 2001 From: Zev Eisenberg Date: Mon, 25 Dec 2023 16:34:40 -0500 Subject: [PATCH] Stop gathering coverage and running danger because I did not set it up and do not have the time or energy to maintain it. If there is a simpler way to do this in future, we could consider adding it back. --- .circleci/config.yml | 58 ----------------------- Dangerfile | 84 --------------------------------- Gemfile | 16 +------ Gemfile.lock | 80 ------------------------------- fastlane/Fastfile | 110 ------------------------------------------- 5 files changed, 1 insertion(+), 347 deletions(-) delete mode 100644 Dangerfile diff --git a/.circleci/config.yml b/.circleci/config.yml index c5f68055..93c80f12 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,59 +1,6 @@ version: 2.1 jobs: - danger: - executor: xcode-14 - steps: - - setup - - run: - name: Install xchtmlreport - command: | - curl -O https://raw.githubusercontent.com/TitouanVanBelle/XCTestHTMLReport/develop/xchtmlreport.rb - brew install --HEAD --build-from-source xchtmlreport.rb - - run: - name: Install xcparse - when: always - command: | - brew install chargepoint/xcparse/xcparse - - run: - name: Tests & Code Coverage - when: always - command: | - bundle exec fastlane coverage_all - # Store xcov Code Coverage HTML report artifact - - store_artifacts: - path: build/BonMot-iOS/xcov - destination: xcov - - store_artifacts: - path: build/BonMot-iOS/slather - destination: slather - - store_artifacts: - path: build/BonMot-iOS/scan - destination: scan - - run: - name: Rename CircleCI JUnit XML - when: always - command: | - mkdir -p build/test-results/danger - cp build/BonMot-iOS/scan/BonMot-iOS.xcresult/report.junit build/test-results/danger/results.xml - - store_test_results: - path: build/test-results - # Install SwiftLint only before Danger because otherwise it fails the build - - run: - name: Install SwiftLint - when: always - command: | - brew install swiftlint - - run: - name: Danger - when: always - command: | - if [ -n "$DANGER_GITHUB_API_TOKEN" ]; then bundle exec danger; else echo "Skipping Danger for forked pull request."; fi - - run: - name: Upload to Codecov - when: always - command: bash <(curl -s https://codecov.io/bash) -f build/BonMot-iOS/slather/cobertura.xml -X coveragepy -X gcov -X xcode - swift-package: executor: xcode-14 steps: @@ -139,10 +86,6 @@ workflows: version: 2 build-test-deploy: jobs: - - danger: - filters: - tags: - only: /.*/ - swift-package: filters: tags: @@ -162,7 +105,6 @@ workflows: - deploy-to-cocoapods: context: CocoaPods requires: - - danger - swift-package - fastlane-tests - fastlane-tests-xcode-15 diff --git a/Dangerfile b/Dangerfile deleted file mode 100644 index ae2debef..00000000 --- a/Dangerfile +++ /dev/null @@ -1,84 +0,0 @@ -require 'circleci_artifact' - -# Make it more obvious that a PR is a work in progress and shouldn't be merged yet. -has_wip_label = github.pr_labels.any? { |label| label.include? "WIP" } -has_wip_title = github.pr_title.include? "[WIP]" - -if has_wip_label || has_wip_title - warn("PR is classed as Work in Progress") -end - -# Warn when there is a big PR. -warn("Big PR") if git.lines_of_code > 500 - -# Mainly to encourage writing up some reasoning about the PR, rather than just leaving a title. -if github.pr_body.length < 3 && git.lines_of_code > 10 - warn("Please provide a summary in the Pull Request description") -end - -src_root = File.expand_path('../', __FILE__) - -SCHEME = "BonMot-iOS" - -result_bundle_path = "#{src_root}/build/#{SCHEME}/scan/#{SCHEME}.xcresult-coverage" -xccoverage_files = Dir.glob("#{result_bundle_path}/**/action.xccovreport").sort_by { |filename| File.mtime(filename) }.reverse -xccov_file_direct_path = xccoverage_files.first - -xcov.report( - project: "#{src_root}/BonMot.xcodeproj", - scheme: SCHEME, - output_directory: "#{src_root}/build/#{SCHEME}/xcov", - xccov_file_direct_path: xccov_file_direct_path -) - -## ** SwiftLint *** -swiftlint.binary_path = "/usr/local/bin/swiftlint" -swiftlint.config_file = "#{src_root}/.swiftlint.yml" - -# Run SwiftLint and warn us if anything fails it -swiftlint.directory = src_root -swiftlint.lint_files inline_mode: true - -# Getting artifact URLs from CircleCI - -# You must set up the CIRCLE_API_TOKEN manually using these instructions -# https://github.com/Rightpoint/ios-template/tree/master/PRODUCTNAME#danger -token = ENV['CIRCLE_API_TOKEN'] -# These are already in the Circle environment -# https://circleci.com/docs/2.0/env-vars/#build-specific-environment-variables -username = ENV['CIRCLE_PROJECT_USERNAME'] -reponame = ENV['CIRCLE_PROJECT_REPONAME'] -build = ENV['CIRCLE_BUILD_NUM'] - -if !(token.nil? or username.nil? or reponame.nil? or build.nil?) - fetcher = CircleciArtifact::Fetcher.new(token: token, username: username, reponame: reponame, build: build) - - xcov = CircleciArtifact::Query.new(url_substring: 'xcov/index.html') - slather = CircleciArtifact::Query.new(url_substring: 'slather/index.html') - xcpretty = CircleciArtifact::Query.new(url_substring: 'scan/report.html') - xchtmlreport = CircleciArtifact::Query.new(url_substring: 'scan/index.html') - queries = [xcov, slather, xcpretty, xchtmlreport] - results = fetcher.fetch_queries(queries) - - xcov_url = results.url_for_query(xcov) - slather_url = results.url_for_query(slather) - xcpretty_url = results.url_for_query(xcpretty) - xchtmlreport_url = results.url_for_query(xchtmlreport) - - if !xchtmlreport_url.nil? - message "[Test Results](#{xchtmlreport_url})" - else - message "Tests in progress..." - end - - if !slather_url.nil? - message "[Code Coverage](#{slather_url})" - end -else - warn "Missing CircleCI artifacts. Most likely the [CIRCLE_API_TOKEN](https://github.com/Rightpoint/circleci_artifact#getting-started) is not set, or Danger is not running on CircleCI." -end - -# Test Reporting - -junit.parse "#{src_root}/build/BonMot-iOS/scan/BonMot-iOS.xcresult/report.junit" -junit.report diff --git a/Gemfile b/Gemfile index fee24252..3983193e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,22 +1,8 @@ source 'https://rubygems.org' gem 'cocoapods' +gem 'fastlane' gem 'xcpretty' -# Danger -group :test, :danger do - gem 'slather' - gem 'circleci_artifact' - gem 'xcov' - gem 'fastlane' -end - -group :danger do - gem 'danger' - gem 'danger-swiftlint' - gem 'danger-xcov' - gem 'danger-junit' -end - plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Gemfile.lock b/Gemfile.lock index d2db9170..b858c4bd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -39,15 +39,7 @@ GEM babosa (1.0.4) base64 (0.2.0) bigdecimal (3.1.5) - circleci (2.1.0) - circleci_artifact (0.1.0) - circleci (~> 2.0) claide (1.1.0) - claide-plugins (0.9.2) - cork - nap - open4 (~> 1.3) - clamp (1.3.2) cocoapods (1.14.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) @@ -91,31 +83,6 @@ GEM highline (~> 2.0.0) concurrent-ruby (1.2.2) connection_pool (2.4.1) - cork (0.3.0) - colored2 (~> 3.1) - danger (9.4.2) - claide (~> 1.0) - claide-plugins (>= 0.9.2) - colored2 (~> 3.1) - cork (~> 0.1) - faraday (>= 0.9.0, < 3.0) - faraday-http-cache (~> 2.0) - git (~> 1.13) - kramdown (~> 2.3) - kramdown-parser-gfm (~> 1.0) - no_proxy_fix - octokit (>= 4.0) - terminal-table (>= 1, < 4) - danger-junit (1.0.2) - danger (> 2.0) - ox (~> 2.0) - danger-swiftlint (0.34.0) - danger - rake (> 10) - thor (~> 0.19) - danger-xcov (0.5.0) - danger (>= 2.1) - xcov (>= 1.7.3) declarative (0.0.20) digest-crc (0.6.5) rake (>= 12.0.0, < 14.0.0) @@ -146,8 +113,6 @@ GEM faraday-em_http (1.0.0) faraday-em_synchrony (1.0.0) faraday-excon (1.1.0) - faraday-http-cache (2.5.0) - faraday (>= 0.8) faraday-httpclient (1.0.1) faraday-multipart (1.0.4) multipart-post (~> 2) @@ -203,9 +168,6 @@ GEM fourflusher (2.3.1) fuzzy_match (2.0.4) gh_inspector (1.1.3) - git (1.18.0) - addressable (~> 2.8) - rchardet (~> 1.8) google-apis-androidpublisher_v3 (0.54.0) google-apis-core (>= 0.11.0, < 2.a) google-apis-core (0.11.2) @@ -253,13 +215,8 @@ GEM jmespath (1.6.2) json (2.7.1) jwt (2.7.1) - kramdown (2.4.0) - rexml - kramdown-parser-gfm (1.1.0) - kramdown (~> 2.0) mini_magick (4.12.0) mini_mime (1.1.5) - mini_portile2 (2.8.5) minitest (5.20.0) molinillo (0.8.0) multi_json (1.15.0) @@ -269,22 +226,11 @@ GEM nap (1.1.0) naturally (2.2.1) netrc (0.11.0) - no_proxy_fix (0.1.2) - nokogiri (1.15.5) - mini_portile2 (~> 2.8.2) - racc (~> 1.4) - octokit (8.0.0) - faraday (>= 1, < 3) - sawyer (~> 0.9) - open4 (1.3.4) optparse (0.1.1) os (1.1.4) - ox (2.14.17) plist (3.7.0) public_suffix (4.0.7) - racc (1.7.3) rake (13.1.0) - rchardet (1.8.0) representable (3.2.0) declarative (< 0.1.0) trailblazer-option (>= 0.1.1, < 0.2.0) @@ -295,9 +241,6 @@ GEM ruby-macho (2.5.1) ruby2_keywords (0.0.5) rubyzip (2.3.2) - sawyer (0.9.2) - addressable (>= 2.3.5) - faraday (>= 0.17.3, < 3) security (0.1.3) signet (0.18.0) addressable (~> 2.8) @@ -307,17 +250,9 @@ GEM simctl (1.6.10) CFPropertyList naturally - slack-notifier (2.4.0) - slather (2.8.0) - CFPropertyList (>= 2.2, < 4) - activesupport - clamp (~> 1.3) - nokogiri (>= 1.14.3) - xcodeproj (~> 1.21) terminal-notifier (2.0.0) terminal-table (3.0.2) unicode-display_width (>= 1.1.1, < 3) - thor (0.20.3) trailblazer-option (0.1.2) tty-cursor (0.7.1) tty-screen (0.8.2) @@ -338,32 +273,17 @@ GEM colored2 (~> 3.1) nanaimo (~> 0.3.0) rexml (~> 3.2.4) - xcov (1.8.1) - fastlane (>= 2.141.0, < 3.0.0) - multipart-post - slack-notifier - terminal-table - xcodeproj - xcresult (~> 0.2.0) xcpretty (0.3.0) rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) - xcresult (0.2.1) PLATFORMS ruby DEPENDENCIES - circleci_artifact cocoapods - danger - danger-junit - danger-swiftlint - danger-xcov fastlane - slather - xcov xcpretty BUNDLED WITH diff --git a/fastlane/Fastfile b/fastlane/Fastfile index a3747128..da4f9f74 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -17,20 +17,6 @@ BUILD_PATH="./build" DERIVED_DATA_PATH = "#{BUILD_PATH}/derived_data" PROJECT_NAME='BonMot.xcodeproj' -desc "Tests & Coverage: iOS, tvOS, macOS. Builds: watchOS." -lane :coverage_all do - bundle_ios = coverage(scheme: "BonMot-iOS", devices: get_devices()) - bundle_tvos = coverage(scheme: "BonMot-tvOS") - # For some reason fastlane tries to build for tvOS simulator unless destination is manually set - bundle_macos = coverage(scheme: "BonMot-OSX", destination: "platform=macOS") - - xchtmlreport(result_bundle_paths: [bundle_ios, bundle_tvos, bundle_macos], - enable_junit: true) - # Unit testing is not available on watchOS - xcodebuild(scheme: "BonMot-watchOS", - derivedDataPath: DERIVED_DATA_PATH) -end - desc "Tests: iOS, tvOS, macOS. Builds: watchOS." lane :test_all do test(scheme: "BonMot-iOS", devices: get_devices()) @@ -42,11 +28,6 @@ lane :test_all do end platform :mac do - desc "Runs Tests & Generates Code Coverage Reports for macOS" - lane :coverage_macos do - coverage(scheme: "BonMot-OSX") - end - desc "Runs Tests for macOS" lane :test_macos do test(scheme: "BonMot-OSX", destination: "platform=macOS") @@ -54,13 +35,6 @@ platform :mac do end platform :ios do - desc "Runs Tests & Generates Code Coverage Reports for latest iOS" - lane :coverage_ios do - devices = get_devices() - coverage(scheme: "BonMot-iOS", - devices: devices) - end - desc "Runs Tests for latest iOS" lane :test_ios do devices = get_devices() @@ -68,11 +42,6 @@ platform :ios do devices: devices) end - desc "Runs Tests & Generates Code Coverage Reports for tvOS" - lane :coverage_tvos do - coverage(scheme: "BonMot-tvOS") - end - desc "Runs Tests for tvOS" lane :test_tvos do test(scheme: "BonMot-tvOS") @@ -113,85 +82,6 @@ def test(scheme:, devices: nil, destination: nil) end end -def coverage(scheme:, devices: nil, destination: nil) - scan_output_path = "#{BUILD_PATH}/#{scheme}/scan" - - # NOTE: Running too many devices concurrently breaks CircleCI resource limits - disable_concurrent_testing = false - if ENV['CIRCLE_BUILD_NUM'] - disable_concurrent_testing = true - end - - begin - scan( - output_types: 'junit,html', - devices: devices, - destination: destination, - scheme: scheme, - output_directory: scan_output_path, - code_coverage: true, - derived_data_path: DERIVED_DATA_PATH, - result_bundle: true, - disable_concurrent_testing: disable_concurrent_testing - ) - rescue => ex - # Don't fail the entire lane when running tests, but print failure to STDERR - STDERR.puts ex - end - - result_bundle_path = Scan.cache[:result_bundle_path] - - # Extract coverage from Xcode 11 xcresult bundle - absolute_result_bundle_path = "#{Dir.pwd}/../#{result_bundle_path}" - absolute_coverage_path = "#{absolute_result_bundle_path}-coverage" - sh("xcparse codecov #{absolute_result_bundle_path} #{absolute_coverage_path}") - xccoverage_files = Dir.glob("#{absolute_coverage_path}/**/action.xccovreport").sort_by { |filename| File.mtime(filename) }.reverse - xccov_file_direct_path = xccoverage_files.first - - slather_use_circleci = "false" - - if ENV['CIRCLE_BUILD_NUM'] - slather_use_circleci = "true" - end - - xcov( - project: PROJECT_NAME, - scheme: scheme, - output_directory: "#{BUILD_PATH}/#{scheme}/xcov", - xccov_file_direct_path: xccov_file_direct_path - ) - - # Add binaries here as you create internal frameworks - slather_binaries = ['BonMot'] - slather_output_directory = "#{BUILD_PATH}/#{scheme}/slather" - - # html and cobertura_xml output must be run separately - slather( - proj: PROJECT_NAME, - scheme: scheme, - binary_basename: slather_binaries, - output_directory: slather_output_directory, - html: "true", - build_directory: DERIVED_DATA_PATH - ) - # Using Cobertura XML allows us to upload to Codecov.io - # Uploading to codecov is handled separately in the .circleci/config.yml - slather( - proj: PROJECT_NAME, - scheme: scheme, - binary_basename: slather_binaries, - output_directory: slather_output_directory, - circleci: slather_use_circleci, - cobertura_xml: "true", - build_directory: DERIVED_DATA_PATH - ) - - xchtmlreport(result_bundle_path: result_bundle_path, - enable_junit: true) - - result_bundle_path -end - def get_devices() # The full list of iOS simulators available on CircleCI # https://circleci.com/docs/2.0/testing-ios/#supported-xcode-versions