Skip to content

Commit fe76bd1

Browse files
authored
Merge pull request #31 from randoneering/feat/enhance_ci
Feat/enhance ci
2 parents a5ce3f3 + 6ac0860 commit fe76bd1

3 files changed

Lines changed: 243 additions & 6 deletions

File tree

.github/CONTRIBUTING.md

Lines changed: 95 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,103 @@ This project follows the [Contributor Covenant](https://www.contributor-covenant
88

99
## Ways to Contribute
1010

11-
- **New health checks** - Propose or implement checks for database issues not yet covered. Use `feature/` for new health checks
12-
- **Bug fixes** - Found something broken? PRs welcome. Use `bug/` for bug fix branches
13-
- **Documentation** - Improve README, add examples, clarify explanations. Use `docs/` for any documentation releated contributions
11+
- **New health checks** - Propose or implement checks for database issues not yet covered
12+
- **Bug fixes** - Found something broken? PRs welcome
13+
- **Documentation** - Improve README, add examples, or clarify explanations
1414
- **Testing** - Validate checks across PostgreSQL versions and cloud providers
1515
- **Feature requests** - Open an issue describing your idea
1616

1717
## Development Setup
1818

1919
The `testing/` directory contains integration and pgTAP coverage used to validate pgFirstAid against live PostgreSQL environments. You can run the test suite against any database you control by setting the standard PostgreSQL connection environment variables described in `testing/integration/README.md`.
2020

21+
## Conventional Commits
22+
23+
This project uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Every commit message should use this format:
24+
25+
```
26+
<type>[optional scope]: <description>
27+
28+
[optional body]
29+
[optional footer(s)]
30+
```
31+
32+
### Types
33+
34+
| Type | Usage | pgFirstAid example |
35+
|------|-------|--------------------|
36+
| `feat` | A new feature | `feat(checks): add check for inactive replication slots` |
37+
| `fix` | A bug fix | `fix(indexes): avoid false positives for partial duplicate indexes` |
38+
| `chore` | Maintenance, tooling, dependencies | `chore(ci): update PostgreSQL 18 test coverage` |
39+
| `docs` | Documentation changes | `docs: clarify managed view installation steps` |
40+
| `test` | Adding or fixing tests | `test(pgtap): cover long-running query check` |
41+
| `refactor` | Code restructuring with no behavior change | `refactor(views): align duplicate index query across install targets` |
42+
| `style` | Formatting or linting with no logic change | `style: normalize SQL indentation in pgFirstAid.sql` |
43+
| `perf` | Performance improvement | `perf(checks): reduce work in duplicate index detection` |
44+
| `ci` | CI/CD configuration | `ci: run integration suite against PostgreSQL 18` |
45+
| `build` | Build or packaging changes | `build: update integration harness setup` |
46+
| `revert` | Reverting a previous change | `revert: restore previous blocked session recommendation text` |
47+
48+
### Scopes
49+
50+
The optional scope should reference the part of the project you changed:
51+
52+
- `checks` - health check SQL logic
53+
- `views` - `view_pgFirstAid.sql` and `view_pgFirstAid_managed.sql`
54+
- `indexes` - duplicate index and index-related checks
55+
- `sessions` - session and blocking query checks
56+
- `pgtap` - pgTAP coverage in `testing/pgTAP/`
57+
- `integration` - Python integration tests in `testing/integration/`
58+
- `ci` - GitHub Actions and CI configuration
59+
- `docs` - README and contribution docs
60+
- `deps` - dependency updates
61+
- `release` - release preparation
62+
63+
### Examples
64+
65+
```
66+
feat(checks): add lock timeout recommendation for blocked sessions
67+
fix(views): keep managed and self-hosted duplicate index checks aligned
68+
docs: add contribution guidance for test coverage
69+
test(integration): verify long-running query output on seeded data
70+
chore(deps): update pytest in integration harness
71+
```
72+
73+
## Branch Naming
74+
75+
Branches should follow the pattern `type/description`, where `type` is one of the following:
76+
77+
| Branch prefix | When to use |
78+
|---------------|-------------|
79+
| `feat/` | New features |
80+
| `feature/` | New features (alternative to `feat/`) |
81+
| `fix/` | Bug fixes |
82+
| `chore/` | Maintenance tasks and dependency updates |
83+
| `doc/` | Documentation changes |
84+
| `docs/` | Documentation changes (alternative to `doc/`) |
85+
| `test/` | Adding or fixing tests |
86+
| `perf/` | Performance improvements |
87+
| `style/` | Formatting or lint-only changes |
88+
| `ci/` | CI/CD configuration changes |
89+
| `build/` | Build or packaging changes |
90+
| `revert/` | Reverting a previous change |
91+
| `refactor/` | Code restructuring without behavior changes |
92+
93+
Examples:
94+
95+
```
96+
feat/inactive-replication-slot-check
97+
fix/duplicate-index-predicate-matching
98+
docs/update-contributing-guide
99+
test/pgtap-blocked-session-coverage
100+
perf/reduce-duplicate-index-scan-work
101+
style/normalize-sql-indentation
102+
ci/add-postgres-18-matrix-job
103+
build/update-integration-harness-setup
104+
revert/remove-blocked-session-text-change
105+
refactor/align-view-check-ordering
106+
```
107+
21108
## Testing Requirements
22109

23110
Before submitting a PR, test your changes against:
@@ -39,16 +126,18 @@ Not everyone has access to all environments. Document what you tested in your PR
39126
## Submitting a Pull Request
40127

41128
1. Fork the repository
42-
2. Create a feature branch (`git checkout -b feature/new-health-check`)
129+
2. Create a branch following the naming convention above (`git checkout -b feat/new-health-check`)
43130
3. Make your changes
44-
4. Test against available PostgreSQL versions
45-
5. Submit a PR using the provided template
131+
4. Keep commits focused and follow Conventional Commits
132+
5. Test against available PostgreSQL versions
133+
6. Submit a PR using the provided template
46134

47135
### PR Review Process
48136

49137
- At least 1 maintainer must approve before merging
50138
- Be patient—this is a side project maintained in spare time
51139
- Expect acknowledgment within a reasonable timeframe, with detailed review to follow
140+
- Squash-merge is preferred. The final commit message should also follow Conventional Commits
52141

53142
## SQL Style Guidelines
54143

.github/release-drafter.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name-template: "v$RESOLVED_VERSION"
2+
tag-template: "v$RESOLVED_VERSION"
3+
4+
autolabeler:
5+
- label: "feat"
6+
branch:
7+
- '/feat\/.+/'
8+
- '/feature\/.+/'
9+
- label: "fix"
10+
branch:
11+
- '/fix\/.+/'
12+
- label: "docs"
13+
branch:
14+
- '/doc\/.+/'
15+
- '/docs\/.+/'
16+
- label: "test"
17+
branch:
18+
- '/test\/.+/'
19+
- label: "refactor"
20+
branch:
21+
- '/refactor\/.+/'
22+
- label: "chore"
23+
branch:
24+
- '/chore\/.+/'
25+
- label: "perf"
26+
branch:
27+
- '/perf\/.+/'
28+
- label: "style"
29+
branch:
30+
- '/style\/.+/'
31+
- label: "ci"
32+
branch:
33+
- '/ci\/.+/'
34+
- label: "build"
35+
branch:
36+
- '/build\/.+/'
37+
- label: "revert"
38+
branch:
39+
- '/revert\/.+/'
40+
41+
categories:
42+
- title: "Features"
43+
labels:
44+
- "feat"
45+
- title: "Bug Fixes"
46+
labels:
47+
- "fix"
48+
- title: "Documentation"
49+
labels:
50+
- "docs"
51+
- title: "Refactoring"
52+
labels:
53+
- "refactor"
54+
- title: "Testing"
55+
labels:
56+
- "test"
57+
- title: "Chores"
58+
labels:
59+
- "chore"
60+
- title: "Performance"
61+
labels:
62+
- "perf"
63+
- title: "Style"
64+
labels:
65+
- "style"
66+
- title: "CI/CD"
67+
labels:
68+
- "ci"
69+
- title: "Build"
70+
labels:
71+
- "build"
72+
- title: "Reverts"
73+
labels:
74+
- "revert"
75+
76+
change-template: "- $TITLE (#$NUMBER) by @$AUTHOR"
77+
change-title-escapes: '\<*_&'
78+
79+
version-resolver:
80+
major:
81+
labels:
82+
- "major"
83+
- "breaking"
84+
minor:
85+
labels:
86+
- "minor"
87+
- "feat"
88+
patch:
89+
labels:
90+
- "patch"
91+
- "fix"
92+
- "docs"
93+
- "refactor"
94+
- "test"
95+
- "chore"
96+
- "perf"
97+
- "style"
98+
- "ci"
99+
- "build"
100+
- "revert"
101+
default: patch
102+
103+
template: |
104+
## What's Changed
105+
106+
$CHANGES
107+
108+
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request_target:
8+
branches:
9+
- main
10+
types:
11+
- opened
12+
- reopened
13+
- synchronize
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
autolabel-pr:
20+
if: github.event_name == 'pull_request_target' && github.event.pull_request.head.repo.fork == false
21+
permissions:
22+
pull-requests: write
23+
runs-on: ubuntu-latest
24+
steps:
25+
- name: Apply release-drafter labels
26+
uses: release-drafter/release-drafter/autolabeler@v6 # v6.1.0
27+
28+
update-release-draft:
29+
if: github.event_name == 'push'
30+
permissions:
31+
contents: write
32+
pull-requests: read
33+
runs-on: [self-hosted, nix, nixos, x86_64-linux]
34+
steps:
35+
- name: Draft release notes
36+
uses: release-drafter/release-drafter@v6 # v6.1.0
37+
with:
38+
config-name: release-drafter.yml
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)