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

CI SPM caching #1379

Merged
merged 6 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 8 additions & 0 deletions .github/workflows/uitests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ jobs:
restore-keys: |
${{ runner.os }}-pods-

- uses: actions/cache@v3
with:
path: SourcePackages
key: ${{ runner.os }}-spm-${{ hashFiles('NextcloudTalk.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-

- name: Install docker
run: |
brew install docker
Expand Down Expand Up @@ -80,6 +87,7 @@ jobs:
-test-iterations 3 \
-retry-tests-on-failure \
-resultBundlePath "testResult.xcresult" \
-clonedSourcePackagesDirPath SourcePackages \
| xcpretty

- name: Upload test results
Expand Down
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ Podfile.lock
NextcloudTalk.xcodeproj/xcuserdata
NextcloudTalk.xcodeproj/xcshareddata
NextcloudTalk.xcworkspace/xcuserdata
NextcloudTalk.xcworkspace/xcshareddata
ThirdParty/WebRTC.xcframework
.DS_Store
testResult.xcresult

# Include the resolved spm configuration, so "Package.resolved" can be used for caching
NextcloudTalk.xcworkspace/**
!NextcloudTalk.xcworkspace/xcshareddata/
!NextcloudTalk.xcworkspace/xcshareddata/swiftpm
!NextcloudTalk.xcworkspace/xcshareddata/swiftpm/**

# Exclude SPM cache on CI
SourcePackages
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ identifier_name:
excluded:
- Pods
- ThirdParty
- SourcePackages

reporter: "xcode"

86 changes: 45 additions & 41 deletions NextcloudTalk.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

164 changes: 164 additions & 0 deletions NextcloudTalk.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"pins" : [
{
"identity" : "alamofire",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Alamofire/Alamofire",
"state" : {
"revision" : "b2fa556e4e48cbf06cf8c63def138c98f4b811fa",
"version" : "5.8.0"
}
},
{
"identity" : "cdmarkdownkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nextcloud-deps/CDMarkdownKit.git",
"state" : {
"revision" : "58082fa7952b4bf8f5e46b3ddc5be4d8ba28a5b5"
}
},
{
"identity" : "cocoalumberjack",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CocoaLumberjack/CocoaLumberjack.git",
"state" : {
"revision" : "67ec5818a757aba4d7c534e21a905d878d128dbf",
"version" : "3.8.1"
}
},
{
"identity" : "dynamic",
"kind" : "remoteSourceControl",
"location" : "https://github.com/mhdhejazi/Dynamic.git",
"state" : {
"revision" : "ab9a2570862d54aed2663691bb767f881226a12f",
"version" : "1.2.0"
}
},
{
"identity" : "nextcloudkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nextcloud/NextcloudKit",
"state" : {
"revision" : "0d694aa234210f7c85ab41b05d1429ad0eb50266",
"version" : "1.6.0"
}
},
{
"identity" : "openssl",
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/OpenSSL",
"state" : {
"revision" : "9429bf89fe0df2d2f25f3a9a51cbf7092e69640f",
"version" : "1.1.1700"
}
},
{
"identity" : "qrcodereader.swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/yannickl/QRCodeReader.swift",
"state" : {
"revision" : "5020b5a47199d8ba80c83a4b4fafd70e9dc9dc7f",
"version" : "10.1.1"
}
},
{
"identity" : "realm-core",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-core.git",
"state" : {
"revision" : "f1e962cd447f8b69f8f7cf46a188b1c6246923c5",
"version" : "13.17.0"
}
},
{
"identity" : "realm-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/realm-swift.git",
"state" : {
"revision" : "0155caac1a0830a9fbaaffe5866b909fad3a6fc4",
"version" : "10.41.1"
}
},
{
"identity" : "sdwebimage",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImage.git",
"state" : {
"revision" : "3289629ef6cbf1ad8c3d1dccf0cf09ac97547cd6",
"version" : "5.15.7"
}
},
{
"identity" : "sdwebimagesvgkitplugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SDWebImage/SDWebImageSVGKitPlugin.git",
"state" : {
"revision" : "fb16805b772d9a1dfa31a7665f64a557f3b52781",
"version" : "1.4.0"
}
},
{
"identity" : "svgkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SVGKit/SVGKit.git",
"state" : {
"revision" : "58152b9f7c85eab239160b36ffdfd364aa43d666",
"version" : "3.0.0"
}
},
{
"identity" : "swift-log",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-log.git",
"state" : {
"revision" : "532d8b529501fb73a2455b179e0bbb6d49b652ed",
"version" : "1.5.3"
}
},
{
"identity" : "swiftyattributes",
"kind" : "remoteSourceControl",
"location" : "https://github.com/eddiekaiger/SwiftyAttributes.git",
"state" : {
"revision" : "1ae513a1617309455a115c3fc2d558f744b43788"
}
},
{
"identity" : "swiftyjson",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SwiftyJSON/SwiftyJSON",
"state" : {
"revision" : "b3dcd7dbd0d488e1a7077cb33b00f2083e382f07",
"version" : "5.0.1"
}
},
{
"identity" : "swiftyxmlparser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/yahoojapan/SwiftyXMLParser",
"state" : {
"revision" : "d7a1d23f04c86c1cd2e8f19247dd15d74e0ea8be",
"version" : "5.6.0"
}
},
{
"identity" : "talk-clients-webrtc",
"kind" : "remoteSourceControl",
"location" : "https://github.com/nextcloud-releases/talk-clients-webrtc",
"state" : {
"revision" : "fd8f88a4243f31760617524b8ca86d71e9c903a7"
}
},
{
"identity" : "tocropviewcontroller",
"kind" : "remoteSourceControl",
"location" : "https://github.com/TimOliver/TOCropViewController",
"state" : {
"revision" : "d0470491f56e734731bbf77991944c0dfdee3e0e",
"version" : "2.6.1"
}
}
],
"version" : 2
}
40 changes: 30 additions & 10 deletions NextcloudTalkUITests/NextcloudTalkUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ final class NextcloudTalkUITests: XCTestCase {
waitForExpectations(timeout: timeoutLong, handler: nil)
}

// Based on https://stackoverflow.com/a/47947315
@discardableResult
func waitForEitherElementToExist(_ elementA: XCUIElement, _ elementB: XCUIElement, _ timeout: TimeInterval) -> XCUIElement? {
let startTime = NSDate.timeIntervalSinceReferenceDate
while !elementA.exists && !elementB.exists { // while neither element exists
if NSDate.timeIntervalSinceReferenceDate - startTime > timeout {
XCTFail("Timed out waiting for either element to exist.")
break
}
sleep(1)
}

if elementA.exists { return elementA }
if elementB.exists { return elementB }
return nil
}

func launchAndLogin() -> XCUIApplication {
let app = XCUIApplication()
app.launchArguments += ["-AppleLanguages", "(en-US)"]
Expand All @@ -58,17 +75,16 @@ final class NextcloudTalkUITests: XCTestCase {
app.launch()

let accountSwitcherButton = app.buttons["Nextcloud Talk"]
let serverAddressHttpsTextField = app.textFields["Server address https://…"]

// Wait shortly until the app is fully started
_ = accountSwitcherButton.waitForExistence(timeout: timeoutShort)
let foundElement = waitForEitherElementToExist(accountSwitcherButton, serverAddressHttpsTextField, timeoutLong)

// When the account switcher button exists, we have atleast one account configured
if accountSwitcherButton.exists {
if foundElement == accountSwitcherButton {
return app
}

let serverAddressHttpsTextField = app.textFields["Server address https://…"]
XCTAssert(serverAddressHttpsTextField.waitForExistence(timeout: timeoutLong))
serverAddressHttpsTextField.tap()
serverAddressHttpsTextField.typeText(server)

Expand All @@ -77,15 +93,19 @@ final class NextcloudTalkUITests: XCTestCase {
loginButton.tap()

let webViewsQuery = app.webViews.webViews.webViews
let loginButton2 = webViewsQuery.buttons["Log in"]
let main = webViewsQuery.otherElements["main"]

// Wait for the login button to be available and to get enabled
XCTAssert(loginButton2.waitForExistence(timeout: timeoutLong))
waitForEnabled(object: loginButton2)
// Wait for the webview to be available
XCTAssert(main.waitForExistence(timeout: timeoutLong))

loginButton2.tap()
// Wait for the login button to be available and to get enabled/hittable
let loginButtonWeb = webViewsQuery.buttons["Log in"]
XCTAssert(loginButtonWeb.waitForExistence(timeout: timeoutLong))
waitForEnabled(object: loginButtonWeb)
waitForHittable(object: loginButtonWeb)

loginButtonWeb.tap()

let main = webViewsQuery.otherElements["main"]
XCTAssert(main.waitForExistence(timeout: timeoutLong))

let usernameTextField = main.descendants(matching: .textField).firstMatch
Expand Down
7 changes: 0 additions & 7 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ pod 'UICKeyChainStore'
pod 'MaterialComponents/ActivityIndicator'
pod 'Toast', '~> 4.0.0'
pod 'MBProgressHUD', '~> 1.2.0'
pod 'TOCropViewController', '~> 2.6.0'
pod 'libPhoneNumber-iOS'
pod 'MZTimerLabel'
pod 'MobileVLCKit', '~>3.3.0'
Expand All @@ -24,17 +23,11 @@ target "ShareExtension" do
pod 'AFNetworking', "3.2.0"
pod 'UICKeyChainStore'
pod 'MBProgressHUD', '~> 1.2.0'
pod 'TOCropViewController', '~> 2.6.0'
end

pre_install do |installer|
puts 'pre_install begin....'

if not File.directory?("ThirdParty/WebRTC.xcframework")
puts 'WebRTC not found in folder ThirdParty, fetching...'
system("./download_webrtc.sh")
end

puts 'Update submodules...'
system('git submodule update --init')

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ You got stuck while working on a issue or need some pointers? Feel free to ask i
We are using our own builds of the WebRTC library. They can be found in this [repository](https://github.com/nextcloud-releases/talk-clients-webrtc).

Current version: [116.5845.0](https://github.com/nextcloud-releases/talk-clients-webrtc/releases/tag/116.5845.0).
\
Update the download URL in `download_webrtc.sh` for newer versions.

## Running tests locally

Expand Down
2 changes: 1 addition & 1 deletion ShareExtension/ShareConfirmationViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#import <AVFoundation/AVFoundation.h>
#import <QuickLook/QuickLook.h>
#import <QuickLookThumbnailing/QuickLookThumbnailing.h>
#import <TOCropViewController/TOCropViewController.h>

#import "CCCertificate.h"
#import "NCAPIController.h"
Expand All @@ -39,6 +38,7 @@
#import "NCUserDefaults.h"
#import "NCUtils.h"
#import "MBProgressHUD.h"
#import "TOCropViewController.h"

#import "NextcloudTalk-Swift.h"

Expand Down
13 changes: 0 additions & 13 deletions download_webrtc.sh

This file was deleted.

Loading