From 13eddaf0d5f66e655718c3d1c87bf42421977a19 Mon Sep 17 00:00:00 2001 From: Garrett Moon Date: Mon, 28 Nov 2022 12:05:45 -0800 Subject: [PATCH] Update CI to modern xcode and fix Carthage (#47) * Update CI to modern xcode and fix Carthage * Match makefile and CI * Since Cocoapods has issues with 14 let's use 13 for now * I think I fixed it? * Target iPhone 13 so we can use Xcode 13 --- .github/workflows/ci.yml | 33 +++++++++++++++++---------- .github/workflows/publish_release.yml | 5 +++- Makefile | 21 ++++++++--------- 3 files changed, 35 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 869cec2..9bd0590 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,44 +13,53 @@ on: jobs: test: name: Test - runs-on: macOS-latest + runs-on: macos-latest strategy: matrix: - platform: ['iOS Simulator,name=iPhone 8'] + platform: ['iOS Simulator,name=iPhone 13'] steps: - uses: actions/checkout@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.4.1' - name: Test run: make test analyze: name: Analyze - runs-on: macOS-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.4.1' - name: analyze run: make analyze cocoapods: name: CocoaPods - runs-on: macOS-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.4.1' - name: Cocoapods lint run: make cocoapods carthage: name: Carthage - runs-on: macOS-latest - env: - # Carthage is broken in Xcode 12 and above https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md - DEVELOPER_DIR: /Applications/Xcode_11.7.app/Contents/Developer + runs-on: macos-latest steps: - uses: actions/checkout@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.4.1' - name: carthage run: make carthage swift-package-manager: runs-on: macos-latest - env: - DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer steps: - - name: Checkout - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.4.1' - name: Verify that PINCache can be build by SPM run: make spm diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml index 6589c0d..4e6cd14 100644 --- a/.github/workflows/publish_release.yml +++ b/.github/workflows/publish_release.yml @@ -7,10 +7,13 @@ on: required: true jobs: create_release: - runs-on: macOS-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 # Make sure we can lint before creating the release. + - uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '13.4.1' - name: Cocoapods lint run: make cocoapods - name: Create Release Commit diff --git a/Makefile b/Makefile index c41fa1b..3acfd42 100644 --- a/Makefile +++ b/Makefile @@ -1,33 +1,32 @@ -PLATFORM="platform=iOS Simulator,name=iPhone 8" +PLATFORM="platform=iOS Simulator,name=iPhone 13" SDK="iphonesimulator" SHELL=/bin/bash -o pipefail XCODE_MAJOR_VERSION=$(shell xcodebuild -version | HEAD -n 1 | sed -E 's/Xcode ([0-9]+).*/\1/') -.PHONY: all cocoapods test analyze carthage spm +.PHONY: all cocoapods test analyze carthage spm install_xcbeautify carthage: - if [ ${XCODE_MAJOR_VERSION} -gt 11 ] ; then \ - echo "Carthage no longer works in Xcode 12 https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md"; \ - exit 1; \ - fi - carthage build --no-skip-current + carthage build --no-skip-current --use-xcframeworks cocoapods: pod lib lint -analyze: +install_xcbeautify: + if ! command -v xcbeautify &> /dev/null; then brew install xcbeautify; fi + +analyze: install_xcbeautify xcodebuild clean analyze -destination ${PLATFORM} -sdk ${SDK} -project PINOperation.xcodeproj -scheme PINOperation \ ONLY_ACTIVE_ARCH=NO \ CODE_SIGNING_REQUIRED=NO \ CLANG_ANALYZER_OUTPUT=plist-html \ - CLANG_ANALYZER_OUTPUT_DIR="$(shell pwd)/clang" | xcpretty + CLANG_ANALYZER_OUTPUT_DIR="$(shell pwd)/clang" | xcbeautify if [[ -n `find $(shell pwd)/clang -name "*.html"` ]] ; then rm -rf `pwd`/clang; exit 1; fi rm -rf $(shell pwd)/clang -test: +test: install_xcbeautify xcodebuild clean test -destination ${PLATFORM} -sdk ${SDK} -project PINOperation.xcodeproj -scheme PINOperation \ ONLY_ACTIVE_ARCH=NO \ - CODE_SIGNING_REQUIRED=NO | xcpretty + CODE_SIGNING_REQUIRED=NO | xcbeautify spm: # For now just check whether we can assemble it