The longest shutdown in US history is over after President Donald Trump signed a funding bill to reopen the government.