We propose a general method to compute $CP$-violating observables from extensions of the standard model in the context of electroweak baryogenesis. It is alternative to the one recently developed by Huet and Nelson and relies on a nonequilibrium quantum field theory approach. The method is valid for all shapes and sizes of the bubble wall expanding in the thermal bath during a first-order electroweak phase transition. The quantum physics of $CP$-violation and its suppression coming from the incoherent nature of thermal processes are also made explicit.