Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(fix #52)Add integration tests for package managers #121

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,19 @@ jobs:
# -project "$PROJECT" \
# -scheme "$SCHEME" \
# -destination "$DESTINATION" | xcpretty

integration_tests_package_manager:
strategy:
fail-fast: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the test will pass even if build failed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. So what we actually need is set -o pipefail

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today I learned, thanks!

matrix:
package_manager: ['SPM', 'COCOAPODS', 'CARTHAGE']
runs-on: macos-latest
env:
PACKAGE_MANAGER: USE_${{matrix.package_manager}}
steps:
- uses: actions/checkout@v1
- name: integration_tests
run: |
cd IntegrationTests/package-manager
bash test.sh

2 changes: 2 additions & 0 deletions IntegrationTests/package-manager/test-carthage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Carthage/Checkouts
Carthage/Build/
1 change: 1 addition & 0 deletions IntegrationTests/package-manager/test-carthage/Cartfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git "/Users/xq.jin/Documents/dev/luoxiu/swift/CombineX"
luoxiu marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git "/Users/xq.jin/Documents/dev/luoxiu/swift/CombineX" "0.3.2"

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
//
// ContentView.swift
//
//
// Created by Quentin Jin on 2021/5/31.
//


import SwiftUI
import CombineX
import CXFoundation

private var cancellable: AnyCancellable?

struct ContentView: View {
@State
private var count = 1

@State
private var isRunning = false

var body: some View {
VStack {
Text("\(count)")
Button(isRunning ? "STOP" : "START") {
defer {
isRunning.toggle()
}

if isRunning {
cancellable?.cancel()
} else {
cancellable = CXWrappers.Timer
.publish(
every: 1,
on: .main,
in: .common
)
.autoconnect()
.sink(receiveValue: { _ in
count += 1
})
}
}
}
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchScreen</key>
<dict/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#! /usr/bin/env bash
luoxiu marked this conversation as resolved.
Show resolved Hide resolved


GIT_PATH=$(cd ../../../ && pwd)
echo "git \"${GIT_PATH}\"" >| 'Cartfile'

carthage update --platform ios --use-xcframeworks

xcodebuild -scheme test-carthage -project test-carthage.xcodeproj -sdk iphonesimulator
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// test_carthageApp.swift
//
//
// Created by Quentin Jin on 2021/5/31.
//


import SwiftUI

@main
struct test_carthageApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
12 changes: 12 additions & 0 deletions IntegrationTests/package-manager/test-carthage/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /usr/bin/env bash

GIT_PATH=$(cd ../../../ && pwd)
echo "git \"${GIT_PATH}\"" >| 'Cartfile'

carthage update --platform ios --use-xcframeworks

xcodebuild \
-scheme test-carthage \
-project test-carthage.xcodeproj \
-sdk iphonesimulator \
clean build | xcpretty
1 change: 1 addition & 0 deletions IntegrationTests/package-manager/test-cocoapods/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Pods/
12 changes: 12 additions & 0 deletions IntegrationTests/package-manager/test-cocoapods/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'test-cocoapods' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

# Pods for CocoaPods

pod 'CombineX/CXFoundation', :path => '../../../'

end
24 changes: 24 additions & 0 deletions IntegrationTests/package-manager/test-cocoapods/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PODS:
- CombineX/CXFoundation (0.3.2):
- CombineX/Main
- CombineX/CXLibc (0.3.2)
- CombineX/CXNamespace (0.3.2)
- CombineX/CXUtility (0.3.2)
- CombineX/Main (0.3.2):
- CombineX/CXLibc
- CombineX/CXNamespace
- CombineX/CXUtility

DEPENDENCIES:
- CombineX/CXFoundation (from `../../../`)

EXTERNAL SOURCES:
CombineX:
:path: "../../../"

SPEC CHECKSUMS:
CombineX: b53401095fde63464c26481ee7ef02be236e3735

PODFILE CHECKSUM: 3a29d190c4c632efb8197ec21c78a8e81ec206d6

COCOAPODS: 1.10.0
Loading