A magnitude 3.8 earthquake has rocked WA’s biggest mining town.