Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 20 additions & 84 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,95 +1,31 @@
name: CI

on:
pull_request:
push:
branches:
- main
workflow_dispatch:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

jobs:
repository-hygiene:
name: Repository hygiene
verify:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v6

- name: Validate required project files
run: |
set -euo pipefail

required_files=(
README.md
LICENSE
)

for file in "${required_files[@]}"; do
test -s "$file"
done

- name: Validate markdown files are not empty
run: |
set -euo pipefail

markdown_count=0

while IFS= read -r -d '' file; do
markdown_count=$((markdown_count + 1))
test -s "$file"
done < <(find . -type f -name '*.md' -not -path './.git/*' -print0)

if [ "$markdown_count" -eq 0 ]; then
echo "No markdown files found."
exit 1
fi

- name: Run package verification
run: |
set -euo pipefail

if [ ! -f package.json ]; then
echo "No package.json found; skipping Node checks."
exit 0
fi

if [ -f pnpm-lock.yaml ]; then
corepack enable
pnpm install --frozen-lockfile
if node -e "process.exit(require('./package.json').scripts?.['release:check'] ? 0 : 1)"; then
pnpm run release:check
else
pnpm run check --if-present
pnpm test --if-present
pnpm run build --if-present
pnpm run smoke --if-present
pnpm run package:smoke --if-present
fi
elif [ -f package-lock.json ]; then
npm ci
if node -e "process.exit(require('./package.json').scripts?.['release:check'] ? 0 : 1)"; then
npm run release:check
else
npm run check --if-present
npm test --if-present
npm run build --if-present
npm run smoke --if-present
npm run package:smoke --if-present
fi
else
npm install
if node -e "process.exit(require('./package.json').scripts?.['release:check'] ? 0 : 1)"; then
npm run release:check
else
npm run check --if-present
npm test --if-present
npm run build --if-present
npm run smoke --if-present
npm run package:smoke --if-present
fi
fi

- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm install
- name: npm run check
run: npm run check
- name: npm run build
run: npm run build
- name: npm test
run: npm test
- name: npm run smoke
run: npm run smoke
- name: npm run package:smoke
run: npm run package:smoke
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"LICENSE",
"SECURITY.md",
"CHANGELOG.md",
"CONTRIBUTING.md"
"CONTRIBUTING.md",
"CODE_OF_CONDUCT.md"
],
"scripts": {
"check": "node scripts/check.mjs",
Expand Down
Loading