How can I use different config files in a same repo

I need to run the same End to End automation test for our application on multiple platforms i.e. Linux, Mac and Windows.
For that, the syntax and commands are definitely different for each config file.
For now, I am running each config file in a different branch with the same code cloned and a separate config file for each platform.

Is there any solution for that? Any workaround suggestion is welcome.

CircleCi seems to support what they call “Dynamic Configuration”, but the docs and examples make it hard work to understand. The best starting point seems to be this write-up on the subject.