Skip to content

Commit

Permalink
Add base toolproof setup
Browse files Browse the repository at this point in the history
  • Loading branch information
bglw committed Jun 11, 2024
1 parent fb77135 commit 0554b2a
Show file tree
Hide file tree
Showing 7 changed files with 214 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Test

on:
push:
branches: ["main", "library-rework"]
pull_request:
branches: [main]

env:
CARGO_TERM_COLOR: always

jobs:
test:
name: Test
runs-on: ${{matrix.os}}
defaults:
run:
shell: bash
strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
rust: beta
target: x86_64-unknown-linux-musl
cross: false
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 1

- name: Install
run: npm i

- name: Unit Test
run: npm run test

- name: Behavior Test
run: ./test_ci.sh
8 changes: 8 additions & 0 deletions test_ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR

GADGET_CLI=$(realpath "$SCRIPT_DIR/src/cli.js")

npx -y toolproof --placeholders gadget_cli="$GADGET_CLI"
8 changes: 8 additions & 0 deletions test_interactive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR

GADGET_CLI=$(realpath "$SCRIPT_DIR/src/cli.js")

npx -y toolproof --placeholders gadget_cli="$GADGET_CLI" --all -i
74 changes: 74 additions & 0 deletions toolproof_tests/demo.toolproof.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Text Example 1

steps:
- step: I have a ".eleventy.js" file with the content {js}
js: |-
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function (eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.addCollection('nav', function (collectionApi) {
return collectionApi.getAll()
.filter((page) => page.data.show_in_navigation === true)
.sort((a, b) => a.data.navigation_order - b.data.navigation_order);
});
eleventyConfig.addPassthroughCopy('images');
eleventyConfig.addPlugin(pluginRss);
};
- step: I have a "pages/index.njk" file with the content {njk}
njk: |-
---
title:
call_to_action: Contact
permalink: /
---
<div class="editable">
<p>This is the <strong>Justice</strong> template from <a href="https://cloudcannon.com/">CloudCannon</a>. Justice is strong foundation for the web presence of a law firm or business. It's filled with fictitious example content to get you started.</p>
<p>Justice Law is professional representation. Practicing for over 50 years, our team have the knowledge and skills to get you results.</p>
</div>
- step: I have a "staff-members/jane-doe.md" file with the content {md}
md: |-
---
_uuid: 05589684-8d33-4d2f-8fde-460f9922d319
name: Jane Doe
image: "https://placekitten.com/440/440?a=.png"
description: Jane has 19 years of experience in law, and specialises in property and business.
credentials: LLB
phone_extension: "02"
---
- step: I have a "staff-members/john-doe.md" file with the content {md}
md: |-
---
_uuid: 8c6c132e-1c21-413e-be81-874091df1841
name: John Doe
image: "https://placebear.com/440/440?a=.png"
description: With an interest in employment law, John works tirelessly to improve workplaces.
credentials: LLB
phone_extension: "11"
---
- I run "node %gadget_cli% ."
- stdout should contain "eleventy"
- snapshot: stdout
snapshot_content: |-
╎{
╎ "ssg": "eleventy",
╎ "source": "",
╎ "collections_config": {
╎ "pages": {
╎ "path": "",
╎ "name": "Pages",
╎ "icon": "wysiwyg",
╎ "filter": {
╎ "base": "strict"
╎ }
╎ }
╎ },
╎ "paths": {
╎ "collections": ""
╎ }
╎}
38 changes: 38 additions & 0 deletions toolproof_tests/refs_example/demo_test.toolproof.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Demo Test with Refs

steps:
- ref: ./eleventy_config.toolproof.yml
- ref: ./staff_collection.toolproof.yml
- step: I have a "pages/index.njk" file with the content {njk}
njk: |-
---
title:
call_to_action: Contact
permalink: /
---
<div class="editable">
<p>This is the <strong>Justice</strong> template from <a href="https://cloudcannon.com/">CloudCannon</a>. Justice is strong foundation for the web presence of a law firm or business. It's filled with fictitious example content to get you started.</p>
<p>Justice Law is professional representation. Practicing for over 50 years, our team have the knowledge and skills to get you results.</p>
</div>
- I run "node %gadget_cli% ."
- stdout should contain "eleventy"
- snapshot: stdout
snapshot_content: |-
╎{
╎ "ssg": "eleventy",
╎ "source": "",
╎ "collections_config": {
╎ "pages": {
╎ "path": "",
╎ "name": "Pages",
╎ "icon": "wysiwyg",
╎ "filter": {
╎ "base": "strict"
╎ }
╎ }
╎ },
╎ "paths": {
╎ "collections": ""
╎ }
╎}
22 changes: 22 additions & 0 deletions toolproof_tests/refs_example/eleventy_config.toolproof.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: 11ty Config Setup
type: reference

steps:
- step: I have a ".eleventy.js" file with the content {js}
js: |-
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function (eleventyConfig) {
eleventyConfig.setUseGitIgnore(false);
eleventyConfig.setDataDeepMerge(true);
eleventyConfig.addCollection('nav', function (collectionApi) {
return collectionApi.getAll()
.filter((page) => page.data.show_in_navigation === true)
.sort((a, b) => a.data.navigation_order - b.data.navigation_order);
});
eleventyConfig.addPassthroughCopy('images');
eleventyConfig.addPlugin(pluginRss);
};
24 changes: 24 additions & 0 deletions toolproof_tests/refs_example/staff_collection.toolproof.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Staff Collection Setup
type: reference

steps:
- step: I have a "staff-members/jane-doe.md" file with the content {md}
md: |-
---
_uuid: 05589684-8d33-4d2f-8fde-460f9922d319
name: Jane Doe
image: "https://placekitten.com/440/440?a=.png"
description: Jane has 19 years of experience in law, and specialises in property and business.
credentials: LLB
phone_extension: "02"
---
- step: I have a "staff-members/john-doe.md" file with the content {md}
md: |-
---
_uuid: 8c6c132e-1c21-413e-be81-874091df1841
name: John Doe
image: "https://placebear.com/440/440?a=.png"
description: With an interest in employment law, John works tirelessly to improve workplaces.
credentials: LLB
phone_extension: "11"
---

0 comments on commit 0554b2a

Please sign in to comment.