Star formation and mass assembly in high-redshift galaxies