From 6ea63a48d14194f9b34bbe5e2ee3061e2ec16353 Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Thu, 28 May 2026 14:12:54 -0400 Subject: [PATCH 1/2] Go releaser --- .github/workflows/release.yml | 32 +++++++++++++++++++++++++++++++ .gitignore | 4 +--- .goreleaser.yaml | 32 +++++++++++++++++++++++++++++++ CONTRIBUTING.md | 21 ++++++++++++++++++++ README.md | 36 +++++++++++++++-------------------- 5 files changed, 101 insertions(+), 24 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml create mode 100644 CONTRIBUTING.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a7cadd7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +name: Release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v7 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index e04f680..f5e5759 100644 --- a/.gitignore +++ b/.gitignore @@ -9,10 +9,8 @@ diagnose-*/ .env .venv/ +dist/ -# Local Phoenix DB for evals/eval.py -evals/.phoenix/ -__pycache__/ # Agents .antigravitycli/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..60c0058 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,32 @@ +version: 2 + +project_name: testrig + +before: + hooks: + - go test ./... + +builds: + - id: testrig + main: ./cmd/testrig + binary: testrig + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + +archives: + - formats: + - tar.gz + format_overrides: + - goos: windows + formats: + - zip + +checksum: + name_template: "checksums.txt" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2347ecc --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,21 @@ +# Contributing + +Use [just](https://github.com/casey/just) instead of `make`. + +```sh +just lefthook # Install pre-commit and pre-push hooks +``` + +## Releasing + +Push a semver tag to publish cross-platform binaries to GitHub Releases: + +```sh +git tag v0.1.0 && git push --tags +``` + +Local snapshot (builds to `dist/`, no publish): + +```sh +just goreleaser +``` diff --git a/README.md b/README.md index d974a9e..b010020 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,21 @@ If you want to be sure that you have fixed a flaky test, or are chasing down a r `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. +### Lifecycle Hooks + +Run setup and teardown scripts during your test lifecycle. + + + +| Option | When it runs | CLI equivalent | +| --------------------------- | ---------------------------------- | ---------------------- | +| `testrig.GlobalSetup` | Run once before any tests | `--global-setup` | +| `testrig.GlobalTeardown` | Run once after all tests finish | `--global-teardown` | +| `testrig.IterationSetup` | Run before each diagnose iteration | `--iteration-setup` | +| `testrig.IterationTeardown` | Run after each diagnose iteration | `--iteration-teardown` | + + + ### CLI ```sh @@ -45,24 +60,3 @@ testrig diagnose --iterations 10 \ ### Native Go 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. - -### Lifecycle Hooks - -Run setup and teardown scripts during your test lifecycle. - - -| Option | When it runs | CLI equivalent | -| ------ | ------------ | -------------- | -| `testrig.GlobalSetup` | Run once before any tests | `--global-setup` | -| `testrig.GlobalTeardown` | Run once after all tests finish | `--global-teardown` | -| `testrig.IterationSetup` | Run before each diagnose iteration | `--iteration-setup` | -| `testrig.IterationTeardown` | Run after each diagnose iteration | `--iteration-teardown` | - - -## Contributing - -Use [just](https://github.com/casey/just) instead of `make`. - -```sh -just lefthook # Install pre-commit and pre-push hooks -``` From 94e35dce90d2caba94e5572c33139ed40ee8578e Mon Sep 17 00:00:00 2001 From: Adam Hamrick Date: Thu, 28 May 2026 14:15:03 -0400 Subject: [PATCH 2/2] version action --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7cadd7..ffea956 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: go-version-file: go.mod - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v7 + uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2 with: distribution: goreleaser version: "~> v2"