[CI] Make the build configuration a class
Summary:
This is purely a refactor to make the main contain only the build logic,
and limit the amount of scoped variables.
The build will also be extracted as a class in a later diff.
Depends on D6748.
Test Plan: Run any CI build.
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6749