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
30 changes: 29 additions & 1 deletion .github/workflows/BuildPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,34 @@ jobs:
- name: Unlink openssl 3
run: |
brew unlink openssl@3
- name: Checkout fixed repo snapshot for screenshots
run: |
git clone --no-checkout "$GITHUB_WORKSPACE" /tmp/gitx-screenshot-repo
git -C /tmp/gitx-screenshot-repo checkout 52ff1051d0c8e5cf3ee5
- name: Run tests
run: |
xcodebuild test \
-workspace GitX.xcworkspace \
-scheme GitX \
-destination "platform=macOS,arch=${{ matrix.abi }}" \
ARCHS="${{ matrix.abi }}" \
CODE_SIGN_IDENTITY="-" \
GITX_SCREENSHOT_REPO=/tmp/gitx-screenshot-repo \
-resultBundlePath TestResults-${{ matrix.abi }}.xcresult
- name: Extract screenshots from test results
if: always()
run: |
python3 scripts/extract_screenshots.py \
TestResults-${{ matrix.abi }}.xcresult \
screenshots-${{ matrix.abi }}
ls -la screenshots-${{ matrix.abi }}
- name: Upload screenshots
if: always()
uses: actions/upload-artifact@v4
with:
name: Screenshots-${{ matrix.abi }}
path: screenshots-${{ matrix.abi }}

- name: Build project
run: xcodebuild -workspace GitX.xcworkspace -scheme GitX -archivePath ./GitX archive ARCHS="${{ matrix.abi }}" PRODUCT_BUNDLE_IDENTIFIER=net.phere.GitX
- name: Prepare artifact
Expand Down Expand Up @@ -150,7 +178,7 @@ jobs:
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.provisionprofile

release:
if: startsWith(github.event.ref, 'refs/tags/')
needs: build-gitx
Expand Down
23 changes: 23 additions & 0 deletions Classes/Controllers/ApplicationController.m
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ - (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
if (!started || [[[NSDocumentController sharedDocumentController] documents] count])
return NO;
// Suppress the recents dialog during UI tests so the test-repo window
// opens cleanly without a competing sheet/panel.
if ([[[NSProcessInfo processInfo] environment] objectForKey:@"GITX_UITEST_REPO"])
return NO;
return YES;
}

Expand All @@ -121,6 +125,25 @@ - (void)applicationDidFinishLaunching:(NSNotification *)notification
[NSApp registerObserverForAppearanceChanges:self];
[self registerServices];
started = YES;

// UI-test hook: open a repo path passed via environment variable so that
// XCUITests always get a document window without relying on recents or
// Launch Services registration.
NSDictionary *env = [[NSProcessInfo processInfo] environment];
NSString *uitestRepo = env[@"GITX_UITEST_REPO"];
if (uitestRepo.length > 0) {
NSURL *repoURL = [NSURL fileURLWithPath:uitestRepo];
PBRepositoryDocumentController *controller = [PBRepositoryDocumentController sharedDocumentController];
// Defer to the next run-loop iteration so the app is fully initialised.
dispatch_async(dispatch_get_main_queue(), ^{
[controller openDocumentWithContentsOfURL:repoURL
display:YES
completionHandler:^(NSDocument *document, BOOL documentWasAlreadyOpen, NSError *error) {
if (!document)
NSLog(@"[UITest] Failed to open repo %@: %@", uitestRepo, error);
}];
});
}
}

- (void)windowWillClose:sender
Expand Down
4 changes: 4 additions & 0 deletions GitX.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@

CODE_SIGN_IDENTITY = -

// Default repo for UI screenshot tests. Override on CI via:
// xcodebuild ... GITX_SCREENSHOT_REPO=/tmp/gitx-screenshot-repo
GITX_SCREENSHOT_REPO = $(SRCROOT)

#include? "Dev.xcconfig"
94 changes: 94 additions & 0 deletions GitX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
CC0000010000001 /* GitXScreenshotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CC0000020000002 /* GitXScreenshotTests.m */; };
0A6858C711F7EA8A00AC2BE4 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A6858C611F7EA8A00AC2BE4 /* CoreServices.framework */; };
2682AABB1929140E00271A4D /* GTOID+JavaScript.m in Sources */ = {isa = PBXBuildFile; fileRef = 2682AABA1929140E00271A4D /* GTOID+JavaScript.m */; };
2DE9B60629ABEB450097873A /* GitX.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 2DE9B60529ABEB450097873A /* GitX.xcconfig */; };
Expand Down Expand Up @@ -414,6 +415,13 @@
remoteGlobalIDString = 721C24451CB753E6005440CB;
remoteInfo = "Installer Progress";
};
CC000007B000007 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 29B97313FDCFA39411CA2CEA /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8D1107260486CEB800E47090;
remoteInfo = GitX;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -432,6 +440,8 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
CC0000020000002 /* GitXScreenshotTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GitXScreenshotTests.m; sourceTree = "<group>"; };
CC0000030000003 /* GitXUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GitXUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
0A6858C611F7EA8A00AC2BE4 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
2682AAB91929140E00271A4D /* GTOID+JavaScript.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTOID+JavaScript.h"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -745,6 +755,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
CC0000060000006 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
Expand All @@ -754,10 +771,20 @@
8D1107320486CEB800E47090 /* GitX.app */,
913D5E490E55644600CECEA2 /* gitx */,
551BF111112F371800265053 /* gitx_askpasswd */,
CC0000030000003 /* GitXUITests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
CC0000040000004 /* GitXUITests */ = {
isa = PBXGroup;
children = (
CC0000020000002 /* GitXScreenshotTests.m */,
);
name = GitXUITests;
path = GitXUITests;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* GitTest */ = {
isa = PBXGroup;
children = (
Expand All @@ -767,6 +794,7 @@
4A5D762114A9A9CC00DF6C68 /* Classes */,
4A5D773E14A9AB3A00DF6C68 /* External Sources */,
4A5D757C14A9A90500DF6C68 /* Resources */,
CC0000040000004 /* GitXUITests */,
37A5656C1EAD077400CA0332 /* cli tool */,
37A5656D1EAD07C200CA0332 /* gitx_askpasswd */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
Expand Down Expand Up @@ -1268,6 +1296,23 @@
productReference = 913D5E490E55644600CECEA2 /* gitx */;
productType = "com.apple.product-type.tool";
};
CC000008A000008 /* GitXUITests */ = {
isa = PBXNativeTarget;
buildConfigurationList = CC000009A000009 /* Build configuration list for PBXNativeTarget "GitXUITests" */;
buildPhases = (
CC0000050000005 /* Sources */,
CC0000060000006 /* Frameworks */,
);
buildRules = (
);
dependencies = (
CC000007A000007 /* PBXTargetDependency */,
);
name = GitXUITests;
productName = GitXUITests;
productReference = CC0000030000003 /* GitXUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
Expand Down Expand Up @@ -1309,6 +1354,7 @@
913D5E480E55644600CECEA2 /* cli tool */,
551BF110112F371800265053 /* gitx_askpasswd */,
4D3F252B18C37D2E000922D9 /* Generate Scripting Header */,
CC000008A000008 /* GitXUITests */,
);
};
/* End PBXProject section */
Expand Down Expand Up @@ -1715,6 +1761,14 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
CC0000050000005 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
CC0000010000001 /* GitXScreenshotTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
Expand Down Expand Up @@ -1758,6 +1812,11 @@
target = 551BF110112F371800265053 /* gitx_askpasswd */;
targetProxy = 551BF174112F3F3500265053 /* PBXContainerItemProxy */;
};
CC000007A000007 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8D1107260486CEB800E47090 /* GitX */;
targetProxy = CC000007B000007 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
Expand Down Expand Up @@ -2065,9 +2124,44 @@
};
name = Release;
};
CC00000AA00000A /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
GENERATE_INFOPLIST_FILE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_BUNDLE_IDENTIFIER = net.phere.GitXUITests;
PRODUCT_NAME = GitXUITests;
SDKROOT = macosx;
TEST_TARGET_NAME = GitX;
};
name = Debug;
};
CC00000BA00000B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
GENERATE_INFOPLIST_FILE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_BUNDLE_IDENTIFIER = net.phere.GitXUITests;
PRODUCT_NAME = GitXUITests;
SDKROOT = macosx;
TEST_TARGET_NAME = GitX;
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
CC000009A000009 /* Build configuration list for PBXNativeTarget "GitXUITests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
CC00000AA00000A /* Debug */,
CC00000BA00000B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
26FC0A840875C7B200E6366F /* Build configuration list for PBXNativeTarget "GitX" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
57 changes: 56 additions & 1 deletion GitX.xcodeproj/xcshareddata/xcschemes/GitX.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,41 @@
ReferencedContainer = "container:GitX.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BBCCDDA000000A00"
BuildableName = "GitXTests.xctest"
BlueprintName = "GitXTests"
ReferencedContainer = "container:GitX.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CC000008A000008"
BuildableName = "GitXUITests.xctest"
BlueprintName = "GitXUITests"
ReferencedContainer = "container:GitX.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -36,7 +64,34 @@
ReferencedContainer = "container:GitX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "GITX_UITEST_REPO"
value = "$(GITX_SCREENSHOT_REPO)"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "BBCCDDA000000A00"
BuildableName = "GitXTests.xctest"
BlueprintName = "GitXTests"
ReferencedContainer = "container:GitX.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "CC000008A000008"
BuildableName = "GitXUITests.xctest"
BlueprintName = "GitXUITests"
ReferencedContainer = "container:GitX.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Loading
Loading