From d98019cd595e97622aadb2fa55b32723567a754c Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:06:22 -0500 Subject: [PATCH 1/9] Add GitHub Action to run tests on PR and master --- .github/workflows/test.yml | 50 +++++++++++++++++++ .travis.yml | 3 -- GitUpKit/Core/GCTestCase.m | 4 +- .../xcschemes/GitUpKit (macOS).xcscheme | 5 ++ README.md | 2 +- travis-build.sh | 27 ---------- 6 files changed, 58 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml delete mode 100755 travis-build.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..77b1687c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,50 @@ +name: GitUpKit Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Run GitUpKit Tests + runs-on: macos-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Select Xcode version + run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer + + - name: Show Xcode version + run: xcodebuild -version + + - name: Install xcpretty + run: gem install xcpretty + + - name: Run GitUpKit (macOS) tests + working-directory: GitUpKit + run: | + set -o pipefail + xcodebuild test \ + -scheme "GitUpKit (macOS)" \ + -destination "platform=macOS" \ + -resultBundlePath TestResults \ + 2>&1 | xcpretty --color + + - name: Upload test results + uses: actions/upload-artifact@v4 + if: failure() + with: + name: test-results + path: GitUpKit/TestResults + retention-days: 7 + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 82d0f389..00000000 --- a/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: objective-c -script: ./travis-build.sh -osx_image: xcode10.3 diff --git a/GitUpKit/Core/GCTestCase.m b/GitUpKit/Core/GCTestCase.m index a514ae37..a1a8dbd2 100644 --- a/GitUpKit/Core/GCTestCase.m +++ b/GitUpKit/Core/GCTestCase.m @@ -31,8 +31,8 @@ @implementation GCTestCase - (void)setUp { [super setUp]; - // Figure out if running as Xcode Server bot or under Travis CI - _botMode = [NSUserName() isEqualToString:@"_xcsbuildd"] || getenv("TRAVIS"); + // Figure out if running as Xcode Server bot or GitHub Actions + _botMode = [NSUserName() isEqualToString:@"_xcsbuildd"] || getenv("GITHUB_ACTIONS"); } - (GCRepository*)createLocalRepositoryAtPath:(NSString*)path bare:(BOOL)bare { diff --git a/GitUpKit/GitUpKit.xcodeproj/xcshareddata/xcschemes/GitUpKit (macOS).xcscheme b/GitUpKit/GitUpKit.xcodeproj/xcshareddata/xcschemes/GitUpKit (macOS).xcscheme index 9d3228f2..26bb0e2e 100644 --- a/GitUpKit/GitUpKit.xcodeproj/xcshareddata/xcschemes/GitUpKit (macOS).xcscheme +++ b/GitUpKit/GitUpKit.xcodeproj/xcshareddata/xcschemes/GitUpKit (macOS).xcscheme @@ -45,6 +45,11 @@ BlueprintName = "Tests" ReferencedContainer = "container:GitUpKit.xcodeproj"> + + + + diff --git a/README.md b/README.md index 575410b9..458528e2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://travis-ci.org/git-up/GitUp.svg?branch=master)](https://travis-ci.org/git-up/GitUp) +[![Build Status](https://github.com/git-up/GitUp/actions/workflows/test.yml/badge.svg)](https://github.com/git-up/GitUp/actions/workflows/test.yml) GitUp ===== diff --git a/travis-build.sh b/travis-build.sh deleted file mode 100755 index 7cefc812..00000000 --- a/travis-build.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -ex - -# Run GitUpKit unit tests -pushd "GitUpKit" -xcodebuild test -scheme "GitUpKit (macOS)" -popd - -# Build GitUp without signing -pushd "GitUp" -xcodebuild build -scheme "Application" -configuration "Release" "CODE_SIGN_IDENTITY=" > /dev/null -popd - -# Build OS X examples -pushd "Examples/GitDown" -xcodebuild build -scheme "GitDown" -sdk "macosx" -configuration "Release" > /dev/null -popd -pushd "Examples/GitDiff" -xcodebuild build -scheme "GitDiff" -sdk "macosx" -configuration "Release" > /dev/null -popd -pushd "Examples/GitY" -xcodebuild build -scheme "GitY" -sdk "macosx" -configuration "Release" > /dev/null -popd - -# Build iOS example -pushd "Examples/iGit" -xcodebuild build -scheme "iGit" -sdk "iphonesimulator" -configuration "Release" > /dev/null -popd From 560621ce99ca541af3946ada55484fce30162c3d Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:09:11 -0500 Subject: [PATCH 2/9] Remove xcpretty --- .github/workflows/test.yml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77b1687c..d2ae096b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -27,24 +27,10 @@ jobs: - name: Show Xcode version run: xcodebuild -version - - name: Install xcpretty - run: gem install xcpretty - - name: Run GitUpKit (macOS) tests working-directory: GitUpKit run: | - set -o pipefail xcodebuild test \ -scheme "GitUpKit (macOS)" \ - -destination "platform=macOS" \ - -resultBundlePath TestResults \ - 2>&1 | xcpretty --color - - - name: Upload test results - uses: actions/upload-artifact@v4 - if: failure() - with: - name: test-results - path: GitUpKit/TestResults - retention-days: 7 + -destination "platform=macOS" From fba80a9913122d9559ceecdd1c678fdd7e41ce0f Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:11:13 -0500 Subject: [PATCH 3/9] Include submodules --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2ae096b..cf0ad241 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,6 +20,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + submodules: true - name: Select Xcode version run: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer From 9740c0682e433ca178ce87bc43e3581797ab9a47 Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:12:43 -0500 Subject: [PATCH 4/9] Disable codesigning on tests --- .github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf0ad241..023d95cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,5 +34,8 @@ jobs: run: | xcodebuild test \ -scheme "GitUpKit (macOS)" \ - -destination "platform=macOS" + -destination "platform=macOS" \ + CODE_SIGN_IDENTITY="" \ + CODE_SIGNING_REQUIRED=NO \ + CODE_SIGNING_ALLOWED=NO From c366894a8a17f1f4674d0af4cc997fd4d1ea39a7 Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:24:05 -0500 Subject: [PATCH 5/9] Maybe add CI env check --- .github/workflows/test.yml | 2 ++ GitUpKit/Core/GCTestCase.m | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 023d95cd..916c5a4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,8 @@ jobs: - name: Run GitUpKit (macOS) tests working-directory: GitUpKit + env: + CI: true run: | xcodebuild test \ -scheme "GitUpKit (macOS)" \ diff --git a/GitUpKit/Core/GCTestCase.m b/GitUpKit/Core/GCTestCase.m index a1a8dbd2..91b79084 100644 --- a/GitUpKit/Core/GCTestCase.m +++ b/GitUpKit/Core/GCTestCase.m @@ -31,8 +31,8 @@ @implementation GCTestCase - (void)setUp { [super setUp]; - // Figure out if running as Xcode Server bot or GitHub Actions - _botMode = [NSUserName() isEqualToString:@"_xcsbuildd"] || getenv("GITHUB_ACTIONS"); + // Figure out if running as Xcode Server bot or CI + _botMode = [NSUserName() isEqualToString:@"_xcsbuildd"] || (getenv("CI") != NULL); } - (GCRepository*)createLocalRepositoryAtPath:(NSString*)path bare:(BOOL)bare { From de949356f335a3d7bd6cc1de7a87b7d53a7c5e56 Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:29:33 -0500 Subject: [PATCH 6/9] Make sure badge is for master and try passing user flag explicitly to xcodebuild --- .github/workflows/test.yml | 5 ++--- GitUpKit/Core/GCTestCase.m | 2 +- README.md | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 916c5a4a..438a8d57 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,13 +31,12 @@ jobs: - name: Run GitUpKit (macOS) tests working-directory: GitUpKit - env: - CI: true run: | xcodebuild test \ -scheme "GitUpKit (macOS)" \ -destination "platform=macOS" \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO \ - CODE_SIGNING_ALLOWED=NO + CODE_SIGNING_ALLOWED=NO \ + GITHUB_ACTION=YES diff --git a/GitUpKit/Core/GCTestCase.m b/GitUpKit/Core/GCTestCase.m index 91b79084..50ab4753 100644 --- a/GitUpKit/Core/GCTestCase.m +++ b/GitUpKit/Core/GCTestCase.m @@ -32,7 +32,7 @@ - (void)setUp { [super setUp]; // Figure out if running as Xcode Server bot or CI - _botMode = [NSUserName() isEqualToString:@"_xcsbuildd"] || (getenv("CI") != NULL); + _botMode = [NSUserName() isEqualToString:@"_xcsbuildd"] || (getenv("GITHUB_ACTION") != NULL); } - (GCRepository*)createLocalRepositoryAtPath:(NSString*)path bare:(BOOL)bare { diff --git a/README.md b/README.md index 458528e2..8c9c27a5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://github.com/git-up/GitUp/actions/workflows/test.yml/badge.svg)](https://github.com/git-up/GitUp/actions/workflows/test.yml) +[![Build Status](https://github.com/git-up/GitUp/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/git-up/GitUp/actions/workflows/test.yml?query=branch%3Amaster) GitUp ===== From b1dac12fcb8f3260d23db8ffd7b0e8386d3d0c0b Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:37:46 -0500 Subject: [PATCH 7/9] Retry with environment --- .github/workflows/test.yml | 3 ++- GitUpKit/Core/GCTestCase.m | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 438a8d57..aba4d549 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,8 @@ jobs: - name: Run GitUpKit (macOS) tests working-directory: GitUpKit + env: + IS_GITHUB_ACTION: true run: | xcodebuild test \ -scheme "GitUpKit (macOS)" \ @@ -38,5 +40,4 @@ jobs: CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO \ CODE_SIGNING_ALLOWED=NO \ - GITHUB_ACTION=YES diff --git a/GitUpKit/Core/GCTestCase.m b/GitUpKit/Core/GCTestCase.m index 50ab4753..dd040c8a 100644 --- a/GitUpKit/Core/GCTestCase.m +++ b/GitUpKit/Core/GCTestCase.m @@ -31,8 +31,8 @@ @implementation GCTestCase - (void)setUp { [super setUp]; - // Figure out if running as Xcode Server bot or CI - _botMode = [NSUserName() isEqualToString:@"_xcsbuildd"] || (getenv("GITHUB_ACTION") != NULL); + // Figure out if running via GitHub Actions + _botMode = NSProcessInfo.processInfo.environment[@"IS_GITHUB_ACTION"] != nil; } - (GCRepository*)createLocalRepositoryAtPath:(NSString*)path bare:(BOOL)bare { From d1da0eacc0d784b3afbee24b01a5c532c80ce15f Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:51:51 -0500 Subject: [PATCH 8/9] Log more info --- .github/workflows/test.yml | 2 +- GitUpKit/Core/GCTestCase.m | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index aba4d549..ed6102f1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,5 +39,5 @@ jobs: -destination "platform=macOS" \ CODE_SIGN_IDENTITY="" \ CODE_SIGNING_REQUIRED=NO \ - CODE_SIGNING_ALLOWED=NO \ + CODE_SIGNING_ALLOWED=NO diff --git a/GitUpKit/Core/GCTestCase.m b/GitUpKit/Core/GCTestCase.m index dd040c8a..8e6d400d 100644 --- a/GitUpKit/Core/GCTestCase.m +++ b/GitUpKit/Core/GCTestCase.m @@ -33,6 +33,7 @@ - (void)setUp { // Figure out if running via GitHub Actions _botMode = NSProcessInfo.processInfo.environment[@"IS_GITHUB_ACTION"] != nil; + NSLog(@"Running in %@ mode, %@ | %@", self.botMode ? @"bot" : @"normal", NSProcessInfo.processInfo.environment, NSProcessInfo.processInfo.arguments); } - (GCRepository*)createLocalRepositoryAtPath:(NSString*)path bare:(BOOL)bare { From 9425570482b78c821aaad128eb9bf677cfd1d910 Mon Sep 17 00:00:00 2001 From: Lucas Derraugh Date: Mon, 29 Dec 2025 21:59:06 -0500 Subject: [PATCH 9/9] Alrighty, use "runner" as the environment check on user. Not great but works. --- .github/workflows/test.yml | 2 -- GitUpKit/Core/GCTestCase.m | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ed6102f1..023d95cd 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,8 +31,6 @@ jobs: - name: Run GitUpKit (macOS) tests working-directory: GitUpKit - env: - IS_GITHUB_ACTION: true run: | xcodebuild test \ -scheme "GitUpKit (macOS)" \ diff --git a/GitUpKit/Core/GCTestCase.m b/GitUpKit/Core/GCTestCase.m index 8e6d400d..5b5739d8 100644 --- a/GitUpKit/Core/GCTestCase.m +++ b/GitUpKit/Core/GCTestCase.m @@ -31,9 +31,8 @@ @implementation GCTestCase - (void)setUp { [super setUp]; - // Figure out if running via GitHub Actions - _botMode = NSProcessInfo.processInfo.environment[@"IS_GITHUB_ACTION"] != nil; - NSLog(@"Running in %@ mode, %@ | %@", self.botMode ? @"bot" : @"normal", NSProcessInfo.processInfo.environment, NSProcessInfo.processInfo.arguments); + // Figure out if running via GitHub Actions. This runner value is the user used by GitHub Actions. + _botMode = [NSProcessInfo.processInfo.environment[@"USER"] isEqualToString: @"runner"]; } - (GCRepository*)createLocalRepositoryAtPath:(NSString*)path bare:(BOOL)bare {