A unit sphere possesses an induced metric,
$$ds^2=d\theta^2 + r^2\sin^2\theta d\phi^2$$
By applying the Cartan formalism, for a basis $e^\theta = d\theta$ and $e^\phi=r\sin\theta d\phi$, I found,
$$R^{\phi}_\theta = e^\theta \wedge e^\phi$$
and $R^\theta_\phi=-R^\phi_\theta$. The Pfaffian of the curvature $2$-form, as it is skew-symmetric, is simply,
$$\mathrm{Pf}[\mathcal{R}]=e^\theta \wedge e^\phi$$
I can now apply the Chern-Gauss-Bonnet theorem:
$$\frac{1}{2\pi}\int_{S^2} e^\theta \wedge e^\phi =2$$
which implies the genus of a sphere is $g=0$ as expected. As a physicist, none of this has been beyond my capabilities in differential geometry. But to apply the Chern-Gauss-Bonnet theorem, I had to know that $M=S^2$ was compact. Is there a way to prove this in a physicist-friendly manner, and more generally are there procedures to do so for general manifolds $M$?
The reason I ask is because when I'm solving the Einstein field equations, and I get a metric, I'd like to know if the spacetime is compact, so I can apply Chern-Gauss-Bonnet to gain additional information, i.e. the number of handles.
It's possible I've misread your intent, but here are a couple of thoughts on why your question seems unlikely to have a simple answer:
Mathematicians have idioms for showing a manifold is compact, e.g., it's a closed, bounded subset of some Euclidean space; a smooth, closed subvariety of some projective space; a bundle with compact fibres over a compact base, .... Further, mathematicians construct explicit metrics by starting with a known manifold, covering with (usually dense) open sets on which the metric can be expressed conveniently, and proving these metrics extend to the entire space. These proofs depend on the known global structure of the manifold.
In my experience, physicists' situation (when they ask questions such as yours) is usually different: There is a coordinate representation of a metric, and the issue is to find a compact Riemannian or Lorentzian manifold and a dense, open set on which the "global" metric has the given coordinate representation. That's a difficult problem in general.
In your example of the round sphere, the metric came from a known parametrization of the sphere minus a closed half-longitude. If that fact had not been known, and only the coordinate expression for the metric were given, it would not have been so easy to determine your metric came from a compact manifold.
If these comments don't address what you want, it would help if you could say more about the form in which metrics come to you.