Should I run tests for the entire core and contributed modules, or only for the codes I wrote? I am planning to integrate unit testing in CI/CD. I wonder what would be the good practice for running. 

Should I run tests for the entire core and contributed modules, or only for the codes I wrote?
The whole point of doing unit testing is verifying code functionality and preventing regression bugs on new code changes. Unless you're working on some development branch (i.e. not a release), running 3rd party vendor (core, contrib modules) unit tests is redundant; you should write unit tests for code that you're maintaining and trying to keep reliable and bug free.