docs: sync README, CHANGELOG and docs with the current state
This commit is contained in:
+77
-71
@@ -1,101 +1,107 @@
|
||||
# Contributing to gasm-devkit
|
||||
|
||||
## Prerequisites
|
||||
Thanks for contributing to gasm-devkit.
|
||||
|
||||
- Go 1.27 or later (`toolchain go1.27.0`)
|
||||
- `just` command runner
|
||||
- A Linux host on amd64, arm64, riscv64 or loong64
|
||||
## Development setup
|
||||
|
||||
## Development Setup
|
||||
Requirements: Go 1.27 or later, the [just](https://github.com/casey/just)
|
||||
command runner, and a Linux host on amd64, arm64, riscv64 or loong64.
|
||||
|
||||
```sh
|
||||
git clone https://sourcedock.dev/petrbalvin/gasm-devkit.git
|
||||
cd gasm-devkit
|
||||
just install # download module dependencies
|
||||
just build # go vet + gofmt check
|
||||
just test # full test suite with race detector
|
||||
just test # full suite, race detector, 80 % coverage gate
|
||||
```
|
||||
|
||||
## Commands
|
||||
## Workflow
|
||||
|
||||
Every just recipe:
|
||||
1. Branch from `development`; never commit directly to `main` (`main` is
|
||||
release-only: merge from `development`, then tag).
|
||||
2. Commit with [Conventional Commits](https://www.conventionalcommits.org/):
|
||||
`type(scope): description`: subject line only, imperative mood,
|
||||
lowercase after the colon, no trailing dot. Allowed types: `feat`,
|
||||
`fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `ci`,
|
||||
`build`, `revert`. The only line after the subject is the trailer:
|
||||
`Assisted-by: <model-name>`. No `Co-Authored-By`, no `Signed-off-by`,
|
||||
no other trailers.
|
||||
3. Record every user-visible change in `CHANGELOG.md` under
|
||||
`## [development]` (categories: Added, Changed, Fixed, Removed,
|
||||
Security).
|
||||
4. Add or update tests; coverage must stay **at or above 80 %** (hard
|
||||
gate, enforced by CI).
|
||||
5. Update the documentation when behaviour, flags or the public surface
|
||||
change.
|
||||
6. Open a pull request against `development`.
|
||||
|
||||
| Recipe | What it does |
|
||||
|--------|-------------|
|
||||
| `just` | List all recipes |
|
||||
| `just install` | `go mod download` |
|
||||
| `just build` | `go vet ./...` + `gofmt -l .` check — zero errors required |
|
||||
| `just test` | `go test -race -count=1 -coverprofile=coverage.out ./...` + 80 % coverage gate |
|
||||
| `just fmt` | `gofmt -w .` |
|
||||
| `just run -- lint file.s` | Run the CLI with `go run` (args after `--`) |
|
||||
| `just install-bin` | Install `gasm` into `$GOBIN` with the release version stamped |
|
||||
| `just gen` | Regenerate `arch/*_gen.go` instruction tables from the Go toolchain |
|
||||
| `just uninstall` | Remove build artefacts (`coverage.out`, `gasm`, `*.test`) |
|
||||
Releases are cut by merging `development` into `main` and tagging `vX.Y.Z`;
|
||||
CI builds and publishes the binaries for all four architectures.
|
||||
|
||||
## Running a Single Test
|
||||
## Code style
|
||||
|
||||
`gofmt` and `go vet` via `just fmt` / `just build`; both must pass with
|
||||
zero output; `go fix -diff ./...` must report nothing on touched packages.
|
||||
|
||||
- Standard library only in production code; `golang.org/x/arch` is used
|
||||
in tests only (round-trip decoding) and is never linked into the `gasm`
|
||||
binary.
|
||||
- No cgo, no C, no external toolchains at runtime.
|
||||
- Explicit `if err != nil`; errors wrapped with
|
||||
`fmt.Errorf("context: %w", err)`; no panics outside `main`.
|
||||
- The parser, lexer and formatter are hand-written; the `arch` instruction
|
||||
tables are generated only via `_gen/gen.go` (`just gen`), never edited.
|
||||
|
||||
## Running a single test
|
||||
|
||||
```sh
|
||||
go test -run TestVexGroundTruth ./asm/
|
||||
go test -run TestDifferentialLZ4Fuzz ./verify/
|
||||
go test -run TestGroundTruthBasic ./verify/
|
||||
go test -run TestGOObjectLinkAndRun ./asm/
|
||||
go test -run TestFuzzWideCopy ./verify/
|
||||
```
|
||||
|
||||
## Testing the Debugger
|
||||
The interactive debugger (`gasm debug`) requires a compiled binary on
|
||||
`$PATH`; `go run` does not work for the traced child process. Install
|
||||
first with `just install-bin`.
|
||||
|
||||
The interactive debugger (`gasm debug`) requires a compiled binary —
|
||||
`go run` does not work for the child process. Install first:
|
||||
## CI (Gitea Actions)
|
||||
|
||||
```sh
|
||||
just install-bin
|
||||
gasm debug --func add testdata/verify/basic_amd64.s
|
||||
```
|
||||
Workflows live in `.gitea/workflows/` and run on self-hosted runners:
|
||||
|
||||
## Code Style
|
||||
| Workflow | Trigger | What it does |
|
||||
|----------|---------|--------------|
|
||||
| Test | push / PR to `development` | gofmt check, `go vet`, `go test -race`, 80 % coverage gate |
|
||||
| Release | tag `v*` | cross-compiles binaries for linux/{amd64,arm64,riscv64,loong64} and publishes the Gitea release |
|
||||
|
||||
See [AGENTS.md](AGENTS.md) for the full style guide. Key points:
|
||||
The Definition of Done (`just build` + `just test` + `just fmt`) must
|
||||
still pass locally before pushing.
|
||||
|
||||
- `gofmt` — zero diff.
|
||||
- `go vet` — zero warnings.
|
||||
- Standard library only in production code; `golang.org/x/arch` in tests.
|
||||
- No cgo, no C, no JavaScript.
|
||||
- Hand-written Plan 9 assembly; tables generated only via `_gen/gen.go`.
|
||||
## AI Contribution Policy
|
||||
|
||||
## Branches and Releases
|
||||
AI tools are welcome as productivity aids. What matters is that
|
||||
contributions remain understandable, reviewable, and genuinely useful.
|
||||
|
||||
- `development` is the working branch.
|
||||
- `main` is release-only: `git merge --ff-only development`, then `git tag vX.Y.Z`.
|
||||
- Conventional Commits: `feat(asm): add EVEX gather and scatter`.
|
||||
- Every commit ends with `Assisted-by: <model-name>`.
|
||||
- **Disclose AI use.** If you used AI to draft or generate any part of a
|
||||
commit, issue, pull request, or code review, say so clearly.
|
||||
- **Commit messages:** end every commit with exactly one trailer:
|
||||
`Assisted-by: <model-name>` (e.g. `Assisted-by: GLM 5.3`).
|
||||
- **Pull requests and issues:** attribute AI assistance in one trailing
|
||||
line, e.g. `_Assisted-by: GLM 5.3_`. Do not paste it into the PR
|
||||
description as a section.
|
||||
- **Take responsibility.** You remain accountable for the accuracy,
|
||||
completeness, and intent of everything you submit.
|
||||
- **Review before marking ready.** Read AI-generated diffs carefully, run
|
||||
them locally, and add or update tests where appropriate.
|
||||
- **Preferred models.** Prefer open-weight models with transparent
|
||||
training data: **GLM**, **DeepSeek**, and **MiMo**.
|
||||
|
||||
## CI
|
||||
|
||||
CI runs on every push to `development` and on pull requests:
|
||||
|
||||
- **Test** (`test.yml`) — `gofmt` check, `go vet`, `go test -race` and the
|
||||
80 % coverage gate.
|
||||
- **Release** (`release.yml`) — cross-compiles release binaries for
|
||||
linux/{amd64,arm64,riscv64,loong64} on version tags and publishes them.
|
||||
|
||||
The Definition of Done (`just build` + `just test` + `just fmt`) must still
|
||||
pass locally before pushing.
|
||||
|
||||
## AI-Assisted Contributions
|
||||
|
||||
AI agents may assist with code, documentation, tests, and review. All
|
||||
AI-assisted changes must:
|
||||
|
||||
- Include the trailer `Assisted-by: <model-name>` in the commit message
|
||||
(e.g. `Assisted-by: DeepSeek V4 Pro`).
|
||||
- Follow the [AGENTS.md](AGENTS.md) rules.
|
||||
- Pass the Definition of Done before committing.
|
||||
|
||||
Attribute agent authorship in issues and pull requests on one trailing
|
||||
line:
|
||||
|
||||
```
|
||||
_Assisted-by: Qwen 3.8 Max_
|
||||
```
|
||||
|
||||
## Questions
|
||||
## Reporting bugs
|
||||
|
||||
Open an issue at
|
||||
[sourcedock.dev/petrbalvin/gasm-devkit](https://sourcedock.dev/petrbalvin/gasm-devkit/issues).
|
||||
[sourcedock.dev/petrbalvin/gasm-devkit](https://sourcedock.dev/petrbalvin/gasm-devkit/issues)
|
||||
with the version (`gasm --version`), OS and architecture, the exact
|
||||
command, the full output, and the expected versus actual behaviour.
|
||||
|
||||
**Security issues:** email **opensource@petrbalvin.org** instead of opening
|
||||
a public issue.
|
||||
|
||||
Reference in New Issue
Block a user