Skip to content

Commit 407d15d

Browse files
authored
Merge pull request #167 from dscho/meaow
Add a GitHub workflow for continuous testing Signed-off-by: Elijah Newren <[email protected]>
2 parents 74ea810 + d28b2a7 commit 407d15d

File tree

5 files changed

+103
-27
lines changed

5 files changed

+103
-27
lines changed

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*.sh eol=lf
2+
*.py eol=lf
3+
/git-filter-repo eol=lf
4+
/contrib/filter-repo-demos/[a-z]* eol=lf
5+
/t/t9*/* eol=lf

.github/workflows/test.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Run tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run-tests:
7+
strategy:
8+
matrix:
9+
os: [ 'windows', 'ubuntu', 'macos' ]
10+
fail-fast: false
11+
runs-on: ${{ matrix.os }}-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Setup python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.x
18+
- name: test
19+
shell: bash
20+
run: |
21+
# setup-python puts `python` into the `PATH`, not `python3`, yet
22+
# `git-filter-repo` expects `python3` in the `PATH`. Let's add
23+
# a shim.
24+
printf '#!/bin/sh\n\nexec python "$@"\n' >python3 &&
25+
26+
export PATH=$PWD:$PATH &&
27+
export PYTHONPATH=$PWD &&
28+
export TEST_SHELL_PATH=/bin/sh &&
29+
30+
failed=0 &&
31+
cd t &&
32+
for t in t[0-9]*.sh
33+
do
34+
printf '\n\n== %s ==\n' "$t" &&
35+
bash $t -q -v -x ||
36+
failed=$(($failed+1))
37+
done &&
38+
if test 0 != $failed
39+
then
40+
mkdir ../failed &&
41+
tar czf ../failed/failed.tar.gz .
42+
exit 1
43+
fi
44+
- name: upload failed tests' directories
45+
if: failure()
46+
uses: actions/upload-artifact@v1
47+
with:
48+
name: failed-${{ matrix.os }}
49+
path: failed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/Documentation/man1/
33
/t/test-results
44
/t/trash directory*
5+
/__pycache__/

t/t9390-filter-repo.sh

Lines changed: 35 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ setup_metasyntactic_repo() {
298298
)
299299
}
300300

301-
test_expect_success '--tag-rename' '
301+
test_expect_success FUNNYNAMES '--tag-rename' '
302302
setup_metasyntactic_repo &&
303303
(
304304
git clone file://"$(pwd)"/metasyntactic tag_rename &&
@@ -342,7 +342,7 @@ test_expect_success 'tag of tag before relevant portion of history' '
342342
)
343343
'
344344

345-
test_expect_success '--subdirectory-filter' '
345+
test_expect_success FUNNYNAMES '--subdirectory-filter' '
346346
setup_metasyntactic_repo &&
347347
(
348348
git clone file://"$(pwd)"/metasyntactic subdir_filter &&
@@ -361,7 +361,7 @@ test_expect_success '--subdirectory-filter' '
361361
)
362362
'
363363

364-
test_expect_success '--subdirectory-filter with trailing slash' '
364+
test_expect_success FUNNYNAMES '--subdirectory-filter with trailing slash' '
365365
setup_metasyntactic_repo &&
366366
(
367367
git clone file://"$(pwd)"/metasyntactic subdir_filter_2 &&
@@ -380,7 +380,7 @@ test_expect_success '--subdirectory-filter with trailing slash' '
380380
)
381381
'
382382

383-
test_expect_success '--to-subdirectory-filter' '
383+
test_expect_success FUNNYNAMES '--to-subdirectory-filter' '
384384
setup_metasyntactic_repo &&
385385
(
386386
git clone file://"$(pwd)"/metasyntactic to_subdir_filter &&
@@ -400,7 +400,7 @@ test_expect_success '--to-subdirectory-filter' '
400400
)
401401
'
402402

403-
test_expect_success '--use-base-name' '
403+
test_expect_success FUNNYNAMES '--use-base-name' '
404404
setup_metasyntactic_repo &&
405405
(
406406
git clone file://"$(pwd)"/metasyntactic use_base_name &&
@@ -419,7 +419,7 @@ test_expect_success '--use-base-name' '
419419
)
420420
'
421421

422-
test_expect_success 'refs/replace/ to skip a parent' '
422+
test_expect_success FUNNYNAMES 'refs/replace/ to skip a parent' '
423423
setup_metasyntactic_repo &&
424424
(
425425
git clone file://"$(pwd)"/metasyntactic replace_skip_ref &&
@@ -441,7 +441,7 @@ test_expect_success 'refs/replace/ to skip a parent' '
441441
)
442442
'
443443

444-
test_expect_success 'refs/replace/ to add more initial history' '
444+
test_expect_success FUNNYNAMES 'refs/replace/ to add more initial history' '
445445
setup_metasyntactic_repo &&
446446
(
447447
git clone file://"$(pwd)"/metasyntactic replace_add_refs &&
@@ -476,7 +476,7 @@ test_expect_success 'refs/replace/ to add more initial history' '
476476
)
477477
'
478478

479-
test_expect_success 'creation/deletion/updating of replace refs' '
479+
test_expect_success FUNNYNAMES 'creation/deletion/updating of replace refs' '
480480
setup_metasyntactic_repo &&
481481
(
482482
git clone file://"$(pwd)"/metasyntactic replace_handling &&
@@ -535,7 +535,7 @@ test_expect_success 'creation/deletion/updating of replace refs' '
535535
)
536536
'
537537

538-
test_expect_success '--debug' '
538+
test_expect_success FUNNYNAMES '--debug' '
539539
setup_metasyntactic_repo &&
540540
(
541541
git clone file://"$(pwd)"/metasyntactic debug &&
@@ -558,7 +558,7 @@ test_expect_success '--debug' '
558558
)
559559
'
560560

561-
test_expect_success '--dry-run' '
561+
test_expect_success FUNNYNAMES '--dry-run' '
562562
setup_metasyntactic_repo &&
563563
(
564564
git clone file://"$(pwd)"/metasyntactic dry_run &&
@@ -586,7 +586,7 @@ test_expect_success '--dry-run' '
586586
)
587587
'
588588

589-
test_expect_success '--dry-run --debug' '
589+
test_expect_success FUNNYNAMES '--dry-run --debug' '
590590
setup_metasyntactic_repo &&
591591
(
592592
git clone file://"$(pwd)"/metasyntactic dry_run_debug &&
@@ -614,7 +614,7 @@ test_expect_success '--dry-run --debug' '
614614
)
615615
'
616616

617-
test_expect_success '--dry-run --stdin' '
617+
test_expect_success FUNNYNAMES '--dry-run --stdin' '
618618
setup_metasyntactic_repo &&
619619
(
620620
git clone file://"$(pwd)"/metasyntactic dry_run_stdin &&
@@ -917,7 +917,8 @@ test_expect_success '--strip-blobs-with-ids' '
917917
grep fake_submodule ../filenames &&
918918
919919
# Strip "a certain file" files
920-
git filter-repo --strip-blobs-with-ids <(echo deadbeefdeadbeefdeadbeefdeadbeefdeadbeef) &&
920+
echo deadbeefdeadbeefdeadbeefdeadbeefdeadbeef >../input &&
921+
git filter-repo --strip-blobs-with-ids ../input &&
921922
922923
git log --format=%n --name-only | sort | uniq >../filenames &&
923924
test_line_count = 10 ../filenames &&
@@ -937,12 +938,12 @@ test_expect_success '--strip-blobs-with-ids' '
937938
git filter-repo --strip-blobs-with-ids ../bad-ids --replace-text ../replace-rules &&
938939
939940
git log --format=%n --name-only | sort | uniq >../filenames &&
940-
test_line_count = 5 ../filenames &&
941+
test_line_count = 6 ../filenames &&
941942
! grep sequence/to ../filenames &&
942943
! grep words/to ../filenames &&
943944
! grep capricious ../filenames &&
944945
! grep fickle ../filenames &&
945-
! grep mercurial ../filenames
946+
! grep mercurial ../filenames &&
946947
947948
# Remove the temporary auxiliary files
948949
rm ../bad-ids &&
@@ -1196,6 +1197,12 @@ test_expect_success 'startup sanity checks' '
11961197

11971198
test_expect_success 'other startup error cases and requests for help' '
11981199
(
1200+
# prevent MSYS2 (Git for Windows) from converting the colon to
1201+
# a semicolon when encountering parameters that look like
1202+
# Unix-style, colon-separated path lists (such as `foo:.`)
1203+
MSYS_NO_PATHCONV=1 &&
1204+
export MSYS_NO_PATHCONV
1205+
11991206
git init startup_errors &&
12001207
cd startup_errors &&
12011208
@@ -1232,10 +1239,12 @@ test_expect_success 'other startup error cases and requests for help' '
12321239
test_must_fail git filter-repo --path-rename foo:bar/ 2>err &&
12331240
test_i18ngrep "either ends with a slash then both must." err &&
12341241
1235-
test_must_fail git filter-repo --paths-from-file <(echo "foo==>bar/") 2>err &&
1242+
echo "foo==>bar/" >input &&
1243+
test_must_fail git filter-repo --paths-from-file input 2>err &&
12361244
test_i18ngrep "either ends with a slash then both must." err &&
12371245
1238-
test_must_fail git filter-repo --paths-from-file <(echo "glob:*.py==>newname") 2>err &&
1246+
echo "glob:*.py==>newname" >input &&
1247+
test_must_fail git filter-repo --paths-from-file input 2>err &&
12391248
test_i18ngrep "renaming globs makes no sense" err &&
12401249
12411250
test_must_fail git filter-repo --strip-blobs-bigger-than 3GiB 2>err &&
@@ -1282,8 +1291,9 @@ test_expect_success 'mailmap sanity checks' '
12821291
git clone file://"$(pwd)"/analyze_me mailmap_sanity_checks &&
12831292
cd mailmap_sanity_checks &&
12841293
1285-
test_must_fail git filter-repo --mailmap /fake/path 2>../err &&
1286-
test_i18ngrep "Cannot read /fake/path" ../err &&
1294+
fake=$(pwd)/fake &&
1295+
test_must_fail git filter-repo --mailmap "$fake"/path 2>../err &&
1296+
test_i18ngrep "Cannot read $fake/path" ../err &&
12871297
12881298
echo "Total Bogus" >../whoopsies &&
12891299
test_must_fail git filter-repo --mailmap ../whoopsies 2>../err &&
@@ -1358,7 +1368,8 @@ test_expect_success '--refs and --replace-text' '
13581368
git clone file://"$(pwd)"/path_rename refs_and_replace_text &&
13591369
cd refs_and_replace_text &&
13601370
git rev-parse --short=10 HEAD~1 >myparent &&
1361-
git filter-repo --force --replace-text <(echo "10==>TEN") --refs $(cat myparent)..master &&
1371+
echo "10==>TEN" >input &&
1372+
git filter-repo --force --replace-text input --refs $(cat myparent)..master &&
13621373
cat <<-EOF >expect &&
13631374
TEN11
13641375
EOF
@@ -1565,7 +1576,7 @@ test_expect_success '--state-branch with expanding paths and refs' '
15651576
)
15661577
'
15671578

1568-
test_expect_success 'degenerate merge with non-matching filenames' '
1579+
test_expect_success FUNNYNAMES 'degenerate merge with non-matching filenames' '
15691580
test_create_repo degenerate_merge_differing_filenames &&
15701581
(
15711582
cd degenerate_merge_differing_filenames &&
@@ -1629,7 +1640,8 @@ test_expect_success 'degenerate merge with typechange' '
16291640
git ls-files >actual &&
16301641
test_cmp expect actual &&
16311642
1632-
test_line_count = 2 <(git log --oneline HEAD)
1643+
git log --oneline HEAD >input &&
1644+
test_line_count = 2 input
16331645
)
16341646
'
16351647

@@ -1670,7 +1682,7 @@ test_expect_success 'tweaking just a tag' '
16701682

16711683
test_expect_success '--version' '
16721684
git filter-repo --version >actual &&
1673-
git hash-object ../../git-filter-repo | colrm 13 >expect &&
1685+
git hash-object ../../git-filter-repo | cut -c 1-12 >expect &&
16741686
test_cmp expect actual
16751687
'
16761688

t/t9391-filter-repo-lib-usage.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,16 @@ test_expect_success 'other error cases' '
164164
)
165165
'
166166

167+
test_lazy_prereq DOS2UNIX '
168+
dos2unix -h
169+
test $? -ne 127
170+
'
171+
167172
test_expect_success 'lint-history' '
168173
test_create_repo lint-history &&
169174
(
170175
cd lint-history &&
176+
git config core.autocrlf false &&
171177
echo initial >content &&
172178
git add content &&
173179
git commit -m "initial" &&
@@ -180,10 +186,13 @@ test_expect_success 'lint-history' '
180186
git add content &&
181187
git commit -m "oops, that was embarassing" &&
182188
183-
$CONTRIB_DIR/lint-history --filenames-important dos2unix &&
184-
echo 2 >expect &&
185-
git rev-list --count HEAD >actual &&
186-
test_cmp expect actual
189+
if test_have_prereq DOS2UNIX
190+
then
191+
$CONTRIB_DIR/lint-history --filenames-important dos2unix &&
192+
echo 2 >expect &&
193+
git rev-list --count HEAD >actual &&
194+
test_cmp expect actual
195+
fi
187196
)
188197
'
189198

0 commit comments

Comments
 (0)