From 40bda0407413e62026ac07399751950ad5daeefe Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 13:44:21 -0800 Subject: [PATCH 01/10] test: add github workflow and makefile --- .github/workflows/test.yml | 22 ++++++++++++++++++++++ Makefile | 3 +++ 2 files changed, 25 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 Makefile diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..5e7fa4a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,22 @@ +# this file is hardlinked so that it exists as both //.github/workflows/test.yml and //test.yml. this is because Swift package manager will not pull in hidden files into the generated Xcode project when opened from package.swift + +name: Test +on: + push: + branches: + - main + + pull_request: + paths: + - "Sources/**" + - "Tests/**" + - ".github/workflows/test.yml" + +jobs: + test: + name: Test + runs-on: macos-13 + steps: + - uses: actions/checkout@v4 + - run: make test + \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..12c3390 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: test +test: + swift test \ No newline at end of file From b2a07647fa785b5526d8ac16932a087b32105e87 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 13:44:53 -0800 Subject: [PATCH 02/10] remove hardlink note; it doesnt work --- .github/workflows/test.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e7fa4a..8463a9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,3 @@ -# this file is hardlinked so that it exists as both //.github/workflows/test.yml and //test.yml. this is because Swift package manager will not pull in hidden files into the generated Xcode project when opened from package.swift - name: Test on: push: From 65f3fadb811e73d796acd3d963595e487fdf5a0f Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 13:58:43 -0800 Subject: [PATCH 03/10] debug test logic --- .github/workflows/test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8463a9b..623d958 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,5 +16,13 @@ jobs: runs-on: macos-13 steps: - uses: actions/checkout@v4 + - name: Replicate failing test logic + run: | + mkdir test + pushd test + git init + git commit -m 'initial' --allow-empty --no-gpg-sign + git branch -a + popd - run: make test \ No newline at end of file From 50d059e1c8e8e1871aa26f3a43650c1e1b26e6b4 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 14:05:26 -0800 Subject: [PATCH 04/10] remove debug; run tests on linux too --- .github/workflows/test.yml | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 623d958..3098810 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,18 +11,15 @@ on: - ".github/workflows/test.yml" jobs: - test: - name: Test - runs-on: macos-13 + test-macos: + name: Test on macOS + runs-on: macos-15 steps: - uses: actions/checkout@v4 - - name: Replicate failing test logic - run: | - mkdir test - pushd test - git init - git commit -m 'initial' --allow-empty --no-gpg-sign - git branch -a - popd - run: make test - \ No newline at end of file + test-linux: + name: Test on Linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: make test \ No newline at end of file From f4aab3c0e3312384f254c2169dd5bfcd933baaf9 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 14:06:54 -0800 Subject: [PATCH 05/10] fix default branch name in tests --- .github/workflows/test.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3098810..d77bb30 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,15 +11,17 @@ on: - ".github/workflows/test.yml" jobs: - test-macos: - name: Test on macOS - runs-on: macos-15 - steps: - - uses: actions/checkout@v4 - - run: make test - test-linux: - name: Test on Linux - runs-on: ubuntu-latest + test: + name: Run tests + strategy: + matrix: + os: [macos-15, macos-14] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + + # there are unit tests that rely on the default branch name being `main` + - name: Set Git default branch name + run: git config --global init.defaultBranch main + - run: make test \ No newline at end of file From 3141e866c2787ba354b00ece594c076c356e66e6 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 14:07:21 -0800 Subject: [PATCH 06/10] fix os image names --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d77bb30..9534be4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: name: Run tests strategy: matrix: - os: [macos-15, macos-14] + os: [macos-15, ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 From c8dd60e0d2bd9125f04efc413fd46db077061950 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 14:09:55 -0800 Subject: [PATCH 07/10] make http instead of ssh to pass in ci --- Tests/GitKitTests/GitKitTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/GitKitTests/GitKitTests.swift b/Tests/GitKitTests/GitKitTests.swift index afecdfa..b284b40 100644 --- a/Tests/GitKitTests/GitKitTests.swift +++ b/Tests/GitKitTests/GitKitTests.swift @@ -98,7 +98,7 @@ final class GitKitTests: XCTestCase { try self.clean(path: path) let git = Git(path: path) - try git.run(.clone(url: "git@github.com:binarybirds/shell-kit")) + try git.run(.clone(url: "https://github.com/binarybirds/shell-kit.git")) let statusOutput = try git.run("cd \(path)/shell-kit && git status") try self.clean(path: path) self.assert(type: "output", result: statusOutput, expected: expectation) From 39a25d1eb7bbe18826b1a2f7c4c4724a5c98a82a Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 14:11:22 -0800 Subject: [PATCH 08/10] missed one --- Tests/GitKitTests/GitKitTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/GitKitTests/GitKitTests.swift b/Tests/GitKitTests/GitKitTests.swift index b284b40..72fed0a 100644 --- a/Tests/GitKitTests/GitKitTests.swift +++ b/Tests/GitKitTests/GitKitTests.swift @@ -117,7 +117,7 @@ final class GitKitTests: XCTestCase { try self.clean(path: path) let git = Git(path: path) - try git.run(.clone(url: "git@github.com:binarybirds/shell-kit", dirName: "MyCustomDirectory")) + try git.run(.clone(url: "https://github.com/binarybirds/shell-kit.git", dirName: "MyCustomDirectory")) let statusOutput = try git.run("cd \(path)/MyCustomDirectory && git status") try self.clean(path: path) self.assert(type: "output", result: statusOutput, expected: expectation) From 116a43f3c1b9856b46e37d400f9c10522c8174f4 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 14:12:15 -0800 Subject: [PATCH 09/10] comment --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9534be4..d8833e8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,7 +20,7 @@ jobs: steps: - uses: actions/checkout@v4 - # there are unit tests that rely on the default branch name being `main` + # there are unit tests that rely on the default branch name being `main` but this isn't the case on GitHub Actions runners - name: Set Git default branch name run: git config --global init.defaultBranch main From 55463afa46b3177f3d81343e663f8ec580de5697 Mon Sep 17 00:00:00 2001 From: Andrew McKnight Date: Sat, 19 Jul 2025 14:12:45 -0800 Subject: [PATCH 10/10] run only on mac --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8833e8..f2340d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,10 +13,7 @@ on: jobs: test: name: Run tests - strategy: - matrix: - os: [macos-15, ubuntu-latest] - runs-on: ${{ matrix.os }} + runs-on: macos-15 steps: - uses: actions/checkout@v4