Refactor to use AMD and support testing.

Converted internals to AMD and added a workflow for testing.