Formation of planetary systems by pebble accretion and migration