Skip to content

dev/sg/check.Runner: check-and-fix framework and experimental 'sg setupv2'

Warren Gifford requested to merge sg-thing-doer-framework into main

Created by: bobheadxi

The main interesting parts to review are in runner.go. Arguably this doesn't need too extensive of a review, since the aim is to get a sg setupv2 and the check.Runner framework out so that we can simultaneously:

  • Bring sg setupv2 back to parity with sg setup (notably migrate the Ubuntu setup), and cut over entirely
  • Rewrite sg lint to use check.Runner

Goals:

  1. Auto-fix-oriented sg setup - removing support for manual fixing for the most part
  2. Auto-fix support for sg lint (e.g. https://github.com/sourcegraph/sourcegraph/pull/36516)
  3. Shared infrastructure for "check lots of things and try to fix them" (sg lint, sg setup), so that e.g. we can get sg lint -interactive and sg setup -fix and a consistent experience across both + reduced engineering effort to maintain them, and improved packaging of sg setup code
  4. Better control over output, so that different scenarios can handle them differently
  5. Automated testing in GitHub Actions for MacOS and Ubuntu (terms and conditions apply, see below) (only MacOS checks have been migrated so far)

Related: https://github.com/sourcegraph/sourcegraph/issues/36512 , https://github.com/sourcegraph/sourcegraph/issues/36379

Closes https://github.com/sourcegraph/sourcegraph/issues/35805

A lot of copy-paste for now of the existing sg setup code, the goal is to eventually consoldiate and remove the existing sg setup implementation

Test plan

Experimental new implementation does not touch existing code, and is exported as sg setupv2 which is a hidden command:

go run ./dev/sg setupv2
go run ./dev/sg setupv2 -check
go run ./dev/sg setupv2 -fix

Automated tests now run over (a subset of) the new dependencies implementation:

  1. OSS-only (non-teammates)
  2. Docker excluded (setup is wonky on GitHub agents)

Example build: https://github.com/sourcegraph/sourcegraph/runs/6802415622?check_suite_focus=true

Merge request reports

Loading