A search for $CP$ violation in $D^{pm}rightarrow eta^{prime} pi^{pm}$ and $D^{pm}_{s}rightarrow eta^{prime} pi^{pm}$ decays is performed using proton-proton collision data, corresponding to an integrated luminosity of $3$ fb$^{-1}$, recorded by the LHCb experiment at centre-of-mass energies of $7$ and $8$ TeV. The measured $CP$-violating charge asymmetries are $A_{CP}(D^{pm} rightarrow eta^{prime} pi^{pm})=(-0.61pm 0.72 pm 0.53 pm 0.12)%$ and $A_{CP}(D^{pm}_{s}rightarrow eta^{prime} pi^{pm})=(-0.82pm 0.36 pm 0.22 pm 0.27)%$, where the first uncertainties are statistical, the second systematic, and the third are the uncertainties on the $A_{CP}(D^{pm} rightarrow K^0_S pi^{pm})$ and $A_{CP}(D^{pm}_{s}rightarrow phi pi^{pm})$ measurements used for calibration. The results represent the most precise measurements of these asymmetries to date.