From c16963a54b4d1b5b3c8f2b72fa3e0b8da503533a Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sat, 30 May 2020 14:44:25 +0100 Subject: [PATCH 1/7] Add the skip option --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index c894453..e65adf0 100644 --- a/action.yml +++ b/action.yml @@ -14,6 +14,10 @@ inputs: description: 'FILE with lines that should not be changed' requred: false default: '' + skip: + description: 'Comma-separated list of files to skip (it accepts globs as well)' + requred: false + default: '' path: description: 'Path to run codespell in' requred: false From 70073683b57a8a4f4fdd6c6a189ec737a8b03e1b Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sat, 30 May 2020 14:47:29 +0100 Subject: [PATCH 2/7] Add the skip option to the command line --- entrypoint.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 7c486e0..04e685f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -24,6 +24,10 @@ echo "Exclude file '${INPUT_EXCLUDE_FILE}'" if [ "x${INPUT_EXCLUDE_FILE}" != "x" ]; then command_args="${command_args} --exclude-file ${INPUT_EXCLUDE_FILE}" fi +echo "Skipping '${INPUT_SKIP}'" +if [ "x${INPUT_SKIP}" != "x" ]; then + command_args="${command_args} --skip ${INPUT_SKIP}" +fi echo "Resulting CLI options ${command_args}" exec 5>&1 res=`{ { codespell ${command_args} ${INPUT_PATH}; echo $? 1>&4; } 1>&5; } 4>&1` From cfea490bf632e61da741b60c2ddb1d7c21bab00b Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sat, 30 May 2020 16:47:00 +0100 Subject: [PATCH 3/7] Add a test for skip --- test/test.bats | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test.bats b/test/test.bats index ea6b853..14fff91 100644 --- a/test/test.bats +++ b/test/test.bats @@ -69,6 +69,13 @@ function setup() { [ $status -eq $expectedExitStatus ] } +@test "Check the skip option" { + expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXCLUDED_MISSPELLING_COUNT)) + INPUT_SKIP="./test/exclude-file.txt" + run "./entrypoint.sh" + [ $status -eq $expectedExitStatus ] +} + @test "Custom path" { expectedExitStatus=$((SUBFOLDER_MISSPELLING_COUNT)) INPUT_PATH="./test/testdata/subfolder" From 17648097ba775dbe2b167f066d8223c9f00e6974 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sat, 30 May 2020 16:55:19 +0100 Subject: [PATCH 4/7] Try and make the skip option relative in the test --- test/test.bats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test.bats b/test/test.bats index 14fff91..34eb85f 100644 --- a/test/test.bats +++ b/test/test.bats @@ -71,7 +71,7 @@ function setup() { @test "Check the skip option" { expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXCLUDED_MISSPELLING_COUNT)) - INPUT_SKIP="./test/exclude-file.txt" + INPUT_SKIP="test/exclude-file.txt" run "./entrypoint.sh" [ $status -eq $expectedExitStatus ] } From ea28acd3a133756719bbb3ff569d55c3752fb99c Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Sat, 30 May 2020 23:21:35 +0100 Subject: [PATCH 5/7] Fix the skip bats test --- test/test.bats | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test.bats b/test/test.bats index 34eb85f..a842cde 100644 --- a/test/test.bats +++ b/test/test.bats @@ -8,6 +8,8 @@ FILENAME_MISSPELLING_COUNT=1 HIDDEN_MISSPELLING_COUNT=1 EXCLUDED_MISSPELLING_COUNT=1 SUBFOLDER_MISSPELLING_COUNT=1 +# From all files called example.txt +EXAMPLE_MISSPELLING_COUNT=5 export RUNNER_TEMP="/foo/runner_temp" @@ -17,6 +19,7 @@ function setup() { export INPUT_CHECK_FILENAMES="" export INPUT_CHECK_HIDDEN="" export INPUT_EXCLUDE_FILE="" + export INPUT_SKIP="" export INPUT_PATH="./test/testdata" export INPUT_ONLY_WARN="" } @@ -70,8 +73,8 @@ function setup() { } @test "Check the skip option" { - expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXCLUDED_MISSPELLING_COUNT)) - INPUT_SKIP="test/exclude-file.txt" + expectedExitStatus=$((ROOT_MISSPELLING_COUNT + HIDDEN_MISSPELLING_COUNT + SUBFOLDER_MISSPELLING_COUNT - EXAMPLE_MISSPELLING_COUNT)) + INPUT_SKIP="example.txt" run "./entrypoint.sh" [ $status -eq $expectedExitStatus ] } From d1a66542677c7a80aa2e10395a7a50a67b73f4bc Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Wed, 3 Jun 2020 00:22:58 +0100 Subject: [PATCH 6/7] Allow git master to fail For now... --- .github/workflows/testing.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 77ecff4..8fc9173 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -6,9 +6,14 @@ jobs: test: name: Run tests runs-on: ubuntu-latest + continue-on-error: ${{ matrix.experimental }} strategy: matrix: - codespell_pip_version: ['codespell', 'git+https://github.com/codespell-project/codespell.git'] + codespell_pip_version: ['codespell'] + experimental: [false] + include: + - codespell_pip_version: 'git+https://github.com/codespell-project/codespell.git' + experimental: true steps: - name: Checkout From 41ddf533480b53be864ac75884326dd66499f854 Mon Sep 17 00:00:00 2001 From: Peter Newman Date: Wed, 3 Jun 2020 12:59:22 +0100 Subject: [PATCH 7/7] Try and diagnose the BATS failure --- .github/workflows/testing.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 8fc9173..d1297d1 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -46,3 +46,19 @@ jobs: with: path: test/testdata only_warn: 1 + + diagnose_bats: + name: Diagnose bats + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v2 + - run: pip3 --quiet --quiet install git+https://github.com/codespell-project/codespell.git + - run: | + export INPUT_CHECK_FILENAMES="" + export INPUT_CHECK_HIDDEN="" + export INPUT_EXCLUDE_FILE="" + export INPUT_PATH="./test/testdata" + export INPUT_ONLY_WARN="" + ./entrypoint.sh