Developing apps with Habitat Workflow

Hi all! We have been developing apps with Habitat for quite some time. We love the benefits of how anyone can just checkout our codebase run one or two commands to get their dev environment up and running in no time.

Our general workflow has always been this:

  1. Make a new feature branch
  2. Start making code changes
  3. Run “build /path/to/component”, which does lint/style, build, unit test, create artifact
  4. If successful submit the feature branch for review.

While it has been very simple and gratifying, our repo is a huge monorepo with various components mostly written in C/C++. We have a few common libraries and over 20 components. With that we have required our contributors to run this build all script that will literally build everything making sure everything is good to go.

One major complaint that keeps coming up over time is how long our build takes. 30 mins and counting. Our build all script is definitely serial - things could be done in parallel. I see there are ways to disable artifact creation.

However, I’m reaching out to the community to know what your dev workflows have been like?

1 Like

When you say the build is “serial”, do you mean you build one Habitat artifact at time?

Yes. In our script that we use locally on our workstations, we build them one by one. I don’t know any other way to make it parallel.

The thing that chews up time is preparing the studio with harts and then creating the hart.

I’m wondering if we just make the build process more native like just run make for instance. However I worry about all the flags, includes, lib paths, etc that habitat provides…

There are a couple things you could explore here. I’d definitely check out the way we’ve got the studio configured in the builder repo. Now, it used to be more services and we’ve pared it down but the strategies might still be useful.

Effectively we use a .studiorc file for studio prep, and we’ve added some custom functions and helpers in there. One of the things that elliott added was running an sccache service which really helped with speed of the feedback loop in our dev cycle. It’s taken some thinking outside the box but it might be worth a look!

1 Like

Thanks for the tips @eeyun! We recently just added ccache and that definitely helped reduce our build times. It is similar to sccache.

We also have plans to building in an option in our plans to disable the packaging step during development. We always run “make” within the studio and not outside of it. We have noticed the packaging step is taking a huge chunk of time.

Studio creates .studio in its root so you can do in Makefile target

.PHONY: require-studio
require-studio: /.studio

        @echo "Looks like you're running Makefile from real world"
        @echo "But it designed to run inside a studio"
        @echo "Use: hab studio run make $(MAKECMDGOALS)"
        @exit 1

Hrmm now that’s thinking outside the box! Might have to explore that a bit.