Skip to content

Commit

Permalink
CATTY-731 Move Unit Tests to Github Runners
Browse files Browse the repository at this point in the history
  • Loading branch information
wallisch committed Oct 18, 2024
1 parent 107de90 commit 5148796
Show file tree
Hide file tree
Showing 13 changed files with 192 additions and 199 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/scheduled-upload-crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ on:

jobs:
CrowdinUpload:
runs-on: macos-latest
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: develop
- name: Setup Ruby
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: unit-test

on:
pull_request:

jobs:
UnitTest:
runs-on: macos-14
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 15
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
working-directory: src
bundler-cache: true
- name: Test
run: cd src && bundle exec fastlane ios unittests
- name: Test Report
uses: test-summary/action@v2
if: always()
with:
paths: src/fastlane/test_output/report.junit
2 changes: 1 addition & 1 deletion src/.ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.3.0
3.3.5
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@
"identifier" : "CA7698A91B0E4A97000D0340",
"name" : "CattyTests"
}
},
{
"parallelizable" : true,
"target" : {
"containerPath" : "container:Catty.xcodeproj",
"identifier" : "AAADA0031B9B29D500E0CA9A",
"name" : "CattyUITests"
}
}
],
"version" : 1
Expand Down
42 changes: 42 additions & 0 deletions src/Catty.xcodeproj/UITests.xctestplan
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"configurations" : [
{
"id" : "1C9A3BFC-D3BD-40C9-B224-A0EBD3A4FDBF",
"name" : "Fastlane",
"options" : {
"diagnosticCollectionPolicy" : "Never",
"mainThreadCheckerEnabled" : false,
"maximumTestRepetitions" : 3,
"testRepetitionMode" : "retryOnFailure",
"uiTestingScreenshotsLifetime" : "keepNever",
"userAttachmentLifetime" : "keepNever"
}
}
],
"defaultOptions" : {
"codeCoverage" : false,
"environmentVariableEntries" : [
{
"enabled" : false,
"key" : "OS_ACTIVITY_MODE",
"value" : "disable"
}
],
"targetForVariableExpansion" : {
"containerPath" : "container:Catty.xcodeproj",
"identifier" : "CADBD6D319B0E8C200C62836",
"name" : "Catty"
}
},
"testTargets" : [
{
"parallelizable" : true,
"target" : {
"containerPath" : "container:Catty.xcodeproj",
"identifier" : "AAADA0031B9B29D500E0CA9A",
"name" : "CattyUITests"
}
}
],
"version" : 1
}
6 changes: 4 additions & 2 deletions src/Catty.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,7 @@
1764E6372A06CC940013102B /* SoundRecorderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SoundRecorderViewController.swift; sourceTree = "<group>"; };
17A8AC642644E6A900DDD480 /* ForceInit.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ForceInit.m; sourceTree = "<group>"; };
17A8AC6B2644E6B500DDD480 /* ForceInit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ForceInit.h; sourceTree = "<group>"; };
17C90C142CB74DA100303599 /* UITests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = UITests.xctestplan; path = Catty.xcodeproj/UITests.xctestplan; sourceTree = "<group>"; };
17D5F5BD265E927A00C678FF /* Keychain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Keychain.swift; path = Keychain/Keychain.swift; sourceTree = "<group>"; };
17D5F5BF265EAEF700C678FF /* KeychainTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeychainTests.swift; sourceTree = "<group>"; };
1801591D25E4D5CE00E5B673 /* FormulaEditorSectionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormulaEditorSectionViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3390,7 +3391,7 @@
7A7C5B407D7B4FD7DA1E1DBD /* hr */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.strings; name = hr; path = hr.lproj/Localizable.strings; sourceTree = "<group>"; };
7B014D0329E0ADE5004AA0E0 /* StoreAuthenticator.deleteUser.success.refresh.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = StoreAuthenticator.deleteUser.success.refresh.json; sourceTree = "<group>"; };
7B014D0429E0ADE5004AA0E0 /* StoreAuthenticator.deleteUser.success.upgrade.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = StoreAuthenticator.deleteUser.success.upgrade.json; sourceTree = "<group>"; };
7B014D0E29E7122E004AA0E0 /* CattyTestplan.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = CattyTestplan.xctestplan; path = Catty.xcodeproj/CattyTestplan.xctestplan; sourceTree = "<group>"; };
7B014D0E29E7122E004AA0E0 /* Tests.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = Tests.xctestplan; path = Catty.xcodeproj/Tests.xctestplan; sourceTree = "<group>"; };
7B09EB6529B1DF8200590F3D /* RegisterViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RegisterViewController.swift; sourceTree = "<group>"; };
7B09EB6629B1DF8200590F3D /* BaseAuthenticationViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseAuthenticationViewController.swift; sourceTree = "<group>"; };
7B09EB6729B1DF8200590F3D /* LoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -5077,7 +5078,8 @@
92FF32C11A24E33B00093DA7 /* Storyboard+XIB */,
29B97315FDCFA39411CA2CEA /* Supporting Files */,
B43498471927A3AB002F9075 /* Resources */,
7B014D0E29E7122E004AA0E0 /* CattyTestplan.xctestplan */,
7B014D0E29E7122E004AA0E0 /* Tests.xctestplan */,
17C90C142CB74DA100303599 /* UITests.xctestplan */,
B46B270317703F9400172837 /* CattyTests */,
AAADA0051B9B29D500E0CA9A /* CattyUITests */,
187E07A124E26CED00E652C4 /* CattyUISnapshots */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@
</MacroExpansion>
<TestPlans>
<TestPlanReference
reference = "container:Catty.xcodeproj/CattyTestplan.xctestplan"
reference = "container:Catty.xcodeproj/Tests.xctestplan"
default = "YES">
</TestPlanReference>
<TestPlanReference
reference = "container:Catty.xcodeproj/UITests.xctestplan">
</TestPlanReference>
</TestPlans>
<Testables>
<TestableReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ final class StagePresenterSideMenuViewTests: XCTestCase {
var view: StagePresenterSideMenuView!
var project: Project!
var delegateMock: StagePresenterSideMenuDelegate!
var dummyRect = CGRect(x: 0, y: 0, width: 1, height: 1)

override func setUp() {
super.setUp()
Expand All @@ -45,21 +46,21 @@ final class StagePresenterSideMenuViewTests: XCTestCase {
func testPortrait() {
project.header.landscapeMode = false

view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)
XCTAssertFalse(view.landscape)
}

func testLandscape() {
project.header.landscapeMode = true

view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)
XCTAssertTrue(view.landscape)
}

func testAspectRatioMinimize() {
project.header.screenMode = kCatrobatHeaderScreenModeMaximize

let view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
let view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)

XCTAssertNotNil(view.aspectRatioButton)
XCTAssertNotNil(view.aspectRatioLabel)
Expand All @@ -71,7 +72,7 @@ final class StagePresenterSideMenuViewTests: XCTestCase {
func testAspectRatioMaximize() {
project.header.screenMode = kCatrobatHeaderScreenModeStretch

let view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
let view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)

XCTAssertNotNil(view.aspectRatioButton)
XCTAssertNotNil(view.aspectRatioLabel)
Expand All @@ -85,7 +86,7 @@ final class StagePresenterSideMenuViewTests: XCTestCase {
project.header.screenWidth = NSNumber(value: Util.screenWidth(true))
project.header.screenHeight = NSNumber(value: Util.screenHeight(true))

let view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
let view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)

XCTAssertTrue(view.aspectRatioButton!.isHidden)
XCTAssertTrue(view.aspectRatioLabel!.isHidden)
Expand All @@ -96,7 +97,7 @@ final class StagePresenterSideMenuViewTests: XCTestCase {
project.header.screenHeight = NSNumber(value: Util.screenHeight(true))
project.header.landscapeMode = true

let view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
let view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)

XCTAssertFalse(view.aspectRatioButton!.isHidden)
XCTAssertTrue(view.aspectRatioLabel == nil)
Expand All @@ -107,14 +108,14 @@ final class StagePresenterSideMenuViewTests: XCTestCase {
project.header.screenHeight = NSNumber(value: Util.screenWidth(true))
project.header.landscapeMode = true

let view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
let view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)

XCTAssertTrue(view.aspectRatioButton!.isHidden)
XCTAssertTrue(view.aspectRatioLabel == nil)
}

func testRestart() {
let view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
let view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)
XCTAssertFalse(view.landscape)

project.header.landscapeMode = true
Expand All @@ -127,7 +128,7 @@ final class StagePresenterSideMenuViewTests: XCTestCase {
project.header.screenWidth = NSNumber(value: Util.screenWidth(true))
project.header.screenHeight = 10

let view = StagePresenterSideMenuView(frame: .zero, delegate: delegateMock)
let view = StagePresenterSideMenuView(frame: dummyRect, delegate: delegateMock)
XCTAssertFalse(view.aspectRatioButton!.isHidden)
XCTAssertFalse(view.aspectRatioLabel!.isHidden)

Expand Down
Loading

0 comments on commit 5148796

Please sign in to comment.