In Drupal 8 I would use the following code.
$current_user = \Drupal::currentUser();
$roles = $current_user->getRoles();
What is the equivalent code I should use in Drupal 7?
You can access the current user in D7 via the global $user object
global $user;
$roles = $user->roles;