I bought a .17hmr to fill the gap between my .22lr & my 22-250. The .17hmr excels at taking small varmits at around 150 yards, which is what it was designed to do. I have been extremely impressed with the accuracy of the .17hmr, & it is significantly quieter to shoot than my 22-250.
I have used the .17hmr to take rabbits & foxes, no problems whatsoever, however the .17hmr lacks power for chest shots on goats & mid size pigs, even at 100 yards. If you can brain shoot game the size of goats & mid size pigs it will work, but the .17hmr is best suited to smaller varmits.
I would probably choose the .22 magnum over the .17hmr for your purpose, however as others have said a .223 would be more suited.