Skip to content

Commit 5b54005

Browse files
Merge pull request #7 from saltines321-debug/codex/github-mention-template-devex]-automation,-ci/cd-contrib
Scaffold reusable DevEx workflows, release pipeline, and onboarding docs
2 parents 470cd3b + 1a7e7cc commit 5b54005

6 files changed

Lines changed: 216 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
quality:
14+
uses: ./.github/workflows/reusable-quality.yml
15+
with:
16+
setup-node: false
17+
run-format-check: false
18+
run-lint: false
19+
run-test: false

.github/workflows/release.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
release-please:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Release Please
19+
uses: googleapis/release-please-action@v4
20+
with:
21+
release-type: simple
22+
changelog-types: '[{"type":"feat","section":"Features","hidden":false},{"type":"fix","section":"Bug Fixes","hidden":false},{"type":"chore","section":"Maintenance","hidden":false}]'
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Reusable Quality Checks
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
checkout-fetch-depth:
7+
description: Git checkout fetch depth.
8+
required: false
9+
default: 0
10+
type: number
11+
setup-node:
12+
description: Enable Node.js setup.
13+
required: false
14+
default: true
15+
type: boolean
16+
node-version:
17+
description: Node.js version for JS/TS projects.
18+
required: false
19+
default: '20'
20+
type: string
21+
run-format-check:
22+
description: Run formatting validation command.
23+
required: false
24+
default: true
25+
type: boolean
26+
format-command:
27+
description: Command used for format validation.
28+
required: false
29+
default: npm run format:check --if-present
30+
type: string
31+
run-lint:
32+
description: Run lint command.
33+
required: false
34+
default: true
35+
type: boolean
36+
lint-command:
37+
description: Command used for lint validation.
38+
required: false
39+
default: npm run lint --if-present
40+
type: string
41+
run-test:
42+
description: Run automated tests.
43+
required: false
44+
default: true
45+
type: boolean
46+
test-command:
47+
description: Command used to run test suite.
48+
required: false
49+
default: npm test --if-present
50+
type: string
51+
52+
jobs:
53+
quality:
54+
name: Quality
55+
runs-on: ubuntu-latest
56+
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
with:
61+
fetch-depth: ${{ inputs.checkout-fetch-depth }}
62+
63+
- name: Set up Node.js
64+
if: ${{ inputs.setup-node }}
65+
uses: actions/setup-node@v4
66+
with:
67+
node-version: ${{ inputs.node-version }}
68+
cache: npm
69+
70+
- name: Install dependencies
71+
if: ${{ inputs.setup-node }}
72+
run: npm ci
73+
74+
- name: Format check
75+
if: ${{ inputs.run-format-check }}
76+
run: ${{ inputs.format-command }}
77+
78+
- name: Lint
79+
if: ${{ inputs.run-lint }}
80+
run: ${{ inputs.lint-command }}
81+
82+
- name: Test
83+
if: ${{ inputs.run-test }}
84+
run: ${{ inputs.test-command }}

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Thanks for your interest in contributing.
1212

1313
1. Fork and create a branch: `feature/short-description`
1414
2. Make your changes with clear commit messages.
15-
3. Run tests/lint locally (if configured).
15+
3. Run local validation (`format:check`, `lint`, `test`) before opening your PR.
1616
4. Open a pull request using the PR template.
1717

1818
## Pull request checklist
@@ -22,3 +22,8 @@ Thanks for your interest in contributing.
2222
- [ ] Docs are updated (if behavior changed)
2323
- [ ] Changelog updated (if needed)
2424

25+
## Local automation defaults
26+
27+
- Bootstrap: `./scripts/bootstrap.sh`
28+
- Setup guide: `docs/developer-setup.md`
29+
- CI workflows: `.github/workflows/`

docs/developer-setup.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Developer Setup
2+
3+
This guide provides generic onboarding defaults intended for template-based repositories.
4+
5+
## 1) Prerequisites
6+
7+
- Git 2.40+
8+
- A language runtime/toolchain for your project (Node, Python, Go, etc.)
9+
- A package manager (`npm`, `pnpm`, `pip`, `poetry`, `go`, etc.)
10+
11+
## 2) Bootstrap locally
12+
13+
```bash
14+
git clone <your-repo-url>
15+
cd <your-repo>
16+
./scripts/bootstrap.sh
17+
```
18+
19+
If your repository is not Node.js based, adapt `scripts/bootstrap.sh` to your stack and keep command names consistent with CI.
20+
21+
## 3) Recommended task contract
22+
23+
To keep automation portable, define task commands with predictable names:
24+
25+
- `format:check` — formatting validation
26+
- `lint` — static analysis/linting
27+
- `test` — automated tests
28+
29+
This template's reusable workflow can call any shell command, but these names improve discoverability.
30+
31+
## 4) CI customization
32+
33+
The repository ships with:
34+
35+
- `.github/workflows/reusable-quality.yml` (reusable workflow)
36+
- `.github/workflows/ci.yml` (default entry workflow)
37+
- `.github/workflows/release.yml` (semantic release PR/tag automation)
38+
39+
In `ci.yml`, enable checks by setting:
40+
41+
- `setup-node: true` for JS/TS projects
42+
- `run-format-check: true`
43+
- `run-lint: true`
44+
- `run-test: true`
45+
46+
Then optionally override commands:
47+
48+
```yaml
49+
with:
50+
setup-node: true
51+
format-command: npm run format:check
52+
lint-command: npm run lint
53+
test-command: npm test
54+
```
55+
56+
## 5) Branch and PR workflow
57+
58+
1. Create a branch from `main`.
59+
2. Run local validation commands before opening a PR.
60+
3. Open a focused PR and include context for reviewers.
61+
4. Merge only when CI checks pass.
62+
63+
## 6) Lightweight automation standards
64+
65+
- Keep workflows minimal and composable.
66+
- Prefer reusable workflows (`workflow_call`) over duplicated YAML.
67+
- Avoid stack-specific assumptions in template defaults.
68+
- Keep commands configurable through workflow inputs.
69+
- Fail fast in CI and keep logs clear.

scripts/bootstrap.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
if [[ ! -f package.json ]]; then
5+
echo "No package.json found. This bootstrap script is currently oriented to Node.js projects."
6+
echo "Copy and adapt scripts/bootstrap.sh for your stack (Python, Go, Rust, etc.)."
7+
exit 0
8+
fi
9+
10+
if command -v npm >/dev/null 2>&1; then
11+
npm ci
12+
echo "Dependencies installed."
13+
else
14+
echo "npm is not installed. Please install Node.js 20+ and retry."
15+
exit 1
16+
fi

0 commit comments

Comments
 (0)