Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
37bc96c
allow Git LFS and System 7 leave in the same repo
pastey Apr 1, 2025
9269a79
try to fix Git LFS on a clean machine
pastey Apr 2, 2025
7b58464
ignore intermediate test files
pastey Apr 2, 2025
b65b451
make Git LFS install skip its hooks installation. We've already done …
pastey Apr 2, 2025
05435ee
try to fix LFS tests at GitHub runner
pastey Apr 2, 2025
90bc2f5
try to get verbose logs from Git LFS at GitHub runner
pastey Apr 2, 2025
816e9f2
fix s7 and Git LFS stdin conflict
pastey Apr 7, 2025
93f3a77
remove unused code
pastey Apr 7, 2025
f010608
one more try
pastey Apr 7, 2025
3dd65a5
check if pure LFS works at GitHub
pastey Apr 7, 2025
a872882
one more try
pastey Apr 7, 2025
996038f
most likely fix the last failing test
pastey Apr 7, 2025
5a7a279
re-enable all integration tests
pastey Apr 7, 2025
e41ddff
remove desperation-driven code
pastey Apr 7, 2025
d82bb9e
cancel running action on a new push
pastey Apr 7, 2025
6f3c674
fix one more test...
pastey Apr 7, 2025
94c0a71
very pretty... and very useless when you want to find out what the he…
pastey Apr 7, 2025
89ec924
this is a mess
pastey Apr 7, 2025
4c86ff9
improve test to detect if LFS pre-push hook is properly configured. F…
pastey Apr 8, 2025
05133a4
add current / total case display
pastey Apr 8, 2025
d65de9b
update our Git LFS hook format to a more modern one used by the lates…
pastey Apr 8, 2025
6c70016
bisect to find the CI failure reason
pastey Apr 8, 2025
c0f5a5a
rollback
pastey Apr 8, 2025
9789770
save xcresult file to run artifacts, if unit tests fail
pastey Apr 8, 2025
354d91f
continue the chase of a failing tests
pastey Apr 8, 2025
76b7114
more detailed check for traces of s7 in .git/config, as we've got an …
pastey Apr 8, 2025
33d0b50
seems like we don't have to manually pull lfs data
pastey Apr 9, 2025
e0e29a1
yep, lfs pull was not necessary
pastey Apr 9, 2025
b921b80
remove unfinished code
pastey Apr 9, 2025
c88a6d7
remove unused code
pastey Apr 9, 2025
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
14 changes: 12 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ on:
pull_request:
branches: [ '*' ]

concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true

jobs:
integration_tests:
name: Integration tests
Expand Down Expand Up @@ -31,5 +35,11 @@ jobs:
uses: actions/checkout@v3
- name: Test
run: |
xcodebuild -scheme system7-tests -configuration Release test | xcpretty
exit ${PIPESTATUS[0]}
xcodebuild -scheme system7-tests -configuration Release -resultBundlePath UnitTests.xcresult test
exit $?
- name: Upload xcresult file
uses: actions/upload-artifact@v4
if: ${{ failure() }}
with:
name: UnitTests-${{ github.run_number }}.xcresult
path: UnitTests.xcresult
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ usr
*.xcworkspacedata
system7-tests/integration/case7/*.actual
system7-tests/integration/sandbox
system7-tests/integration/templates
.last-s7-update-check-date
2 changes: 1 addition & 1 deletion system7-tests/bootstrapTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ - (void)testOnLFSRepo_WITH_NO_LFSHooksInstalled {

[self runBootstrap];

XCTAssertFalse([self doesPostCheckoutHookContainInitCall]);
XCTAssertTrue([self doesPostCheckoutHookContainInitCall]);

return S7ExitCodeSuccess;
});
Expand Down
4 changes: 3 additions & 1 deletion system7-tests/deinitTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ void assertRepoAtPWDIsFreeFromS7(void) {

if ([fileManager fileExistsAtPath:@".git/config"]) {
NSString *configContents = [NSString stringWithContentsOfFile:@".git/config" encoding:NSUTF8StringEncoding error:nil];
XCTAssertFalse([configContents containsString:@"s7"]);
XCTAssertFalse([configContents containsString:@"s7 merge-driver"],
@"Git Config should not contain 's7' mentions. Actual config: %@",
configContents);
}

NSArray<NSString *> *hookFileNames = @[
Expand Down
73 changes: 73 additions & 0 deletions system7-tests/integration/case-cloneS7andLFSmixedRepo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/bin/sh

git clone github/rd2 pastey/rd2

cd pastey/rd2

LARGE_FILE_CONTENT="MEGA-LONG-FILE-CONTENT"
echo "$LARGE_FILE_CONTENT" > large-file
assert git lfs track large-file

assert git add large-file .gitattributes

git commit -m"\"track large file with Git LFS\""

assert s7 init
assert git add .
assert git commit -m "\"init s7\""

assert s7 add --stage Dependencies/RDPDFKit '"$S7_ROOT/github/RDPDFKit"'
git commit -m"add pdfkit subrepo"

grep "s7" .git/hooks/pre-push
assert test 0 -eq $?

grep "lfs" .git/hooks/pre-push
assert test 0 -eq $?

assert test "2" = "$(grep -c '<"$REFS"' .git/hooks/pre-push)"

git push

cd "$S7_ROOT/nik"

git clone "$S7_ROOT/github/rd2"
assert test $? -eq 0

cd rd2

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?

grep -q "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

assert test "$(cat large-file)" = "$LARGE_FILE_CONTENT"
assert test -f Dependencies/RDPDFKit/.gitignore


mkdir etalon-lfs-repo
pushd etalon-lfs-repo > /dev/null
git init
git lfs install
popd > /dev/null

for ETALON_HOOK in etalon-lfs-repo/.git/hooks/*; do
if grep -i "lfs" $ETALON_HOOK; then
HOOK_NAME="$(basename $ETALON_HOOK)"
NIKS_HOOK=".git/hooks/$HOOK_NAME"
if [ "$(sed -n 's/ <&0//; s/ <"$REFS"//; /lfs/p;1p' $NIKS_HOOK)" != "$(cat $ETALON_HOOK)" ]; then
echo "LFS hooks hardcoded in S7 code are outdated!"
echo "Expected format:"
echo
cat $ETALON_HOOK
echo
echo "Actual format:"
echo
sed -n '/lfs/p' $NIKS_HOOK
echo

assert false
fi
fi
done
82 changes: 82 additions & 0 deletions system7-tests/integration/case-pullLFSintoExistingS7Repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/sh

git clone github/rd2 pastey/rd2

cd pastey/rd2

assert s7 init
assert git add .
assert git commit -m "\"init s7\""

assert s7 add --stage Dependencies/RDPDFKit '"$S7_ROOT/github/RDPDFKit"'
git commit -m"add pdfkit subrepo"

git push

cd "$S7_ROOT/nik"

assert git clone "$S7_ROOT/github/rd2"

cd rd2

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
assert test -f Dependencies/RDPDFKit/.gitignore


cd "$S7_ROOT/pastey/rd2"

LARGE_FILE_CONTENT="MEGA-LONG-FILE-CONTENT"
echo "$LARGE_FILE_CONTENT" > large-file
assert git lfs track large-file

# re-initialize hooks for both: s7 and LFS
assert s7 init

assert git add large-file
git add .
git commit -m"\"track large file with Git LFS\""

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
grep -i "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

grep "s7" .git/hooks/pre-push
assert test 0 -eq $?
grep -i "lfs" .git/hooks/pre-push
assert test 0 -eq $?

git push


cd "$S7_ROOT/nik/rd2"

PRE_LFS_COMMIT="$(git rev-parse HEAD)"

assert git pull

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
grep -i "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

assert test -f large-file
assert test "$(cat large-file)" = "$LARGE_FILE_CONTENT"

git checkout "$PRE_LFS_COMMIT"

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
grep -i "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

git switch -

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
grep -i "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

assert test -f large-file
assert test "$(cat large-file)" = "$LARGE_FILE_CONTENT"
22 changes: 22 additions & 0 deletions system7-tests/integration/case-pureLFS.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

git clone github/rd2 pastey/rd2

cd pastey/rd2

LARGE_FILE_CONTENT="MEGA-LONG-FILE-CONTENT"
echo "$LARGE_FILE_CONTENT" > large-file
assert git lfs track large-file

assert git add large-file .gitattributes
git commit -m"\"track large file with Git LFS\""

git push


cd "$S7_ROOT/nik/rd2"

assert git pull

assert test -f large-file
assert test "$(cat large-file)" = "$LARGE_FILE_CONTENT"
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#!/bin/sh

git clone github/rd2 pastey/rd2

cd pastey/rd2

#COMMIT_WITHOUT_S7="$(git rev-parse HEAD)"

assert s7 init
assert git add .
assert git commit -m "\"init s7\""

assert s7 add --stage Dependencies/RDPDFKit '"$S7_ROOT/github/RDPDFKit"'
git commit -m"add pdfkit subrepo"

git push

#COMMIT_WITH_S7="$(git rev-parse HEAD)"

cd "$S7_ROOT/nik"

assert git clone "$S7_ROOT/github/rd2"

cd rd2

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
assert test -f Dependencies/RDPDFKit/.gitignore


cd "$S7_ROOT/pastey/rd2"

assert git checkout -b git-lfs

LARGE_FILE_CONTENT="MEGA-LONG-FILE-CONTENT"
echo "$LARGE_FILE_CONTENT" > large-file
assert git lfs track large-file
assert git add large-file .gitattributes

# re-initialize hooks for both: s7 and LFS
assert s7 init

git commit -m"\"track large file with Git LFS\""

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
grep -i "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

git push origin -u HEAD


cd "$S7_ROOT/nik/rd2"

PRE_LFS_COMMIT="$(git rev-parse HEAD)"

assert git fetch

assert git switch git-lfs

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
grep -i "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

assert test -f large-file
assert test "$(cat large-file)" = "$LARGE_FILE_CONTENT"

git checkout "$PRE_LFS_COMMIT"

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
grep -i "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

git switch -

grep "s7" .git/hooks/post-checkout
assert test 0 -eq $?
grep -i "lfs" .git/hooks/post-checkout
assert test 0 -eq $?

assert test -f large-file
assert test "$(cat large-file)" = "$LARGE_FILE_CONTENT"
10 changes: 8 additions & 2 deletions system7-tests/integration/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ red=$(tput setaf 1)
green=$(tput setaf 2)
normal=$(tput sgr0)

TOTAL_NUMBER_OF_CASES=${#CASES_ARRAY[@]}

CURRENT_CASE_NUMBER=0

setupAndRunCase() {
local CASE=$1

Expand All @@ -106,8 +110,9 @@ setupAndRunCase() {
fi
else
echo
echo "$CASE"
echo "============="
echo "[$CURRENT_CASE_NUMBER / $TOTAL_NUMBER_OF_CASES] $CASE"
echo "======================================="
echo
S7_ROOT="$TEST_ROOT" sh -x "$SCRIPT_SOURCE_DIR/$CASE" 2>&1
echo
if [ -f "$TEST_ROOT/FAIL" ]; then
Expand All @@ -130,6 +135,7 @@ do
if [ 1 -eq $PARALLELIZE ]; then
setupAndRunCase $CASE &
else
CURRENT_CASE_NUMBER=$(( CURRENT_CASE_NUMBER + 1 ))
setupAndRunCase $CASE
fi
done
Expand Down
Loading