|
1 | 1 | # Maintainer's guide |
2 | 2 |
|
3 | | -**DRAFT** |
| 3 | +## Repo structure |
4 | 4 |
|
5 | | -(to be completed) |
| 5 | +Single go module. |
| 6 | + |
| 7 | +> **NOTE** |
| 8 | +> |
| 9 | +> Some `go-openapi` repos are mono-repos with multiple modules, |
| 10 | +> with adapted CI workflows. |
6 | 11 |
|
7 | 12 | ## Repo configuration |
8 | 13 |
|
9 | | -* branch protection |
10 | | -* required PR checks |
11 | | -* auto-merge feature |
| 14 | +* default branch: master |
| 15 | +* protected branches: master |
| 16 | +* branch protection rules: |
| 17 | + * require pull requests and approval |
| 18 | + * required status checks: |
| 19 | + - DCO (simple email sign-off) |
| 20 | + - Lint |
| 21 | + - tests completed |
| 22 | +* auto-merge enabled (used for dependabot updates) |
12 | 23 |
|
13 | 24 | ## Continuous Integration |
14 | 25 |
|
15 | 26 | ### Code Quality checks |
16 | 27 |
|
17 | 28 | * meta-linter: golangci-lint |
18 | | -* linter config |
| 29 | +* linter config: [`.golangci.yml`](../.golangci.yml) (see our [posture](./STYLE.md) on linters) |
19 | 30 |
|
20 | | -* Code quality assessment: CodeFactor |
| 31 | +* Code quality assessment: [CodeFactor](https://www.codefactor.io/dashboard) |
21 | 32 | * Code quality badges |
22 | | - * go report card |
23 | | - * CodeFactor |
| 33 | + * go report card: <https://goreportcard.com/> |
| 34 | + * CodeFactor: <https://goreportcard.com/> |
| 35 | + |
| 36 | +> **NOTES** |
| 37 | +> |
| 38 | +> codefactor inherits roles from github. There is no need to create a dedicated account. |
| 39 | +> |
| 40 | +> The codefactor app is installed at the organization level (`github.com/go-openapi`). |
| 41 | +> |
| 42 | +> There is no special token to setup in github for CI usage. |
24 | 43 |
|
25 | 44 | ### Testing |
26 | 45 |
|
27 | | -* test reports |
28 | | -* test coverage reports |
| 46 | +* Test reports |
| 47 | + * Uploaded to codecov: <https://app.codecov.io/analytics/gh/go-openapi> |
| 48 | +* Test coverage reports |
| 49 | + * Uploaded to codecov: <https://app.codecov.io/gh/go-openapi> |
| 50 | + |
| 51 | +* Fuzz testing |
| 52 | + * Fuzz tests are handled separately by CI and may reuse a cached version of the fuzzing corpus. |
| 53 | + At this moment, cache may not be shared between feature branches or feature branch and master. |
| 54 | + The minimized corpus produced on failure is uploaded as an artifact and should be added manually |
| 55 | + to `testdata/fuzz/...`. |
| 56 | + |
| 57 | +Coverage threshold status is informative and not blocking. |
| 58 | +This is because the thresholds are difficult to tune and codecov oftentimes reports false negatives |
| 59 | +or may fail to upload coverage. |
| 60 | + |
| 61 | +All tests use our fork of `stretchr/testify`: `github.com/go-openapi/testify`. |
| 62 | +This allows for minimal test dependencies. |
| 63 | + |
| 64 | +> **NOTES** |
| 65 | +> |
| 66 | +> codecov inherits roles from github. There is no need to create a dedicated account. |
| 67 | +> However, there is only 1 maintainer allowed to be the admin of the organization on codecov |
| 68 | +> with their free plan. |
| 69 | +> |
| 70 | +> The codecov app is installed at the organization level (`github.com/go-openapi`). |
| 71 | +> |
| 72 | +> There is no special token to setup in github for CI usage. |
| 73 | +> A organization-level token used to upload coverage and test reports is managed at codecov: |
| 74 | +> no setup is required on github. |
29 | 75 |
|
30 | 76 | ### Automated updates |
31 | 77 |
|
32 | 78 | * dependabot |
| 79 | + * configuration: [`dependabot.yaml`](../.github/dependabot.yaml) |
| 80 | + |
| 81 | + Principle: |
| 82 | + |
| 83 | + * codecov applies updates and security patches to the github-actions and golang ecosystems. |
| 84 | + * all updates from "trusted" dependencies (github actions, golang.org packages, go-openapi packages |
| 85 | + are auto-merged if they successfully pass CI. |
33 | 86 |
|
34 | 87 | * go version udpates |
35 | 88 |
|
| 89 | + Principle: |
| 90 | + |
| 91 | + * we support the 2 latest minor versions of the go compiler (`stable`, `oldstable`) |
| 92 | + * `go.mod` should be updated (manually) whenever there is a new go minor release |
| 93 | + (e.g. every 6 months). |
| 94 | + |
| 95 | +* contributors |
| 96 | + * a [`CONTRIBUTORS.md`](../CONTRIBUTORS.md) file is updated weekly, with all-time contributors to the repository |
| 97 | + * the `github-actions[bot]` posts a pull request to do that automatically |
| 98 | + * at this moment, this pull request is not auto-approved/auto-merged (bot cannot approve its own PRs) |
| 99 | + |
36 | 100 | ### Vulnerability scanners |
37 | 101 |
|
38 | | -* github CodeQL |
39 | | -* trivy |
40 | | -* govulnscan |
| 102 | +There are 3 complementary scanners - obviously, there is some overlap, but each has a different focus. |
| 103 | + |
| 104 | +* github `CodeQL` |
| 105 | +* `trivy` <https://trivy.dev/docs/latest/getting-started> |
| 106 | +* `govulnscan` <https://go.dev/blog/govulncheck> |
| 107 | + |
| 108 | +None of these tools require an additional account or token. |
| 109 | + |
| 110 | +Github CodeQL configuration is set to "Advanced", so we may collect a CI status for this check (e.g. for badges). |
| 111 | + |
| 112 | +Scanners run on every commit to master and at least once a week. |
| 113 | + |
| 114 | +Reports are centralized in github security reports for code scanning tools. |
41 | 115 |
|
42 | 116 | ## Releases |
43 | 117 |
|
44 | | -* release notes generator: git-cliff |
| 118 | +The release process is minimalist: |
| 119 | + |
| 120 | +* push a semver tag (i.e v{major}.{minor}.{patch}) to the master branch. |
| 121 | +* the CI handles this to generate a github release with release notes |
| 122 | + |
| 123 | +* release notes generator: git-cliff <https://git-cliff.org/docs/> |
| 124 | +* configuration: [`cliff.toml`](../.cliff.toml) |
| 125 | + |
| 126 | +Tags are preferably PGP-signed. |
| 127 | + |
| 128 | +The tag message introduces the release notes (e.g. a summary of this release). |
| 129 | + |
| 130 | +The release notes generator does not assume that commits are necessarily "conventional commits". |
| 131 | + |
| 132 | +## Other files |
| 133 | + |
| 134 | +Standard documentation: |
| 135 | + |
| 136 | +* [`CONTRIBUTING.md`](../.github/CONTRIBUTING.md) guidelines |
| 137 | +* [`DCO.md`](../.github/DCO.md) terms for first-time contributors to read |
| 138 | +* [`CODE_OF_CONDUCT.md`](../CODE_OF_CONDUCT.md) |
| 139 | +* [`SECURIY.md`](../SECURITY.md) policy: how to report vulnerabilities privately |
| 140 | +* [`LICENSE`](../LICENSE) terms |
| 141 | +* [`NOTICE`](../NOTICE) on supplementary license terms (original authors, copied code etc) |
| 142 | + |
| 143 | +Reference documentation (released): |
| 144 | + |
| 145 | +* [godoc](https://pkg.go/dev/go-openapi/jsonpointer) |
| 146 | + |
| 147 | +## TODOs & other ideas |
| 148 | + |
| 149 | +A few things remain ahead to ease a bit a maintainer's job: |
| 150 | + |
| 151 | +* reuse CI workflows (e.g. in `github.com/go-openapi/workflows`) |
| 152 | +* reusable actions with custom tools pinned (e.g. in `github.com/go-openapi/gh-actions`) |
| 153 | +* open-source license checks |
| 154 | +* auto-merge for CONTRIBUTORS.md (requires a github app to produce tokens) |
| 155 | +* more automated code renovation / relinting work (possibly built with CLAUDE) |
| 156 | +* organization-level documentation web site |
| 157 | +* ... |
0 commit comments