Skip to content

Commit 5b4e3dc

Browse files
authored
Go releaser (#3)
1 parent d3ac9e3 commit 5b4e3dc

5 files changed

Lines changed: 99 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v6
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v6
22+
with:
23+
go-version-file: go.mod
24+
25+
- name: Run GoReleaser
26+
uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2
27+
with:
28+
distribution: goreleaser
29+
version: "~> v2"
30+
args: release --clean
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ diagnose-*/
99

1010
.env
1111
.venv/
12+
dist/
1213
*.test
1314

1415
# Agents

.goreleaser.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
version: 2
2+
3+
project_name: testrig
4+
5+
before:
6+
hooks:
7+
- go test ./...
8+
9+
builds:
10+
- id: testrig
11+
main: ./cmd/testrig
12+
binary: testrig
13+
env:
14+
- CGO_ENABLED=0
15+
goos:
16+
- linux
17+
- darwin
18+
- windows
19+
goarch:
20+
- amd64
21+
- arm64
22+
23+
archives:
24+
- formats:
25+
- tar.gz
26+
format_overrides:
27+
- goos: windows
28+
formats:
29+
- zip
30+
31+
checksum:
32+
name_template: "checksums.txt"

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Contributing
2+
3+
Use [just](https://github.com/casey/just) instead of `make`.
4+
5+
```sh
6+
just lefthook # Install pre-commit and pre-push hooks
7+
```
8+
9+
## Releasing
10+
11+
Push a semver tag to publish cross-platform binaries to GitHub Releases:
12+
13+
```sh
14+
git tag v0.1.0 && git push --tags
15+
```
16+
17+
Local snapshot (builds to `dist/`, no publish):
18+
19+
```sh
20+
just goreleaser
21+
```

README.md

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ If you want to be sure that you have fixed a flaky test, or are chasing down a r
2626

2727
`testrig` enables a few QoL features for running large Go test suites efficiently. You can define test lifecycle hooks, and run from the CLI, or from a lightweight Go setup.
2828

29+
### Lifecycle Hooks
30+
31+
Run setup and teardown scripts during your test lifecycle.
32+
33+
<!-- testrig:gendocs:table -->
34+
| Option | When it runs | CLI equivalent |
35+
| ------ | ------------ | -------------- |
36+
| `testrig.GlobalSetup` | Run once before any tests | `--global-setup` |
37+
| `testrig.GlobalTeardown` | Run once after all tests finish | `--global-teardown` |
38+
| `testrig.IterationSetup` | Run before each diagnose iteration | `--iteration-setup` |
39+
| `testrig.IterationTeardown` | Run after each diagnose iteration | `--iteration-teardown` |
40+
<!-- /testrig:gendocs:table -->
41+
2942
### CLI
3043

3144
```sh
@@ -45,24 +58,3 @@ testrig diagnose --iterations 10 \
4558
### Native Go
4659

4760
You can import `testrig` as a Go package and define your hooks and defaults entirely in Go! See [the pkg.go.dev docs](https://pkg.go.dev/github.com/smartcontractkit/testrig#pkg-examples) for an example setup.
48-
49-
### Lifecycle Hooks
50-
51-
Run setup and teardown scripts during your test lifecycle.
52-
53-
<!-- testrig:gendocs:table -->
54-
| Option | When it runs | CLI equivalent |
55-
| ------ | ------------ | -------------- |
56-
| `testrig.GlobalSetup` | Run once before any tests | `--global-setup` |
57-
| `testrig.GlobalTeardown` | Run once after all tests finish | `--global-teardown` |
58-
| `testrig.IterationSetup` | Run before each diagnose iteration | `--iteration-setup` |
59-
| `testrig.IterationTeardown` | Run after each diagnose iteration | `--iteration-teardown` |
60-
<!-- /testrig:gendocs:table -->
61-
62-
## Contributing
63-
64-
Use [just](https://github.com/casey/just) instead of `make`.
65-
66-
```sh
67-
just lefthook # Install pre-commit and pre-push hooks
68-
```

0 commit comments

Comments
 (0)