From 377e97148d427b72c4badc5baa105350ab513bac Mon Sep 17 00:00:00 2001 From: Liam Bigelow <40188355+bglw@users.noreply.github.com> Date: Tue, 17 Dec 2024 14:23:33 +1300 Subject: [PATCH 1/3] Update Toolproof to latest, adapt Toolproof macros --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- CONTRIBUTING.md | 2 +- .../_macros/node.toolproof.macro.yml | 3 +++ .../_macros/python.toolproof.macro.yml | 3 +++ .../_macros/run.toolproof.macro.yml | 3 +++ .../_macros/run_with_flags.toolproof.macro.yml | 3 +++ .../anchors/background.toolproof.yml | 2 +- .../anchors_example/background.toolproof.yml | 2 +- ...oad-indexes-then-search-for-a-word.toolproof.yml | 2 +- .../base/return-all-results.toolproof.yml | 2 +- .../base/search-for-a-word.toolproof.yml | 2 +- ...ionary-file-glob-can-be-configured.toolproof.yml | 2 +- .../file-glob-can-be-configured.toolproof.yml | 2 +- ...-can-be-configured-relative-to-cwd.toolproof.yml | 2 +- ...e-configured-with-an-absolute-path.toolproof.yml | 4 +--- .../output-path-can-be-configured.toolproof.yml | 2 +- .../root-selector-can-be-configured.toolproof.yml | 2 +- .../source-folder-can-be-configured.toolproof.yml | 2 +- ...can-search-for-a-hyphenated-phrase.toolproof.yml | 2 +- ...-queries-that-normalize-to-nothing.toolproof.yml | 2 +- ...-match-html-entities-as-their-text.toolproof.yml | 2 +- ...find-handles-html-entities-in-meta.toolproof.yml | 2 +- .../characters/pagefind-matches-emoji.toolproof.yml | 2 +- ...agefind-matches-special-characters.toolproof.yml | 2 +- ...ompound-words-are-indexed-per-word.toolproof.yml | 2 +- .../compound_filtering/background.toolproof.yml | 2 +- ...-be-pulled-from-command-line-flags.toolproof.yml | 2 +- ...-pulled-from-environment-variables.toolproof.yml | 2 +- ...lled-from-json-configuration-files.toolproof.yml | 2 +- ...an-be-pulled-from-multiple-sources.toolproof.yml | 2 +- ...lled-from-toml-configuration-files.toolproof.yml | 2 +- ...lled-from-yaml-configuration-files.toolproof.yml | 4 ++-- .../debounce-repeated-search-calls.toolproof.yml | 2 +- .../debounce/debounce-with-options.toolproof.yml | 2 +- ...chors-do-not-leak-through-metadata.toolproof.yml | 2 +- ...esn-t-error-on-parsing-ambiguities.toolproof.yml | 2 +- ...t-outside-of-the-main-html-element.toolproof.yml | 2 +- ...spaces-in-segmented-language-pages.toolproof.yml | 2 +- .../pagefind-multilingual-sub-results.toolproof.yml | 2 +- ...couraged-across-element-boundaries.toolproof.yml | 2 +- ...ll-return-pages-with-exact-matches.toolproof.yml | 2 +- ...ctors-can-be-excluded-as-an-option.toolproof.yml | 2 +- ...xcluded-from-indexing-and-excerpts.toolproof.yml | 2 +- ...lements-are-excluded-automatically.toolproof.yml | 2 +- ...de-ignored-elements-can-be-ignored.toolproof.yml | 2 +- .../filtering/background.toolproof.yml | 2 +- ...oad-indexes-then-search-for-a-word.toolproof.yml | 2 +- .../base/legacy-search-for-a-word.toolproof.yml | 2 +- ...ionary-file-glob-can-be-configured.toolproof.yml | 2 +- ...legacy-file-glob-can-be-configured.toolproof.yml | 2 +- ...e-configured-with-an-absolute-path.toolproof.yml | 4 +--- ...gacy-output-path-can-be-configured.toolproof.yml | 2 +- ...cy-root-selector-can-be-configured.toolproof.yml | 2 +- ...cy-source-folder-can-be-configured.toolproof.yml | 2 +- ...-be-pulled-from-command-line-flags.toolproof.yml | 2 +- ...-pulled-from-environment-variables.toolproof.yml | 2 +- ...lled-from-json-configuration-files.toolproof.yml | 2 +- ...an-be-pulled-from-multiple-sources.toolproof.yml | 2 +- ...lled-from-toml-configuration-files.toolproof.yml | 2 +- ...lled-from-yaml-configuration-files.toolproof.yml | 2 +- .../legacy-pagefind-modular-ui-loads.toolproof.yml | 2 +- ...egacy-pagefind-modular-ui-searches.toolproof.yml | 2 +- ...red-to-lump-all-languages-together.toolproof.yml | 8 ++++---- ...y-pagefind-keeps-dialects-separate.toolproof.yml | 8 ++++---- ...anguages-into-the-primary-language.toolproof.yml | 4 ++-- ...-for-english-with-english-stemming.toolproof.yml | 2 +- ...ortuguese-with-portuguese-stemming.toolproof.yml | 2 +- ...unknown-languages-with-no-stemming.toolproof.yml | 6 +++--- ...d-can-search-across-multiple-sites.toolproof.yml | 4 ++-- ...i-can-search-across-multiple-sites.toolproof.yml | 4 ++-- .../legacy-cli-tests-are-working.toolproof.yml | 2 +- ...-the-default-directory-being-moved.toolproof.yml | 2 +- .../legacy-base-url-can-be-configured.toolproof.yml | 2 +- ...y-keep-index-url-can-be-configured.toolproof.yml | 2 +- .../ui_base/legacy-pagefind-ui-loads.toolproof.yml | 2 +- .../legacy-pagefind-ui-searches.toolproof.yml | 2 +- .../highlighting_results/background.toolproof.yml | 2 +- ...rs-are-inserted-through-the-js-api.toolproof.yml | 2 +- ...can-be-inserted-through-the-js-api.toolproof.yml | 2 +- ...-t-conflict-with-subresult-anchors.toolproof.yml | 2 +- ...-chunk-will-load-the-closest-chunk.toolproof.yml | 2 +- .../html-attributes-can-be-indexed.toolproof.yml | 2 +- ...-can-be-limited-to-a-given-element.toolproof.yml | 2 +- .../index-gzipped-input-files.toolproof.yml | 2 +- .../metadata/background.toolproof.yml | 2 +- .../pagefind-modular-ui-loads.toolproof.yml | 2 +- .../pagefind-modular-ui-searches.toolproof.yml | 2 +- ...red-to-lump-all-languages-together.toolproof.yml | 8 ++++---- ...an-be-destroyed-and-re-initialized.toolproof.yml | 2 +- .../pagefind-keeps-dialects-separate.toolproof.yml | 8 ++++---- ...anguages-into-the-primary-language.toolproof.yml | 2 +- ...-for-english-with-english-stemming.toolproof.yml | 2 +- ...ortuguese-with-portuguese-stemming.toolproof.yml | 2 +- ...unknown-languages-with-no-stemming.toolproof.yml | 2 +- ...can-search-across-discrete-domains.toolproof.yml | 2 +- ...search-across-multiple-basic-sites.toolproof.yml | 4 ++-- ...can-search-across-discrete-domains.toolproof.yml | 2 +- ...i-can-search-across-multiple-sites.toolproof.yml | 4 ++-- .../multisite_filters/background.toolproof.yml | 4 ++-- ...-of-merged-indexes-can-be-selected.toolproof.yml | 4 ++-- ...ame-language-across-multiple-sites.toolproof.yml | 4 ++-- ...indexes-can-be-weighted-separately.toolproof.yml | 4 ++-- ...re-scored-correctly-across-indexes.toolproof.yml | 4 ++-- .../an-index-is-not-consumed-on-write.toolproof.yml | 4 +--- .../node_api/node_base/background.toolproof.yml | 2 +- ...lended-index-to-memory-via-the-api.toolproof.yml | 4 +--- ...ynthetic-index-to-disk-via-the-api.toolproof.yml | 4 +--- ...thetic-index-to-memory-via-the-api.toolproof.yml | 4 +--- ...verridden-urls-to-disk-via-the-api.toolproof.yml | 4 +--- ...d-a-true-index-to-disk-via-the-api.toolproof.yml | 4 +--- ...a-custom-disk-location-via-the-api.toolproof.yml | 4 +--- .../close-the-pagefind-backend.toolproof.yml | 4 +--- ...uage-takes-precedence-over-records.toolproof.yml | 4 +--- ...agefind-empty-index-returns-assets.toolproof.yml | 4 +--- .../node_base/pagefind-error-handling.toolproof.yml | 4 +--- .../node_base/pagefind-service-config.toolproof.yml | 4 +--- ...-pages-that-match---out-of---words.toolproof.yml | 2 +- ...-an-index-is-not-consumed-on-write.toolproof.yml | 4 ++-- ...lended-index-to-memory-via-the-api.toolproof.yml | 4 ++-- ...ynthetic-index-to-disk-via-the-api.toolproof.yml | 4 ++-- ...thetic-index-to-memory-via-the-api.toolproof.yml | 4 ++-- ...verridden-urls-to-disk-via-the-api.toolproof.yml | 4 ++-- ...d-a-true-index-to-disk-via-the-api.toolproof.yml | 4 ++-- ...a-custom-disk-location-via-the-api.toolproof.yml | 4 ++-- .../py-close-the-pagefind-backend.toolproof.yml | 4 ++-- ...uage-takes-precedence-over-records.toolproof.yml | 4 ++-- ...agefind-empty-index-returns-assets.toolproof.yml | 4 ++-- .../py-pagefind-error-handling.toolproof.yml | 4 ++-- .../py-pagefind-service-config.toolproof.yml | 4 ++-- .../sanity/cli-tests-are-working.toolproof.yml | 2 +- ...e-length-ranking-can-be-configured.toolproof.yml | 2 +- ...ncy-vs-raw-count-can-be-configured.toolproof.yml | 2 +- .../term-saturation-can-be-configured.toolproof.yml | 2 +- ...milarity-ranking-can-be-configured.toolproof.yml | 2 +- .../scoring_defaults/background.toolproof.yml | 2 +- ...-the-default-directory-being-moved.toolproof.yml | 2 +- .../base-url-can-be-configured.toolproof.yml | 2 +- .../keep-index-url-can-be-configured.toolproof.yml | 4 +--- ...-join-inline-elements-as-sentences.toolproof.yml | 2 +- ...gnores-redundant-zero-width-spaces.toolproof.yml | 2 +- ...-joins-block-elements-as-sentences.toolproof.yml | 2 +- .../pagefind-treats-br-tags-as-spaces.toolproof.yml | 2 +- .../sorting/background.toolproof.yml | 2 +- .../search-is-case-independent.toolproof.yml | 2 +- .../search-is-punctuation-independent.toolproof.yml | 2 +- ...atch-against-the-stem-of-that-word.toolproof.yml | 2 +- ...-backtrack-a-word-to-find-a-prefix.toolproof.yml | 2 +- ...ll-backtrack-a-word-to-find-a-stem.toolproof.yml | 2 +- ...ned-for-all-extensions-of-the-word.toolproof.yml | 2 +- ...ind-ui-can-programmatically-filter.toolproof.yml | 2 +- .../ui/ui_base/pagefind-ui-loads.toolproof.yml | 2 +- .../ui/ui_base/pagefind-ui-searches.toolproof.yml | 2 +- ...ind-ui-adds-highlight-query-params.toolproof.yml | 2 +- ...-highlight-query-params-by-default.toolproof.yml | 2 +- ...-custom-highlight-query-param-name.toolproof.yml | 2 +- ...-provide-a-hook-to-process-results.toolproof.yml | 2 +- ...ide-a-hook-to-process-search-terms.toolproof.yml | 2 +- .../pagefind-ui-can-customize-scoring.toolproof.yml | 2 +- ...nd-ui-can-load-custom-translations.toolproof.yml | 2 +- ...nd-ui-loads-automatic-translations.toolproof.yml | 2 +- .../integration_tests/urls/background.toolproof.yml | 2 +- .../urls/tag-pages-as-external-urls.toolproof.yml | 4 +--- ...ords-are-implicitly-weighted-lower.toolproof.yml | 2 +- ...-as-full-words-use-the-full-weight.toolproof.yml | 2 +- ...efixes-prioritise-the-lower-weight.toolproof.yml | 2 +- ...ompound-words-sum-to-a-full-weight.toolproof.yml | 2 +- ...ically-favoured-over-standard-text.toolproof.yml | 2 +- ...-can-be-explicitly-weighted-higher.toolproof.yml | 2 +- ...t-can-be-explicitly-weighted-lower.toolproof.yml | 2 +- test_ci.sh | 9 --------- test_interactive.sh | 13 ------------- toolproof.yml | 10 ++++++++++ 173 files changed, 225 insertions(+), 257 deletions(-) create mode 100644 pagefind/integration_tests/_macros/node.toolproof.macro.yml create mode 100644 pagefind/integration_tests/_macros/python.toolproof.macro.yml create mode 100644 pagefind/integration_tests/_macros/run.toolproof.macro.yml create mode 100644 pagefind/integration_tests/_macros/run_with_flags.toolproof.macro.yml delete mode 100755 test_ci.sh delete mode 100755 test_interactive.sh create mode 100644 toolproof.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 27de7d2c..94db97fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -537,7 +537,7 @@ jobs: - name: Test CLI if: matrix.run_tests == true - run: ./test_ci.sh "${{ matrix.target }}/release" + run: npx -y toolproof@latest -s --placeholders pagefind_mode="${{ matrix.target }}/release" - name: Move extended binary aside run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 15f54e70..6b6967ab 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -117,7 +117,7 @@ jobs: run: cargo test --release --lib --features extended - name: Test CLI - run: ./test_ci.sh "release" + run: npx -y toolproof@latest -s - name: Set up poetry run: ./wrappers/python/scripts/ci/github/setup_poetry.sh diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d8ca0628..2859d2f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -68,7 +68,7 @@ After building, you'll have a final Pagefind binary at `target/release/pagefind` ## Test suite -To run the integration test suite, from the root folder run `./test_interactive.sh`. +To run the integration test suite, from the root folder run `npx toolproof@latest`. This will give you a terminal interface to run tests and accept snapshot changes. From the `pagefind` directory you can run `cargo test` for unit tests. diff --git a/pagefind/integration_tests/_macros/node.toolproof.macro.yml b/pagefind/integration_tests/_macros/node.toolproof.macro.yml new file mode 100644 index 00000000..12da3d06 --- /dev/null +++ b/pagefind/integration_tests/_macros/node.toolproof.macro.yml @@ -0,0 +1,3 @@ +macro: I run Pagefind Node as {file} in {dir} +steps: + - I run "cd %dir% && npm i && PAGEFIND_BINARY_PATH=%toolproof_process_directory%/target/%pagefind_mode%/pagefind node %file%" diff --git a/pagefind/integration_tests/_macros/python.toolproof.macro.yml b/pagefind/integration_tests/_macros/python.toolproof.macro.yml new file mode 100644 index 00000000..09a8e237 --- /dev/null +++ b/pagefind/integration_tests/_macros/python.toolproof.macro.yml @@ -0,0 +1,3 @@ +macro: I run Pagefind Python as {file} in {dir} +steps: + - I run "cd %dir% && PAGEFIND_BINARY_PATH=%toolproof_process_directory%/target/%pagefind_mode%/pagefind python3 %file%" diff --git a/pagefind/integration_tests/_macros/run.toolproof.macro.yml b/pagefind/integration_tests/_macros/run.toolproof.macro.yml new file mode 100644 index 00000000..70b6b562 --- /dev/null +++ b/pagefind/integration_tests/_macros/run.toolproof.macro.yml @@ -0,0 +1,3 @@ +macro: I run Pagefind +steps: + - I run "%toolproof_process_directory%/target/%pagefind_mode%/pagefind" diff --git a/pagefind/integration_tests/_macros/run_with_flags.toolproof.macro.yml b/pagefind/integration_tests/_macros/run_with_flags.toolproof.macro.yml new file mode 100644 index 00000000..271d4536 --- /dev/null +++ b/pagefind/integration_tests/_macros/run_with_flags.toolproof.macro.yml @@ -0,0 +1,3 @@ +macro: I run Pagefind with {flags} +steps: + - I run "%toolproof_process_directory%/target/%pagefind_mode%/pagefind %flags%" diff --git a/pagefind/integration_tests/anchors/background.toolproof.yml b/pagefind/integration_tests/anchors/background.toolproof.yml index cda81841..3fd7b6b4 100644 --- a/pagefind/integration_tests/anchors/background.toolproof.yml +++ b/pagefind/integration_tests/anchors/background.toolproof.yml @@ -51,7 +51,7 @@ steps:
You can run cargo install pagefind
to build from source.