In your example, you can do this analytically as the unperturbed potential in the harmonic oscillator, for which there are analytical solutions for the eigenenergies and eigenfunctions.
General formulae
Use perturbation theory and a sensible choice of your unperturbed basis.
The energy $E_n$ will be written as:
$$E_n = E_n^{(0)} + E_n^{(1)} + E_n^{(2)} + \dots ,$$
where the LHS is the true value and the LHS terms are $n^{\mathrm{th}}$ corrections.
Same thing for the wavefunction $\psi_n$:
$$\psi_n = \psi_n^{(0)} + \psi_n^{(1)} + \psi_n^{(2)} + \dots .$$
The first order correction for the energy $E_n^{(1)}$ is given by:
$$E_n^{(1)} = \int \psi_n^{(0)*} \hat{H}^{(1)} \psi_n^{(0)}, $$
the second order is:
$$E_n^{(2)} = \int \psi_n^{(0)*} \hat{H}^{(1)} \psi_n^{(1)}, $$
and so on.
The first order correction for the wavefunction is:
$$ \psi_n^{(1)} = \sum_{i\neq n} \psi_n^{(0)} \frac{\int \psi_i^{(0)*} \hat{H}^{(1)} \psi_n^{(0)}}{E_n^{(0)} - E_i^{(0)}} .$$
$H^{(1)}$ is the perturbation to the Hamiltonian.
You can combine the previous two formulae to re-write the second-order energy correction as:
$$ E_n^{(2)} = \sum_{i\neq n} \frac{| \int \psi_i^{(0)*} \hat{H}^{(1)} \psi_n^{(0)}|^2}{E_n^{(0)} - E_i^{(0)}} .$$
Your example
I am going to use $\hat{H}_1 = gx^3$ for the perturbed potential. The unperturbed potential is the harmonic potential so will use the analytical eigenergies and eigenfunctions for $E_n^0$ and $\psi^0_n$.
In your example, let's take $x^2/2$ to the the "basis" potential, which is none other than the harmonic oscillator which known and analytical wavefunctions (so that you can compute the integrals easily). The perturbed contribution $H^{(1)}$ is $gx^3$.
So the total energy $E$ will be the energy from the harmonic oscillator plus the correction due to the perturbed potential.
For the ground state then ($n=0$):
Zero-th order:
$$ E^{(0)} = \frac{1}{2}, $$
which is the harmonic (unperturbed potential) contribution.
First order:
$$ E^{(1)} = 0, $$
because $gx^3$ is odd.
Second order:
I did this with Mathematica using the last equation from the previous section. It converges after 3 terms in the sum and it gives:
$$ E^{(2)} = -1.375 g^2 = -\frac{11}{8}g^2.$$
Then you go on.
--- Addition: ---
Higher-order
I then copied all the 3rd, 4th and higher terms from wikipedia into Mathematica and got: