Skip to content
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
31 changes: 19 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,39 @@ env:
XCODE_PROJECT: "HackerTube.xcodeproj"
SCHEME: "HackerTube"
TEST_PLAN: UnitTests
TEST_RESULT_BUNDLE: "TestResults.xcresult"

# iOS Simulator configuration
TEST_PLATFORM: 'iOS Simulator'
TEST_DEVICE_TYPE: 'iPhone 16'

jobs:
build:
name: Build and Test on iOS Simulator
name: Test on ${{ matrix.name }}
runs-on: macos-latest

strategy:
fail-fast: false
matrix:
include:
- name: iOS Simulator
platform: 'iOS Simulator'
device_type: 'iPhone 17'
- name: tvOS Simulator
platform: 'tvOS Simulator'
device_type: 'Apple TV'

env:
TEST_DEVICE_NAME: 'TestDevice'
TEST_RESULT_BUNDLE: "TestResults.xcresult"

steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7

- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ env.XCODE_VERSION }}

- name: Create iOS Simulator
- name: Create ${{ matrix.platform }}
run: |
xcrun simctl create "${{ env.TEST_DEVICE_NAME }}" "${{ env.TEST_DEVICE_TYPE }}"
xcrun simctl create "${{ env.TEST_DEVICE_NAME }}" "${{ matrix.device_type }}"

- name: Test
run: |
Expand All @@ -45,11 +52,11 @@ jobs:
-scheme ${{ env.SCHEME }} \
-testPlan "${{ env.TEST_PLAN }}" \
-resultBundlePath "${{ env.TEST_RESULT_BUNDLE }}" \
-destination "platform=${{ env.TEST_PLATFORM }},name=${{ env.TEST_DEVICE_NAME }}"
-destination "platform=${{ matrix.platform }},name=${{ env.TEST_DEVICE_NAME }}"

- name: Upload test result bundle
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
if: ${{ failure() }}
with:
name: ${{ env.SCHEME }}-${{ env.TEST_PLAN }}-${{ github.sha }}.xcresult
name: ${{ env.SCHEME }}-${{ env.TEST_PLAN }}-${{ matrix.platform }}-${{ github.sha }}.xcresult
path: ${{ env.TEST_RESULT_BUNDLE }}
112 changes: 2 additions & 110 deletions HackerTube.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,6 @@
remoteGlobalIDString = D5A156D3289462B3006989FF;
remoteInfo = HackerTube;
};
D5EFB1A22B407683008CFE82 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = D5A156CC289462B3006989FF /* Project object */;
proxyType = 1;
remoteGlobalIDString = D5A156D3289462B3006989FF;
remoteInfo = HackerTube;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -59,9 +52,7 @@
D59139402895851300369402 /* TVServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = TVServices.framework; path = System/Library/Frameworks/TVServices.framework; sourceTree = SDKROOT; };
D591395928958B2600369402 /* HackerTubeTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HackerTubeTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
D5A156D4289462B3006989FF /* HackerTube.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HackerTube.app; sourceTree = BUILT_PRODUCTS_DIR; };
D5D2CB292D43EBB300E08E44 /* Screenshots.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = Screenshots.xctestplan; sourceTree = "<group>"; };
D5D2CB2A2D43EBB300E08E44 /* UnitTests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; path = UnitTests.xctestplan; sourceTree = "<group>"; };
D5EFB19C2B407683008CFE82 /* HackerTubeUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = HackerTubeUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
D5F872242DFC3F35002D2F28 /* AppIcon.icon */ = {isa = PBXFileReference; lastKnownFileType = folder.iconcomposer.icon; path = AppIcon.icon; sourceTree = "<group>"; };
/* End PBXFileReference section */

Expand Down Expand Up @@ -104,11 +95,6 @@
path = HackerTubeTests;
sourceTree = "<group>";
};
D5AFD7052C9BFD1100BF89F5 /* HackerTubeUITests */ = {
isa = PBXFileSystemSynchronizedRootGroup;
path = HackerTubeUITests;
sourceTree = "<group>";
};
/* End PBXFileSystemSynchronizedRootGroup section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -131,11 +117,6 @@
D5FCC6782FFC42DA00569E27 /* NanoSVG in Frameworks */,
);
};
D5EFB1992B407683008CFE82 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
files = (
);
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
Expand All @@ -151,15 +132,13 @@
isa = PBXGroup;
children = (
D557E8BA2896F70400342EE2 /* README.md */,
D5D2CB292D43EBB300E08E44 /* Screenshots.xctestplan */,
D5F872242DFC3F35002D2F28 /* AppIcon.icon */,
D5D2CB2A2D43EBB300E08E44 /* UnitTests.xctestplan */,
D5AFD6D92C9BFCF700BF89F5 /* HackerTube */,
D50C6F7328956D770003D1D0 /* CCCApi */,
D574ECF72FFC42FA0050AF63 /* NanoSVG */,
D5AFD6FB2C9BFCFB00BF89F5 /* TopShelf */,
D5AFD7022C9BFD0F00BF89F5 /* HackerTubeTests */,
D5AFD7052C9BFD1100BF89F5 /* HackerTubeUITests */,
D5A156D5289462B3006989FF /* Products */,
D50C6F7428956DFC0003D1D0 /* Frameworks */,
);
Expand All @@ -173,7 +152,6 @@
D5A156D4289462B3006989FF /* HackerTube.app */,
D591393F2895851300369402 /* TopShelf.appex */,
D591395928958B2600369402 /* HackerTubeTests.xctest */,
D5EFB19C2B407683008CFE82 /* HackerTubeUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -249,27 +227,6 @@
productReference = D5A156D4289462B3006989FF /* HackerTube.app */;
productType = "com.apple.product-type.application";
};
D5EFB19B2B407683008CFE82 /* HackerTubeUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = D5EFB1A62B407683008CFE82 /* Build configuration list for PBXNativeTarget "HackerTubeUITests" */;
buildPhases = (
D5EFB1982B407683008CFE82 /* Sources */,
D5EFB1992B407683008CFE82 /* Frameworks */,
D5EFB19A2B407683008CFE82 /* Resources */,
);
buildRules = (
);
dependencies = (
D5EFB1A32B407683008CFE82 /* PBXTargetDependency */,
);
fileSystemSynchronizedGroups = (
D5AFD7052C9BFD1100BF89F5 /* HackerTubeUITests */,
);
name = HackerTubeUITests;
productName = HackerTubeUITests;
productReference = D5EFB19C2B407683008CFE82 /* HackerTubeUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
Expand All @@ -290,10 +247,6 @@
D5A156D3289462B3006989FF = {
CreatedOnToolsVersion = 13.4.1;
};
D5EFB19B2B407683008CFE82 = {
CreatedOnToolsVersion = 15.1;
TestTargetID = D5A156D3289462B3006989FF;
};
};
};
buildConfigurationList = D5A156CF289462B3006989FF /* Build configuration list for PBXProject "HackerTube" */;
Expand All @@ -317,7 +270,6 @@
D5A156D3289462B3006989FF /* HackerTube */,
D591393E2895851300369402 /* TopShelf */,
D591395828958B2600369402 /* HackerTubeTests */,
D5EFB19B2B407683008CFE82 /* HackerTubeUITests */,
);
};
/* End PBXProject section */
Expand All @@ -339,11 +291,6 @@
D5F872252DFC3F3F002D2F28 /* AppIcon.icon in Resources */,
);
};
D5EFB19A2B407683008CFE82 /* Resources */ = {
isa = PBXResourcesBuildPhase;
files = (
);
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand All @@ -362,11 +309,6 @@
files = (
);
};
D5EFB1982B407683008CFE82 /* Sources */ = {
isa = PBXSourcesBuildPhase;
files = (
);
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
Expand All @@ -383,11 +325,6 @@
target = D5A156D3289462B3006989FF /* HackerTube */;
targetProxy = D591395D28958B2600369402 /* PBXContainerItemProxy */;
};
D5EFB1A32B407683008CFE82 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = D5A156D3289462B3006989FF /* HackerTube */;
targetProxy = D5EFB1A22B407683008CFE82 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
Expand Down Expand Up @@ -628,6 +565,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = HackerTube/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = HackerTube;
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.video";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand Down Expand Up @@ -669,6 +607,7 @@
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = HackerTube/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = HackerTube;
INFOPLIST_KEY_ITSAppUsesNonExemptEncryption = NO;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.video";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
Expand All @@ -691,45 +630,6 @@
};
name = Release;
};
D5EFB1A42B407683008CFE82 /* Debug configuration for PBXNativeTarget "HackerTubeUITests" */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GENERATE_INFOPLIST_FILE = YES;
PRODUCT_BUNDLE_IDENTIFIER = nl.bernson.CCCTubeUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2,3";
TEST_TARGET_NAME = HackerTube;
};
name = Debug;
};
D5EFB1A52B407683008CFE82 /* Release configuration for PBXNativeTarget "HackerTubeUITests" */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES;
GCC_C_LANGUAGE_STANDARD = gnu17;
GENERATE_INFOPLIST_FILE = YES;
PRODUCT_BUNDLE_IDENTIFIER = nl.bernson.CCCTubeUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SDKROOT = auto;
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator";
SUPPORTS_MACCATALYST = NO;
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2,3";
TEST_TARGET_NAME = HackerTube;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
Expand Down Expand Up @@ -765,14 +665,6 @@
);
defaultConfigurationName = Release;
};
D5EFB1A62B407683008CFE82 /* Build configuration list for PBXNativeTarget "HackerTubeUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
D5EFB1A42B407683008CFE82 /* Debug configuration for PBXNativeTarget "HackerTubeUITests" */,
D5EFB1A52B407683008CFE82 /* Release configuration for PBXNativeTarget "HackerTubeUITests" */,
);
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
Expand Down
2 changes: 0 additions & 2 deletions HackerTube/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
</array>
</dict>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
Expand Down
27 changes: 16 additions & 11 deletions HackerTubeTests/URLParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,32 @@
// Created by Mathijs Bernson on 30/07/2022.
//

import XCTest
import Foundation
import Testing

@testable import HackerTube

class URLParserTests: XCTestCase {
struct URLParserTests {
let parser = URLParser()

func testParseOpenURL() {
@Test func `Parse open URL`() {
let url = URL(string: "ccctube://talk/44ab627f-ed5d-522b-b84b-15a3ed761895")!
XCTAssertEqual(parser.parseURL(url), .openTalk(id: "44ab627f-ed5d-522b-b84b-15a3ed761895"))
#expect(parser.parseURL(url) == .openTalk(id: "44ab627f-ed5d-522b-b84b-15a3ed761895"))
}

func testParsePlayURL() {
@Test func `Parse play URL`() {
let url = URL(string: "ccctube://talk/44ab627f-ed5d-522b-b84b-15a3ed761895/play")!
XCTAssertEqual(parser.parseURL(url), .playTalk(id: "44ab627f-ed5d-522b-b84b-15a3ed761895"))
#expect(parser.parseURL(url) == .playTalk(id: "44ab627f-ed5d-522b-b84b-15a3ed761895"))
}

func testInvalidURLs() {
XCTAssertNil(parser.parseURL(URL(string: "ccctube://")!))
XCTAssertNil(parser.parseURL(URL(string: "https://google.com/")!))
XCTAssertNil(parser.parseURL(URL(string: "ccctube://foo")!))
XCTAssertNil(parser.parseURL(URL(string: "mailto:info@example.com")!))
@Test(arguments: [
"ccctube://",
"https://google.com/",
"ccctube://foo",
"mailto:info@example.com",
])
func `Invalid URLs`(urlString: String) throws {
let url = try #require(URL(string: urlString))
#expect(parser.parseURL(url) == nil)
}
}
Loading