Heavy quarks are effective probes to study the properties of the quark-gluon plasma (QGP) produced in ultra-relativistic heavy-ion collisions. In this contribution, the latest results on open heavy-flavour production in pp and Pb-Pb collisions measured by the ALICE Collaboration will be discussed. Measurements of open heavy-flavour production in Pb-Pb collisions allow for testing the mechanisms of heavy-quark transport and energy loss in the medium. In addition, measurements of the elliptic (v 2) and triangular (v 3) flow coefficients of heavy-flavour particles give insights into the participation of heavy quarks in the collective motion of the medium, the path-length dependence of their in-medium energy loss, and recombination effects during the hadronisation. Finally, the directed flow (v 1) of open heavy-flavour particles is sensitive to the unprecedentedly strong magnetic fields present in the early stages of the collision, and so measurements of its charge dependence are key to constraining the electrical conductivity of the QGP. In small hadronic systems like pp, open heavy-flavour production provides the baseline for the investigation of hot-medium effects in heavy-ion collisions, as well as tests of perturbative quantum chromodynamic calculations.