Ninefox Gambit by Yoon Ha Lee
Synopsis from GoodReads:
Captain Kel Cheris of the hexarchate is disgraced for using unconventional methods in a battle against heretics. Kel Command gives her the opportunity to redeem herself by retaking the Fortress of Scattered Needles, a star fortress that has recently been captured by heretics. Cheris’s career isn’t the only thing at stake. If the fortress falls, the hexarchate itself might be next.
Cheris’s best hope is to ally with the undead tactician Shuos Jedao. The good news is that Jedao has never lost a battle, and he may be the only one who can figure out how to successfully besiege the fortress.
The bad news is that Jedao went mad in his first life and massacred two armies, one of them his own. As the siege wears on, Cheris must decide how far she can trust Jedao–because she might be his next victim.