Skip to content

Commit ad3eb17

Browse files
authored
docs: separate usage from development (#404)
1 parent 6c85658 commit ad3eb17

3 files changed

Lines changed: 102 additions & 378 deletions

File tree

CONTRIBUTING.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ When you submit a pull request, if you have not already done so, you will be pro
2727

2828
```bash
2929
# Mage is not technically required, the build tools may also be invoked
30-
# directly via 'go run magefile.go'
30+
# directly via `go run magefile.go` or `./magefile.go`
3131
go install github.com/magefile/mage@latest
3232
```
3333

@@ -47,7 +47,45 @@ When you submit a pull request, if you have not already done so, you will be pro
4747
mage build
4848
```
4949

50-
## Build System Reference
50+
5. Install the built tools to your `$GOPATH/bin` directory:
51+
52+
```bash
53+
mage install
54+
```
55+
56+
After running `mage install`, the tools will be available in your `$GOPATH/bin` directory.
57+
Not all systems will have this directory in their `$PATH` by default, so you may need to add it.
58+
59+
#### Azure Linux 3.0 as a development host
60+
61+
```bash
62+
# These instructions work for AzureLinux (https://github.com/microsoft/azurelinux)
63+
# While the tools should build and run on any system with golang installed, some of the runtime dependencies
64+
# may not be available on all systems (e.g., `mock`).
65+
tdnf install -y golang ca-certificates glibc-devel
66+
67+
git clone <URL>
68+
cd <REPO>
69+
70+
# You may want to permanently add $GOPATH/bin to your $PATH via
71+
# echo 'export GOPATH=$(go env GOPATH)' >> $HOME/.bashrc
72+
# echo 'export PATH=$PATH:${GOPATH}/bin' >> $HOME/.bashrc
73+
export GOPATH=$(go env GOPATH)
74+
export PATH=$PATH:${GOPATH}/bin
75+
go install github.com/magefile/mage@latest
76+
mage build
77+
mage install
78+
```
79+
80+
## Build Reference
81+
82+
All code in this repo is written in `golang`. The `golang` package is required to build and run the tools.
83+
84+
The build system uses mage, which can be installed with `go install github.com/magefile/mage@latest`. Alternatively, a zero-install approach is available through `go run magefile.go` or `./magefile.go`, which automatically downloads the required dependencies without manual installation. All additional build tools are managed automatically by go, and no manual tool installation is required.
85+
86+
All other tooling dependencies are handled by `go tool`, which will automatically get the required tools when using `mage`. See [the tools section](./tools/README.md) for more information.
87+
88+
This repo contains configs for the `golangci-lint` linter. It is installed as part of the [VSCode go extension](https://marketplace.visualstudio.com/items?itemName=golang.go). It's also optionally available as a [binary release](https://golangci-lint.run/welcome/install/#local-installation).
5189

5290
### Mage Commands
5391

@@ -56,6 +94,7 @@ When you submit a pull request, if you have not already done so, you will be pro
5694
| `mage -l` | List all available targets | To see all options |
5795
| `mage all` | Full build, test, and check pipeline | Before submitting PR |
5896
| `mage build` | Build Go binaries | After code changes |
97+
| `mage install` | Build Go binaries and install | Outer-loop testing |
5998
| `mage unit` | Run unit tests | After writing tests |
6099
| `mage scenario` | Run scenario tests (SLOW) | For major changes |
61100
| `mage scenarioUpdate` | Update test snapshots | When test expectations change |
@@ -183,6 +222,19 @@ mage -l
183222

184223
## Testing
185224

225+
Testing can be run with `mage`, or directly using `go test`. The `mage` build system is preferred as it can also automatically run the scenario tests and update the test expectations.
226+
227+
```bash
228+
# Run the unit tests
229+
mage unit
230+
231+
# Run the coverage tests, producing an .html report
232+
mage coverage
233+
234+
# Run scenario tests
235+
mage scenario
236+
```
237+
186238
See the [testing documentation](docs/how-to/testing.md) for detailed guidelines on writing and running tests.
187239

188240
## Pull Request Process

0 commit comments

Comments
 (0)