From 54cc8182b0e15c91aeb1d836e2e8fd31b7ee718d Mon Sep 17 00:00:00 2001 From: Paul Zabelin Date: Wed, 9 Sep 2020 02:05:54 -0700 Subject: [PATCH] add macOS workflow (#113) * add macos workflow * update opencv install script * cache OpenCV brew installation * update badge --- .github/workflows/mac-os.yml | 33 +++++++++++++++++++ Example/OpenCV-OSX-Tests/install-opencv.sh | 13 ++++---- Example/OpenCV-OSX-Tests/uninstall-opencv.sh | 9 +++++ .../project.pbxproj | 2 ++ Gemfile | 1 + Gemfile.lock | 2 +- README.md | 2 +- 7 files changed, 53 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/mac-os.yml create mode 100755 Example/OpenCV-OSX-Tests/uninstall-opencv.sh diff --git a/.github/workflows/mac-os.yml b/.github/workflows/mac-os.yml new file mode 100644 index 0000000..ac24e08 --- /dev/null +++ b/.github/workflows/mac-os.yml @@ -0,0 +1,33 @@ +name: macOS +on: [push, pull_request] +jobs: + macOS: + name: Test on macOS + runs-on: macOS-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v2.3.2 + - uses: actions/cache@v2.1.1 + id: opencv-cache + with: + key: opencv-${{ hashFiles('**/install-opencv.sh') }} + path: | + /usr/local/Cellar/openblas + /usr/local/Cellar/tbb + /usr/local/Cellar/gcc + /usr/local/Cellar/opencv + - name: Install OpenCV + run: Example/OpenCV-OSX-Tests/install-opencv.sh + - uses: actions/cache@v2.1.1 + id: pods-cache + with: + path: Example/Pods + key: macos-pods-${{ hashFiles('**/Podfile.lock') }} + - name: Install Cocoapods dependencies + if: steps.pods-cache.outputs.cache-hit != 'true' + run: pod install --project-directory=Example + - name: All Tests + uses: sersoft-gmbh/xcodebuild-action@v1.1 + with: + workspace: Example/PerspectiveTransform.xcworkspace + scheme: OpenCV Tests diff --git a/Example/OpenCV-OSX-Tests/install-opencv.sh b/Example/OpenCV-OSX-Tests/install-opencv.sh index a087bb6..f3ff8b5 100755 --- a/Example/OpenCV-OSX-Tests/install-opencv.sh +++ b/Example/OpenCV-OSX-Tests/install-opencv.sh @@ -2,12 +2,11 @@ # install-opencv.sh -libraries="tbb openblas gcc ffmpeg libpng libtiff ilmbase openexr jpeg opencore-amr snappy lame openjpeg opus speex theora libogg libvorbis x264 x265 libsoxr libbluray gnutls rtmpdump openssl fontconfig freetype p11-kit libunistring libtasn1 nettle gmp libffi" +libraries="openblas tbb gcc" -for package in opencv $libraries; do brew link $package || brew install --ignore-dependencies --force-bottle $package; done -# due to Warning: Refusing to link macOS-provided software: openblas -# link /usr/local/opt/openblas is not getting restored -ln -s /usr/local/Cellar/openblas/`ls /usr/local/Cellar/openblas` /usr/local/opt/openblas || true +for package in $libraries opencv +do + brew list $package || brew install --ignore-dependencies --force-bottle $package +done -# To remove all dependencies: -# for package in opencv $(brew deps opencv); do brew rm --ignore-dependencies --force $package; done +brew link opencv diff --git a/Example/OpenCV-OSX-Tests/uninstall-opencv.sh b/Example/OpenCV-OSX-Tests/uninstall-opencv.sh new file mode 100755 index 0000000..f28f0f8 --- /dev/null +++ b/Example/OpenCV-OSX-Tests/uninstall-opencv.sh @@ -0,0 +1,9 @@ +#! /usr/bin/env bash + +# uninstall-opencv.sh + +# To remove all dependencies: +for package in opencv $(brew deps opencv) +do + brew rm --ignore-dependencies --force $package +done diff --git a/Example/PerspectiveTransform.xcodeproj/project.pbxproj b/Example/PerspectiveTransform.xcodeproj/project.pbxproj index 9399786..c5bb3e5 100644 --- a/Example/PerspectiveTransform.xcodeproj/project.pbxproj +++ b/Example/PerspectiveTransform.xcodeproj/project.pbxproj @@ -77,6 +77,7 @@ 11CFEB20812B9CCCF8BF46FE /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; }; 228B48512798F0994ED8E8A0 /* Pods-Example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example.release.xcconfig"; path = "Pods/Target Support Files/Pods-Example/Pods-Example.release.xcconfig"; sourceTree = ""; }; 4B1B1C0C1C7A76C8003F8165 /* PerformanceTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerformanceTest.swift; sourceTree = ""; }; + 4B29775C25089A0000830FB8 /* workflows */ = {isa = PBXFileReference; lastKnownFileType = folder; name = workflows; path = ../.github/workflows; sourceTree = ""; }; 4B2D2E861C7C2AD10045FD11 /* SnapshotSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapshotSpec.swift; sourceTree = ""; }; 4B2D2E881C7C2E620045FD11 /* container.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = container.jpg; sourceTree = ""; }; 4B2D2E891C7C2E620045FD11 /* with-overlay.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "with-overlay.svg"; sourceTree = ""; }; @@ -300,6 +301,7 @@ 11CFEB20812B9CCCF8BF46FE /* LICENSE */, 4BA7B1481C7C7A0600933779 /* .travis.yml */, 4B42173E2047AA4100BA73C2 /* codecov.yml */, + 4B29775C25089A0000830FB8 /* workflows */, 4B714005205E16AA004441A8 /* Gemfile */, 4B714007205E16E8004441A8 /* Gemfile.lock */, ); diff --git a/Gemfile b/Gemfile index a7f8586..2525451 100644 --- a/Gemfile +++ b/Gemfile @@ -5,6 +5,7 @@ gem 'xcpretty' # to simulate travis output group :travis do gem 'xcpretty-travis-formatter' + # gem 'travis' # to debug builds, see https://docs.travis-ci.com/user/running-build-in-debug-mode/ end group :github do diff --git a/Gemfile.lock b/Gemfile.lock index 73cfaa0..5196f80 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -97,4 +97,4 @@ DEPENDENCIES xcpretty-travis-formatter BUNDLED WITH - 2.1.2 + 2.1.4 diff --git a/README.md b/README.md index f596df4..64e4013 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Perspective Transform -[![Build Status](https://travis-ci.org/paulz/PerspectiveTransform.svg?branch=master)](https://travis-ci.org/paulz/PerspectiveTransform) +[![macOS](https://github.com/paulz/PerspectiveTransform/workflows/macOS/badge.svg)](https://github.com/paulz/PerspectiveTransform/actions?query=workflow%3AmacOS) [![CircleCI](https://circleci.com/gh/paulz/PerspectiveTransform.svg?style=svg)](https://circleci.com/gh/paulz/PerspectiveTransform) [![codecov](https://codecov.io/gh/paulz/PerspectiveTransform/branch/master/graph/badge.svg)](https://codecov.io/gh/paulz/PerspectiveTransform) [![Version](https://img.shields.io/cocoapods/v/PerspectiveTransform.svg?style=flat)](http://cocoapods.org/pods/PerspectiveTransform)