In this paper, we systematically study gravitational waves (GWs) produced by remote compact astrophysical sources. To describe such GWs properly, we introduce three scales, $lambda, ; L_c$ and $L$, denoting, respectively, the typical wavelength of GWs, the scale of the cosmological perturbations, and the size of the observable universe. For GWs to be detected by the current and foreseeable detectors, the condition $lambda ll L_c ll L$ holds, and such GWs can be well approximated as high-frequency GWs. In order for the backreaction of the GWs to the background to be negligible, we must assume that $left|h_{mu u}right| ll 1$, in addition to the condition $epsilon ll 1$, which are also the conditions for the linearized Einstein field equations for $h_{mu u}$ to be valid, where $g_{mu u} = gamma_{mu u} + epsilon h_{mu u}$, and $gamma_{mu u}$ denotes the background. To simplify the field equations, we show that the spatial, traceless, and Lorentz gauge conditions can be imposed simultaneously, even when the background is not vacuum, as long as the high-frequency GW approximation is valid. However, to develop the formulas that can be applicable to as many cases as possible, we first write down explicitly the linearized Einstein field equations by imposing only the spatial gauge. Applying the general formulas together with the geometrical optics approximation to such GWs, we find that they still move along null geodesics and its polarization bi-vector is parallel-transported, even when both the cosmological scalar and tensor perturbations are present. In addition, we also calculate the gravitational integrated Sachs-Wolfe effects, whereby the dependences of the amplitude, phase and luminosity distance of the GWs on these two kinds of perturbations are read out explicitly.