How to run Xcode tests and then submit to Testflight

I can run tests on CircleCI, and I can separately build and submit to Testflight. However, I can’t work out a way to run tests and then if those tests past, submit that build to Testflight. Is it possible? I’d like to do this because one build takes 30 mins, and so I don’t want to eat into my time on CircleCI. I use fastlane for my tests/build/submission.