Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 995 Bytes

README.md

File metadata and controls

26 lines (19 loc) · 995 Bytes

shouldGoTestsRun

Tool used to determine if files changed in git branch would affect specified test files.

Intended to be used by CI resources to determine if tests need to be ran.

Currently your base folder name needs to be the same as your root go.mod module name

Example:

Want to test this? Clone the repo, and run make build then make test. Then change some file in a test, run the command again. Then change it in a file the test imports, then run make test again. See how the tool walks the import trees and determines that the tests need to be ran.

Gitlab ci:
example_job:
  stage: test
  script:
    - cd $BASE_GIT_DIR
    # This will exit 1 if the tests don't need to be ran
    - if shouldGoTestsRun -test-dir ./tests -base-folder-name $REPO_NAME -comparison-branch-name origin/master; then exit 0; fi
    - go test ./tests 

TODO: