Skip to content

Commit e943f5a

Browse files
authored
Merge pull request #30 from ainame/github-action-release
Support matrix tests and deployment in GitHub action properly
2 parents 973da44 + da4b39a commit e943f5a

File tree

9 files changed

+105
-134
lines changed

9 files changed

+105
-134
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy prebuilt-framework for Carthage when tagged
2+
on:
3+
push:
4+
tags:
5+
- '*'
6+
jobs:
7+
deploy:
8+
name: Deploy built-framework to GitHub releases
9+
runs-on: macOS-latest
10+
strategy:
11+
matrix:
12+
framework: [WebP]
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v1
16+
- name: Archive prebuilt framework with Carthage
17+
run: |
18+
set -o pipefail
19+
brew update
20+
brew outdated carthage || brew upgrade carthage
21+
git submodule update -i
22+
carthage build --no-skip-current
23+
carthage archive ${{ matrix.framework }}
24+
- name: Upload built framework to GitHub Release
25+
uses: svenstaro/upload-release-action@v1-release
26+
with:
27+
file: '${{ matrix.framework }}.framework.zip'
28+
asset_name: '${{ matrix.framework }}.framework.zip'
29+
tag: ${{ github.ref }}
30+
overwrite: true
31+
repo_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/pr.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: PR checks
2+
on: [pull_request]
3+
jobs:
4+
run_tests:
5+
strategy:
6+
matrix:
7+
# os: [macOS-latest, ubuntu-18.04]
8+
os: [macOS-latest]
9+
platform: [iOS, macOS, SPM]
10+
include:
11+
- platform: iOS
12+
destination: OS=latest,name=iPhone 8
13+
scheme: WebP iOS
14+
workspace: WebP.xcworkspace
15+
sdk: iphonesimulator
16+
- platform: macOS
17+
destination: platform=OS X,arch=x86_64
18+
scheme: WebP macOS
19+
workspace: WebP.xcworkspace
20+
sdk: macosx10.14
21+
# exclude:
22+
# - os: ubuntu-18.04
23+
# platform: iOS
24+
# - os: ubuntu-18.04
25+
# platform: macOS
26+
name: Run Tests
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- uses: actions/checkout@v1
30+
- name: Run Tests with xcodebuild
31+
if: matrix.platform != 'SPM'
32+
run: ./.github/bin/test.sh
33+
env:
34+
DESTINATION: ${{ matrix.destination }}
35+
SCHEME: ${{ matrix.scheme }}
36+
WORKSPACE: ${{ matrix.workspace }}
37+
SDK: ${{ matrix.sdk }}
38+
- name: Build package with swift package manager
39+
if: matrix.platform == 'SPM'
40+
run: |
41+
set -o pipefail
42+
brew install pkg-config webp
43+
swift test

.github/workflows/push.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.travis.yml

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,21 @@
11
language: objective-c
2-
osx_image: xcode10.2
2+
osx_image: xcode10.3
33
env:
44
global:
55
- LC_CTYPE=en_US.UTF-8
66
- LANG=en_US.UTF-8
77
- WORKSPACE="WebP.xcworkspace"
8-
- IOS_FRAMEWORK_SCHEME="WebP iOS"
9-
- MACOS_FRAMEWORK_SCHEME="WebP macOS"
10-
- IOS_SDK=iphonesimulator12.2
11-
- MAC_OS_SDK="macosx10.14"
12-
- FRAMEWORK_NAME="WebP"
138
matrix:
14-
# Deploy new built-framework during iOS's build
15-
- DEPLOY=true EXAMPLE_SCHEME="iOS Example" DESTINATION="OS=latest,name=iPhone X" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK"
16-
- EXAMPLE_SCHEME="macOS Example" DESTINATION="platform=OS X,arch=x86_64" SCHEME="$MACOS_FRAMEWORK_SCHEME" SDK="$MAC_OS_SDK"
9+
- DESTINATION="OS=latest,name=iPhone X" SCHEME="WebP iOS" SDK="iphonesimulator"
10+
- DESTINATION="platform=OS X,arch=x86_64" SCHEME="WebP macOS" SDK="macosx10.14"
1711
cache:
1812
directories:
1913
- $HOME/Library/Caches/Homebrew
2014
before_cache:
2115
- brew cleanup
2216
before_install:
2317
- brew install webp
24-
before_deploy:
25-
- brew update
26-
- brew outdated carthage || brew upgrade carthage
27-
- carthage build --no-skip-current
28-
- carthage archive $FRAMEWORK_NAME
2918
script:
30-
- set -o pipefail
31-
- xcrun simctl list
32-
- xcodebuild -version
33-
- xcodebuild -showsdks
34-
- xcodebuild -list
35-
- xcodebuild -workspace "$WORKSPACE" -list
36-
- xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO clean test | xcpretty
37-
- xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration ReleaseTest ONLY_ACTIVE_ARCH=NO clean build | xcpretty
38-
- xcodebuild -workspace "$WORKSPACE" -scheme "$EXAMPLE_SCHEME" -sdk "$SDK" -destination "$DESTINATION" -configuration Debug ONLY_ACTIVE_ARCH=NO clean build | xcpretty
39-
- swift build
19+
- .github/bin/test.sh
4020
notifications:
4121
email: false
42-
deploy:
43-
provider: releases
44-
api_key:
45-
secure: vYi+DMk6Pswlw/J0O1zkXfelAL9dcPmb4D6vnkzcTy4FUN7oiezoG/dZJ4IVD0XNb0hZqkXSsdNsWs0oenRdBhk/05t0eexQudjtKbCANRPaTpraLrBIZyw4l7/QXpC34MuENWS+G0D6Tvgi5v/dyByTnoa5UuPTtT5F40oNFOlLnWn3XSngROFhdXAXxbGtT5XB3vP4V45z1x8fHbDRqVvBa3UC0PBhOm0kQqm9nWa8kjfsx3d+e4G236egi+fnKfu4B0sU68lp6GIHgVtHhrYKYfU+uvxn3ZEcgxupL7cz+J2Z90ar1ORmHex7LeFP/41PvLZ1SGfUSvb1812oCntKLix5h9LJiQw4SR8+4TZGF51YHf5nPBsWyUqKBEAaRKCMc9BETZ7dj5nhC8gqtrcRLm36tNgVetDIGxfFpSTXvbFQMgRxFM1vOTjk4Gis+tYdDZ0/a7U86t6k7WWLMVcZsD1Ezx08b5R1xv/FUYS+N2WW/R2OkBOUrquHeXuWK1wppStcYJ2zwKmYbtMhE2Xo9WS/+S64YY8wW9qx2daq5/el3SOarzGmPzQdl6VsYX2YAsGbFOyFCurOpMK+SBSAhlNIgOuyzhMnWaEk8YfRfAFQLvr7evMO/YMuxV3dAR5IiO9mKjUhBDsDIxKHSG3p6m5X9pw1joM+yQJfNLE=
46-
file: "$FRAMEWORK_NAME.framework.zip"
47-
skip_cleanup: true
48-
on:
49-
repo: ainame/Swift-WebP
50-
tags: true
51-
condition: $DEPLOY = true

Tests/CheckCocoaPodsQualityIndexes.rb

Lines changed: 0 additions & 61 deletions
This file was deleted.

Tests/LinuxMain.swift

Lines changed: 0 additions & 9 deletions
This file was deleted.

Tests/WebPTests/WebPEncoderMacOSTests.swift

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,21 @@ class WebPEncoderMacOSTests: XCTestCase {
2424
}
2525

2626
func testExample() throws {
27-
let path = Bundle(for: self.classForCoder).resourcePath!.appendingFormat("/jiro.jpg")
28-
let nsImage = NSImage(contentsOfFile: path)!
27+
let currentFileURL = URL(fileURLWithPath: String(#file))
28+
let imagePath = currentFileURL.deletingLastPathComponent()
29+
.deletingLastPathComponent()
30+
.deletingLastPathComponent()
31+
.appendingPathComponent("iOS Example")
32+
.appendingPathComponent("Resources")
33+
.appendingPathComponent("jiro.jpg", isDirectory: false)
34+
.path
35+
36+
guard FileManager.default.fileExists(atPath: imagePath) else {
37+
XCTFail("Image couldn't be found at \(imagePath)")
38+
return
39+
}
40+
41+
let nsImage = NSImage(contentsOfFile: imagePath)!
2942
let encoder = WebPEncoder()
3043
let data = try encoder.encode(nsImage, config: .preset(.photo, quality: 10))
3144
XCTAssertTrue(data.count > 0)

WebP.xcodeproj/project.pbxproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1487,6 +1487,7 @@
14871487
PRODUCT_NAME = WebP;
14881488
SDKROOT = macosx;
14891489
SKIP_INSTALL = YES;
1490+
SUPPORTED_PLATFORMS = macosx;
14901491
SWIFT_INCLUDE_PATHS = "$(SRCROOT)/Sources";
14911492
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
14921493
SWIFT_VERSION = 5.0;
@@ -1510,7 +1511,9 @@
15101511
OTHER_LDFLAGS = "-all_load";
15111512
PRODUCT_BUNDLE_IDENTIFIER = me.ainam.WebP.macos;
15121513
PRODUCT_NAME = WebP;
1514+
SDKROOT = macosx;
15131515
SKIP_INSTALL = YES;
1516+
SUPPORTED_PLATFORMS = macosx;
15141517
SWIFT_INCLUDE_PATHS = "$(SRCROOT)/Sources";
15151518
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
15161519
SWIFT_VERSION = 5.0;

WebP.xcodeproj/xcshareddata/xcschemes/WebP macOS.xcscheme

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<MacroExpansion>
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "BD5FC4CF1DB3EE2B000A0A38"
34+
BuildableName = "WebP.framework"
35+
BlueprintName = "WebP macOS"
36+
ReferencedContainer = "container:WebP.xcodeproj">
37+
</BuildableReference>
38+
</MacroExpansion>
3039
<Testables>
3140
<TestableReference
3241
skipped = "NO">
@@ -39,17 +48,6 @@
3948
</BuildableReference>
4049
</TestableReference>
4150
</Testables>
42-
<MacroExpansion>
43-
<BuildableReference
44-
BuildableIdentifier = "primary"
45-
BlueprintIdentifier = "BD5FC4CF1DB3EE2B000A0A38"
46-
BuildableName = "WebP.framework"
47-
BlueprintName = "WebP macOS"
48-
ReferencedContainer = "container:WebP.xcodeproj">
49-
</BuildableReference>
50-
</MacroExpansion>
51-
<AdditionalOptions>
52-
</AdditionalOptions>
5351
</TestAction>
5452
<LaunchAction
5553
buildConfiguration = "Debug"
@@ -70,8 +68,6 @@
7068
ReferencedContainer = "container:WebP.xcodeproj">
7169
</BuildableReference>
7270
</MacroExpansion>
73-
<AdditionalOptions>
74-
</AdditionalOptions>
7571
</LaunchAction>
7672
<ProfileAction
7773
buildConfiguration = "Release"

0 commit comments

Comments
 (0)