Characteristic classes of coherent sheaves on singular varieties Continuity of plurisubharmonic envelopes in non-Archimedean geometry and test ideals. With an appendix by José Ignacio Burgos Gil and Martín Sombra. 