Public-sector spending on infrastructure has increased for the third year in succession, bringing it close to its 2016 peak.