Initial commit
This commit is contained in:
@@ -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