Skip to content

Commit 7301241

Browse files
committed
feat: sparse-checkout test script unified in only one script
1 parent d8614bd commit 7301241

File tree

4 files changed

+27
-39
lines changed

4 files changed

+27
-39
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ jobs:
7272
shell: bash
7373
run: __test__/verify-side-by-side.sh
7474

75-
# Sparse checkout
75+
# Sparse checkout
7676
- name: Sparse checkout
7777
uses: ./
7878
with:
@@ -82,9 +82,7 @@ jobs:
8282
dist
8383
path: sparse-checkout
8484

85-
- name: Verify sparse checkout basic
86-
run: __test__/verify-sparse-checkout-basic.sh
87-
- name: Verify sparse checkout example
85+
- name: Verify sparse checkout
8886
run: __test__/verify-sparse-checkout.sh
8987

9088
# LFS

__test__/verify-sparse-checkout-basic.sh

Lines changed: 0 additions & 32 deletions
This file was deleted.

__test__/verify-sparse-checkout.sh

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,28 @@ fi
99
# Verify sparse-checkout
1010
cd sparse-checkout
1111

12+
SPARSE=$(git sparse-checkout list)
13+
14+
if [ "$?" != "0" ]; then
15+
echo "Failed to validate sparse-checkout"
16+
exit 1
17+
fi
18+
19+
# Check that sparse-checkout list is not empty
20+
if [ -z "$SPARSE" ]; then
21+
echo "Expected sparse-checkout list to not be empty"
22+
exit 1
23+
fi
24+
25+
# Check that all folders of the sparse checkout exist
26+
for pattern in $SPARSE
27+
do
28+
if [ ! -d "$pattern" ]; then
29+
echo "Expected directory '$pattern' to exist"
30+
exit 1
31+
fi
32+
done
33+
1234
checkSparse () {
1335
if [ ! -d "./$1" ]; then
1436
echo "Expected directory '$1' to exist"
@@ -24,12 +46,12 @@ checkSparse () {
2446
done
2547
}
2648

27-
# Check that all folders and its childrens has been fetched correctly
49+
# Check that all folders and their children have been checked out
2850
checkSparse __test__
2951
checkSparse .github
3052
checkSparse dist
3153

32-
# Check that only sparse-checkout folders has been fetched
54+
# Check that only sparse-checkout folders have been checked out
3355
for pattern in $(git ls-tree --name-only HEAD)
3456
do
3557
if [ -d "$pattern" ]; then

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ inputs:
5656
sparse-checkout:
5757
description: >
5858
Do a sparse checkout on given patterns.
59-
Each pattern should be sepparated with new lines
59+
Each pattern should be separated with new lines
6060
default: null
6161
fetch-depth:
6262
description: 'Number of commits to fetch. 0 indicates all history for all branches and tags.'

0 commit comments

Comments
 (0)