add macOS workflow (#113)

* add macos workflow
* update opencv install script
* cache OpenCV brew installation
* update badge
This commit is contained in:
Paul Zabelin
2020-09-09 02:05:54 -07:00
committed by GitHub
parent dc3f3512fe
commit 54cc8182b0
7 changed files with 53 additions and 9 deletions

33
.github/workflows/mac-os.yml vendored Normal file
View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -77,6 +77,7 @@
11CFEB20812B9CCCF8BF46FE /* LICENSE */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = "<group>"; };
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 = "<group>"; };
4B1B1C0C1C7A76C8003F8165 /* PerformanceTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PerformanceTest.swift; sourceTree = "<group>"; };
4B29775C25089A0000830FB8 /* workflows */ = {isa = PBXFileReference; lastKnownFileType = folder; name = workflows; path = ../.github/workflows; sourceTree = "<group>"; };
4B2D2E861C7C2AD10045FD11 /* SnapshotSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SnapshotSpec.swift; sourceTree = "<group>"; };
4B2D2E881C7C2E620045FD11 /* container.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = container.jpg; sourceTree = "<group>"; };
4B2D2E891C7C2E620045FD11 /* with-overlay.svg */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "with-overlay.svg"; sourceTree = "<group>"; };
@@ -300,6 +301,7 @@
11CFEB20812B9CCCF8BF46FE /* LICENSE */,
4BA7B1481C7C7A0600933779 /* .travis.yml */,
4B42173E2047AA4100BA73C2 /* codecov.yml */,
4B29775C25089A0000830FB8 /* workflows */,
4B714005205E16AA004441A8 /* Gemfile */,
4B714007205E16E8004441A8 /* Gemfile.lock */,
);

View File

@@ -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

View File

@@ -97,4 +97,4 @@ DEPENDENCIES
xcpretty-travis-formatter
BUNDLED WITH
2.1.2
2.1.4

View File

@@ -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)