how to build only if tests are passed