From 1a506d18926997f97b6bcb4841969525ccc878ff Mon Sep 17 00:00:00 2001 From: Tyler Westbrook Date: Wed, 10 Jun 2026 21:12:07 +0000 Subject: [PATCH] Initial commit --- .gitea/workflows/tests.yaml | 20 ++++++++ .github/ISSUE_TEMPLATE.md | 47 +++++++++++++++++++ .github/PULL_REQUEST_TEMPLATE.md | 52 +++++++++++++++++++++ ARCHITECTURE.md | 14 ++++++ CONTRIBUTING.md | 47 +++++++++++++++++++ README.md | 35 ++++++++++++++ tests/checks/test_contributing.sh | 26 +++++++++++ tests/checks/test_issue_and_pr_templates.sh | 34 ++++++++++++++ tests/checks/test_readme.sh | 26 +++++++++++ tests/checks/test_workflow.sh | 31 ++++++++++++ tests/run_test.sh | 20 ++++++++ 11 files changed, 352 insertions(+) create mode 100644 .gitea/workflows/tests.yaml create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 ARCHITECTURE.md create mode 100644 CONTRIBUTING.md create mode 100644 README.md create mode 100644 tests/checks/test_contributing.sh create mode 100644 tests/checks/test_issue_and_pr_templates.sh create mode 100644 tests/checks/test_readme.sh create mode 100644 tests/checks/test_workflow.sh create mode 100755 tests/run_test.sh diff --git a/.gitea/workflows/tests.yaml b/.gitea/workflows/tests.yaml new file mode 100644 index 0000000..84f8255 --- /dev/null +++ b/.gitea/workflows/tests.yaml @@ -0,0 +1,20 @@ +name: Template tests + +on: + push: + pull_request: + types: + - opened + - synchronize + - reopened + +jobs: + tests: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: https://gitea.com/actions/checkout@v4 + + - name: Run template tests + run: bash tests/run_test.sh diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..40febec --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,47 @@ +## Improvement Type + +- [ ] Improvement +- [ ] Bug +- [ ] Documentation +- [ ] Tests +- [ ] Git / workflow +- [ ] Other + +## Issue Type + +- [ ] Bug +- [ ] Improvement +- [ ] Task +- [ ] Documentation + +## Summary + + + +## Current Behavior + + + +## Expected Behavior + + + +## Steps To Reproduce + +1. +2. +3. + +## Proposed Changes or Acceptance Criteria + +- +- +- + +## Testing Notes + + + +## Screenshots, Logs, or Extra Context + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..1304d36 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,52 @@ +## Improvement Area + +- [ ] Documentation +- [ ] Tests +- [ ] Git / workflow +- [ ] Other + +## Issue + +- Closes # + + + +## Summary + + + +## Changes + +- + +## Testing + +- [ ] `bash tests/run_test.sh` +- [ ] Manual verification completed +- [ ] Tests not run + +### Testing Notes + + + +## Screenshots or Recordings + + + +## Deployment / Rollout Notes + +- [ ] No special rollout steps +- [ ] Documentation only +- [ ] Other + +### Notes + + + +## Checklist + +- [ ] Scope is limited to the selected area above. +- [ ] Related docs or comments were updated if needed. +- [ ] I ran `bash tests/run_test.sh`. +- [ ] The PR references a issue number. +- [ ] Any follow-up work is tracked in TODO.md or an issue. diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 0000000..91690d8 --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,14 @@ +# Architecture + +This template is organized around three small areas: + +- Repository guidance in `README.md` and `CONTRIBUTING.md`. +- User-facing templates in `.github/`. +- Validation and automation in `tests/` and `.gitea/workflows/`. + +## Workflow + +1. Update the documentation and templates. +2. Put shell checks in `tests/checks/`. +3. Run `bash tests/run_test.sh` locally. +4. Open a pull request so Gitea Actions can verify the template on PR open. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ad79661 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# Contributing + +Thanks for improving this template. + +## Before You Start + +- Open or link the issue that describes the work. +- Keep the change small and focused. +- If the work does not have an issue yet, create one first so the PR can reference it. + +## Branching + +- Use a branch name that includes the issue number, such as `issue-123-update-readme`. +- Keep unrelated cleanup in a separate branch, only have the fix in the branch. + +## Pull Requests + +- Every pull request must reference an issue number in the body with `Closes #123`, `Fixes #123`, or `Relates to #123`. +- Summarize the change clearly and call out anything a reviewer should verify manually. +- Update docs and templates when the workflow changes. +- If the PR changes the template itself, describe how future contributors should use the new pattern. + +## Tests + +Run the local checks before opening or updating a PR: + +```bash +bash tests/run_test.sh +``` + +Put new shell checks in `tests/checks/` so the shared runner picks them up automatically. + +The Gitea workflow in `.gitea/workflows/tests.yaml` runs the same command automatically on pushes and pull requests. + +Please add lots of tests to each of your PR's and be descriptive with the tests so that the issue doesn't happen again or the feature doesn't get overwritten. + +## Review Checklist + +- The PR is linked to the correct issue. +- The test suite passes locally. +- Any relevant docs or comments are updated. +- The change stays within the intended scope. +- The PR body explains any manual verification that is still needed. + +## Notes for Template Maintainers + +If this repository is reused as a starter for another project, adjust the branch naming convention, issue linking rule, and testing command so they match the new project. diff --git a/README.md b/README.md new file mode 100644 index 0000000..bbe145b --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# Title + + + +## Overview + + + +## What's Included + + + +## Getting Started + + + + + +## Testing + +Please create your tests so that when the following is ran it automatically tests your test. + +```bash +bash tests/run_test.sh +``` + +## Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md) for the full contribution flow, including the issue-number requirement for every pull request. + +## Repository Layout + +See [ARCHITECTURE.md](ARCHITECTURE.md) to see the repo layout. + + diff --git a/tests/checks/test_contributing.sh b/tests/checks/test_contributing.sh new file mode 100644 index 0000000..6983878 --- /dev/null +++ b/tests/checks/test_contributing.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +CONTRIBUTING="$ROOT_DIR/CONTRIBUTING.md" + +assert_contains() { + local file="$1" + local needle="$2" + + if ! grep -Fq -- "$needle" "$file"; then + printf 'Expected %s to contain: %s\n' "$file" "$needle" >&2 + exit 1 + fi +} + +assert_contains "$CONTRIBUTING" "# Contributing" +assert_contains "$CONTRIBUTING" "## Before You Start" +assert_contains "$CONTRIBUTING" "issue number" +assert_contains "$CONTRIBUTING" "issue-123-update-readme" +assert_contains "$CONTRIBUTING" "Closes #123" +assert_contains "$CONTRIBUTING" "bash tests/run_test.sh" +assert_contains "$CONTRIBUTING" "tests/checks/" +assert_contains "$CONTRIBUTING" ".gitea/workflows/tests.yaml" +assert_contains "$CONTRIBUTING" "## Review Checklist" diff --git a/tests/checks/test_issue_and_pr_templates.sh b/tests/checks/test_issue_and_pr_templates.sh new file mode 100644 index 0000000..f9832f9 --- /dev/null +++ b/tests/checks/test_issue_and_pr_templates.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +ISSUE_TEMPLATE="$ROOT_DIR/.github/ISSUE_TEMPLATE.md" +PR_TEMPLATE="$ROOT_DIR/.github/PULL_REQUEST_TEMPLATE.md" + +assert_contains() { + local file="$1" + local needle="$2" + + if ! grep -Fq -- "$needle" "$file"; then + printf 'Expected %s to contain: %s\n' "$file" "$needle" >&2 + exit 1 + fi +} + +assert_contains "$ISSUE_TEMPLATE" "## Improvement Area" +assert_contains "$ISSUE_TEMPLATE" "## Issue Type" +assert_contains "$ISSUE_TEMPLATE" "## Summary" +assert_contains "$ISSUE_TEMPLATE" "## Current Behavior" +assert_contains "$ISSUE_TEMPLATE" "## Expected Behavior" +assert_contains "$ISSUE_TEMPLATE" "## Steps To Reproduce" +assert_contains "$ISSUE_TEMPLATE" "## Testing Notes" +assert_contains "$ISSUE_TEMPLATE" "## Screenshots, Logs, or Extra Context" + +assert_contains "$PR_TEMPLATE" "## Improvement Area" +assert_contains "$PR_TEMPLATE" "## Issue" +assert_contains "$PR_TEMPLATE" "Closes #" +assert_contains "$PR_TEMPLATE" "bash tests/run_test.sh" +assert_contains "$PR_TEMPLATE" "## Testing" +assert_contains "$PR_TEMPLATE" "## Deployment / Rollout Notes" +assert_contains "$PR_TEMPLATE" "Any follow-up work is tracked in TODO.md or an issue." diff --git a/tests/checks/test_readme.sh b/tests/checks/test_readme.sh new file mode 100644 index 0000000..b1bd76e --- /dev/null +++ b/tests/checks/test_readme.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +README="$ROOT_DIR/README.md" + +assert_contains() { + local file="$1" + local needle="$2" + + if ! grep -Fq -- "$needle" "$file"; then + printf 'Expected %s to contain: %s\n' "$file" "$needle" >&2 + exit 1 + fi +} + +assert_contains "$README" "# " +assert_contains "$README" "## Overview" +assert_contains "$README" "## What's Included" +assert_contains "$README" "## Getting Started" +assert_contains "$README" "## Testing" +assert_contains "$README" "bash tests/run_test.sh" +assert_contains "$README" "## Contributing" +assert_contains "$README" "## Repository Layout" +assert_contains "$README" "See [ARCHITECTURE.md](ARCHITECTURE.md) to see the repo layout." diff --git a/tests/checks/test_workflow.sh b/tests/checks/test_workflow.sh new file mode 100644 index 0000000..8989d31 --- /dev/null +++ b/tests/checks/test_workflow.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +WORKFLOW="$ROOT_DIR/.gitea/workflows/tests.yaml" + +assert_contains() { + local file="$1" + local needle="$2" + + if ! grep -Fq -- "$needle" "$file"; then + printf 'Expected %s to contain: %s\n' "$file" "$needle" >&2 + exit 1 + fi +} + +if [[ ! -f "$WORKFLOW" ]]; then + printf 'Expected workflow file to exist: %s\n' "$WORKFLOW" >&2 + exit 1 +fi + +assert_contains "$WORKFLOW" "name: Template tests" +assert_contains "$WORKFLOW" "push" +assert_contains "$WORKFLOW" "pull_request" +assert_contains "$WORKFLOW" "opened" +assert_contains "$WORKFLOW" "synchronize" +assert_contains "$WORKFLOW" "reopened" +assert_contains "$WORKFLOW" "runs-on: ubuntu-latest" +assert_contains "$WORKFLOW" "uses: https://gitea.com/actions/checkout@v4" +assert_contains "$WORKFLOW" "bash tests/run_test.sh" diff --git a/tests/run_test.sh b/tests/run_test.sh new file mode 100755 index 0000000..9eb399c --- /dev/null +++ b/tests/run_test.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +cd "$ROOT_DIR" + +mapfile -t test_scripts < <(find tests/checks -maxdepth 1 -type f -name 'test_*.sh' | sort) + +if [[ "${#test_scripts[@]}" -eq 0 ]]; then + echo "No test scripts found under tests/checks/." >&2 + exit 1 +fi + +for test_script in "${test_scripts[@]}"; do + echo "Running ${test_script}" + bash "$test_script" +done + +echo "All tests passed."