  We build nearly topological quantum field theories in various dimensions. We
give special attention to the case of 8 dimensions for which we first consider
theories depending only on Yang-Mills fields. Two classes of gauge functions
exist which correspond to the choices of two different holonomy groups in
SO(8), namely SU(4) and Spin(7). The choice of SU(4) gives a quantum field
theory for a Calabi-Yau fourfold. The expectation values for the observables
are formally holomorphic Donaldson invariants. The choice of Spin(7) defines
another eight dimensional theory for a Joyce manifold which could be of
relevance in M- and F-theories. Relations to the eight dimensional
supersymmetric Yang-Mills theory are presented. Then, by dimensional reduction,
we obtain other theories, in particular a four dimensional one whose gauge
conditions are identical to the non-abelian Seiberg-Witten equations. The
latter are thus related to pure Yang-Mills self-duality equations in 8
dimensions as well as to the N=1, D=10 super Yang-Mills theory. We also exhibit
a theory that couples 3-form gauge fields to the second Chern class in eight
dimensions, and interesting theories in other dimensions.
