diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ffea956 --- /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@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7.2.2 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index 16357a2..835cd07 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ diagnose-*/ .env .venv/ +dist/ *.test # Agents 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..be938ab 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,19 @@ 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 +58,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 -```