Skip to content

Commit

Permalink
Merge pull request #757 from CloudCannon/feat/toolproof-macros
Browse files Browse the repository at this point in the history
Update Toolproof to latest, adapt Toolproof macros
  • Loading branch information
bglw authored Dec 17, 2024
2 parents 99e8618 + 3a376b2 commit 275981e
Show file tree
Hide file tree
Showing 173 changed files with 228 additions and 257 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -c 1 --timeout 45 --placeholders pagefind_mode="${{ matrix.target }}/release"

- name: Move extended binary aside
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -c 1 --timeout 45

- name: Set up poetry
run: ./wrappers/python/scripts/ci/github/setup_poetry.sh
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions pagefind/integration_tests/_macros/node.toolproof.macro.yml
Original file line number Diff line number Diff line change
@@ -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%"
3 changes: 3 additions & 0 deletions pagefind/integration_tests/_macros/python.toolproof.macro.yml
Original file line number Diff line number Diff line change
@@ -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%"
3 changes: 3 additions & 0 deletions pagefind/integration_tests/_macros/run.toolproof.macro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
macro: I run Pagefind
steps:
- I run "%toolproof_process_directory%/target/%pagefind_mode%/pagefind"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
macro: I run Pagefind with {flags}
steps:
- I run "%toolproof_process_directory%/target/%pagefind_mode%/pagefind %flags%"
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ steps:
<!DOCTYPE html><html lang="en"><head></head><body><div data-pagefind-body>
<h1 id="repr-heading">My <span data-pagefind-ignore>Redacted</span> Heading about Symbiosis</h1>
</div></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: I serve the directory "public"
- step: In my browser, I load "/"
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ steps:
<h2 id="building-from-source">Building from source</h2>
<p>You can run <code class="inline">cargo install pagefind</code> to build from source.</p>
</main></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: I serve the directory "public"
- step: In my browser, I load "/"
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ steps:
lang="en"><head></head><body><h1>cat</h1></body></html>
- step: I have a "pagefind.yml" file with the content {yml}
yml: 'glob: "{cat/index.htm,kitty/**/*.html,cat.html}"'
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ steps:
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I have a "pagefind.yml" file with the content {yml}
yml: 'glob: "**/*.{htm,html}"'
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I run "%pagefind_exec_path% --output-path misc/_search"
- macro: I run Pagefind with "--output-path misc/_search"
- step: stdout should contain "Running Pagefind"
- step: The file "misc/_search/pagefind.js" should not be empty
- step: I serve the directory "."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: >-
I run "%pagefind_exec_path% --output-subdir
%toolproof_test_directory%/other/_search"
- macro: I run Pagefind with "--output-subdir %toolproof_test_directory%/other/_search"
- step: stdout should contain "Running Pagefind"
- step: The file "other/_search/pagefind.js" should not be empty
- step: I serve the directory "."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I run "%pagefind_exec_path% --output-subdir _search"
- macro: I run Pagefind with "--output-subdir _search"
- step: stdout should contain "Running Pagefind"
- step: The file "public/_search/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ steps:
<h1>Hello</h1>
</div>
<p data-pagefind-meta="ignored">Also ignored</p></body></html>
- step: I run "%pagefind_exec_path% --root-selector 'body > .content'"
- macro: I run Pagefind with "--root-selector 'body > .content'"
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I run "%pagefind_exec_path% --site my_website"
- macro: I run Pagefind with "--site my_website"
- step: stdout should contain "Running Pagefind"
- step: The file "my_website/pagefind/pagefind.js" should not be empty
- step: I serve the directory "my_website"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html lang="en"><head></head><body><h1>The
beet-root</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ steps:
html: >-
<!DOCTYPE html><html lang="en"><head></head><body><h1>Invert can before
opening</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html lang="en"><head></head><body><h1>The
&quot;bees&quot;</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html lang="en"><head></head><body><h1
data-pagefind-meta="title">The &quot;bees&quot;</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>F👨‍👩‍👧‍👦am</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>Béës</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><p>Cloud,Cannon</p></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ steps:
<span data-pagefind-filter="color">Orange</span>
<h1>Cat</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: I serve the directory "public"
- step: In my browser, I load "/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>Hello.</h1></body></html>
- step: I run "%pagefind_exec_path% --site public"
- macro: I run Pagefind with "--site public"
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ steps:
<!DOCTYPE html><html
lang="en"><head></head><body><h1>Hello.</h1></body></html>
- step: I have the environment variable "PAGEFIND_SITE" set to "public"
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ steps:
{
"site": "public"
}
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ steps:
{
"site": "public"
}
- step: I run "%pagefind_exec_path% --output-subdir _out"
- macro: I run Pagefind with "--output-subdir _out"
- step: stdout should contain "Running Pagefind"
- step: The file "public/_out/pagefind.js" should not be empty
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ steps:
lang="en"><head></head><body><h1>Hello.</h1></body></html>
- step: I have a "pagefind.toml" file with the content {toml}
toml: site = "public"
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
<!DOCTYPE html><html
lang="en"><head></head><body><h1>Hello.</h1></body></html>
- step: I have a "pagefind.yml" file with the content {yml}
yml: 'site: public'
- step: I run "%pagefind_exec_path%"
yml: "site: public"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
html: >-
<!DOCTYPE html><html
lang="en"><head></head><body><h1>world</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ steps:
</p>
</body>
</html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
html: |-
<!DOCTYPE html><html lang="en"><head></head><body><h1>hello world</h1>
<select><xmp><script>"use strict";</script></select></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:
</html>
<script></script>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: stdout should contain "Found a data-pagefind-body element on the site"
- step: The file "public/pagefind/pagefind.js" should not be empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ steps:
<p>Hello&nbsp;👋</p>
</body>
</html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ steps:
<p>بیرون نه می‌روی از من</p>
</body>
</html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ steps:
html: >-
<!DOCTYPE html><html lang="en"><head></head><body><p>Happy post about
cats</p></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: I serve the directory "public"
- step: In my browser, I load "/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ steps:
html: >-
<!DOCTYPE html><html lang="en"><head></head><body><h1>A post about how
cats do not like dogs</h1></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: The file "public/pagefind/pagefind.js" should not be empty
- step: I serve the directory "public"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ steps:
exclude_selectors:
- '[id^="g"]'
- 'div > div'
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: I serve the directory "public"
- step: In my browser, I load "/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:
</div>
<p>Huzzah!</p></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: I serve the directory "public"
- step: In my browser, I load "/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ steps:
<p>Hooray!</p>
<style> * { color: red; } </style></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: I serve the directory "public"
- step: In my browser, I load "/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ steps:
<div data-pagefind-ignore="all">
<p data-pagefind-meta="all">Nested content</p>
</div></body></html>
- step: I run "%pagefind_exec_path%"
- macro: I run Pagefind
- step: stdout should contain "Running Pagefind"
- step: I serve the directory "public"
- step: In my browser, I load "/"
Expand Down
Loading

0 comments on commit 275981e

Please sign in to comment.