From aec36cd402a3171a2ae38ea4ec50432461908727 Mon Sep 17 00:00:00 2001 From: Kyle Hickinson Date: Mon, 16 Aug 2021 16:03:43 -0400 Subject: [PATCH] No Bug: Update CI workflow to use macOS 11 & Xcode 12.5 (#4054) --- .github/workflows/build_and_test.yml | 4 +- .../Lists/does-it-compile.swift | 61 ------------------- .../Lists/test-compile-all-lists.sh | 12 ---- fastlane/Fastfile | 1 - 4 files changed, 2 insertions(+), 76 deletions(-) delete mode 100755 Client/WebFilters/ContentBlocker/Lists/does-it-compile.swift delete mode 100755 Client/WebFilters/ContentBlocker/Lists/test-compile-all-lists.sh diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 4340265226c..76221fa29b5 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -11,12 +11,12 @@ jobs: test: if: ${{ github.event_name == 'push' || (github.event_name == 'pull_request' && !contains(github.event.pull_request.labels.*.name, 'CI/skip')) }} name: Run tests - runs-on: macOS-latest + runs-on: macOS-11 env: # The XCode version to use. If you want to update it please refer to this document: # https://docs.github.com/en/actions/reference/specifications-for-github-hosted-runners#supported-software # and set proper version. - XCODE_VERSION: 12.4 + XCODE_VERSION: 12.5 steps: - name: Select XCode diff --git a/Client/WebFilters/ContentBlocker/Lists/does-it-compile.swift b/Client/WebFilters/ContentBlocker/Lists/does-it-compile.swift deleted file mode 100755 index 95a8584a074..00000000000 --- a/Client/WebFilters/ContentBlocker/Lists/does-it-compile.swift +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/swift - -import WebKit -import Foundation - -enum CompileResult { - case success - case failed(String) -} - -/// Compile a content blocker list synchronously, must be run on background thread -func synchronousCompileList(_ list: String, to ruleStore: WKContentRuleListStore = .default()!) -> CompileResult { - let group = DispatchGroup() - var result: CompileResult! - - group.enter() - ruleStore.compileContentRuleList(forIdentifier: "list", encodedContentRuleList: list, completionHandler: { list, error in - if let error = error { - if let errorString = (error as NSError).userInfo["NSHelpAnchor"] as? String { - result = .failed(errorString) - } else { - result = .failed(String(describing: error)) - } - } else { - result = .success - } - group.leave() - }) - group.wait() - return result -} - -let compileQueue = DispatchQueue(label: "compile") -var anyFailed = false - -for path in CommandLine.arguments.dropFirst().map({ NSString(string: $0) }) { - guard let list = try? String(contentsOfFile: path.expandingTildeInPath) else { - print("Failed to load \"\(path)\" to compile") - continue - } - compileQueue.async { - let timeStart = Date() - print("Compiling: \(path.lastPathComponent)", terminator: "") - let result = synchronousCompileList(list) - let performance = String(format: "(%.02fs)", Date().timeIntervalSince(timeStart)) - switch result { - case .success: - print("... ✓ \(performance)") - case .failed(let errorDescription): - print("... 𐄂 \(performance)") - print(" → \(errorDescription)") - anyFailed = true - } - } -} - -compileQueue.async { - exit(anyFailed ? EXIT_FAILURE : EXIT_SUCCESS) -} - -RunLoop.main.run() diff --git a/Client/WebFilters/ContentBlocker/Lists/test-compile-all-lists.sh b/Client/WebFilters/ContentBlocker/Lists/test-compile-all-lists.sh deleted file mode 100755 index d3bf41eaad3..00000000000 --- a/Client/WebFilters/ContentBlocker/Lists/test-compile-all-lists.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -e -pushd `dirname $0` - -echo "Testing main blockers" - -for file in *.json -do - ./does-it-compile.swift "$file" -done - -popd diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 8d4a9e1ff36..6feb1b92970 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -31,7 +31,6 @@ platform :ios do desc "Run Unit Tests" lane :test do |options| - sh("../Client/WebFilters/ContentBlocker/Lists/test-compile-all-lists.sh") run_tests( scheme: "Debug", device: "iPhone 8",