Initial commit
This commit is contained in:
@@ -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
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
## Improvement Type
|
||||||
|
|
||||||
|
- [ ] Improvement
|
||||||
|
- [ ] Bug
|
||||||
|
- [ ] Documentation
|
||||||
|
- [ ] Tests
|
||||||
|
- [ ] Git / workflow
|
||||||
|
- [ ] Other
|
||||||
|
|
||||||
|
## Issue Type
|
||||||
|
|
||||||
|
- [ ] Bug
|
||||||
|
- [ ] Improvement
|
||||||
|
- [ ] Task
|
||||||
|
- [ ] Documentation
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
<!-- Describe the request or problem in one short paragraph. -->
|
||||||
|
|
||||||
|
## Current Behavior
|
||||||
|
|
||||||
|
<!-- What is happening now? -->
|
||||||
|
|
||||||
|
## Expected Behavior
|
||||||
|
|
||||||
|
<!-- What should happen instead? -->
|
||||||
|
|
||||||
|
## Steps To Reproduce
|
||||||
|
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
|
||||||
|
## Proposed Changes or Acceptance Criteria
|
||||||
|
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
|
||||||
|
## Testing Notes
|
||||||
|
|
||||||
|
<!-- Include failing tests, suggested test coverage, or manual verification steps. -->
|
||||||
|
|
||||||
|
## Screenshots, Logs, or Extra Context
|
||||||
|
|
||||||
|
<!-- Paste errors, screenshots, device details, or links here. -->
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
## Improvement Area
|
||||||
|
|
||||||
|
- [ ] Documentation
|
||||||
|
- [ ] Tests
|
||||||
|
- [ ] Git / workflow
|
||||||
|
- [ ] Other
|
||||||
|
|
||||||
|
## Issue
|
||||||
|
|
||||||
|
- Closes #
|
||||||
|
|
||||||
|
<!-- Replace the example with the issue number this PR resolves. -->
|
||||||
|
|
||||||
|
## Summary
|
||||||
|
|
||||||
|
<!-- Explain the problem this PR solves and the user-visible outcome. -->
|
||||||
|
|
||||||
|
## Changes
|
||||||
|
|
||||||
|
-
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
- [ ] `bash tests/run_test.sh`
|
||||||
|
- [ ] Manual verification completed
|
||||||
|
- [ ] Tests not run
|
||||||
|
|
||||||
|
### Testing Notes
|
||||||
|
|
||||||
|
<!-- List exactly what you tested and any relevant results. -->
|
||||||
|
|
||||||
|
## Screenshots or Recordings
|
||||||
|
|
||||||
|
<!-- Add before/after screenshots, short videos, or "N/A". -->
|
||||||
|
|
||||||
|
## Deployment / Rollout Notes
|
||||||
|
|
||||||
|
- [ ] No special rollout steps
|
||||||
|
- [ ] Documentation only
|
||||||
|
- [ ] Other
|
||||||
|
|
||||||
|
### Notes
|
||||||
|
|
||||||
|
<!-- Add migration names, config changes, rollback notes, or "None". -->
|
||||||
|
|
||||||
|
## 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.
|
||||||
@@ -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.
|
||||||
@@ -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.
|
||||||
@@ -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.
|
||||||
|
|
||||||
|
|
||||||
@@ -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"
|
||||||
@@ -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."
|
||||||
@@ -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."
|
||||||
@@ -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"
|
||||||
Executable
+20
@@ -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."
|
||||||
Reference in New Issue
Block a user