GitHub Codespaces and online development

In our previous posting, we discussed using VSCode’s Dev Container extension to allow running workspaces directly within a Docker container.

In December 2020, I was granted early access to a new feature developed by GitHub called Codespaces. Codespaces offers an online VSCode development environment, enabling you to develop entirely in the cloud.

The great news is that Codespaces uses the same core process, and file structure, as Dev Containers; meaning once we have our .devcontainer folder setup (if you are unfamiliar with Dev Containers it is worth reading the previous blog first) “it just works” online.

TDD in the cloud

Using our example from the previous blog (GoogleTest and meson) to run using Codespaces is Simples!.

When granted Codespaces access, open the GitHub project and under the Clone or download button you are offered the option Open with Codespaces

Select Open with Codespaces and then New Codespaces

Codespaces will now open and begin building the Docker container based on the .devcontainer configuration

Once built, we are running VSCode as if running a Dev Container locally on our machine.

Using our example, we can now build and test the meson/gtest project.

Coding on an iPad via Codespaces

One immediate benefit of Codespaces enables me to continue development anywhere I have access to a browser. For example, here is the same project running using Firefox on an iPad.

The bad news

As Ted Hughes famously wrote

‚ÄúNothing is free. Everything has to be paid for.”

Codespaces are hosted by GitHub and is free to use during the beta stage. When Codespaces becomes generally available, users will be billed for storage and compute usage (starting at $0.085/hour).

Each Codespaces instance also incurs monthly storage costs until it is deleted. Storage costs for all instance types are $0.10/GB-month.

It’s difficult to gauge at the moment what that may add up to (possibly a couple of dollars a month) and, like most things in life, it’s up to you whether this is value-for-money; but I have already seen a significant benefit in my day-to-day work.

Summary

As previously stated, integration of VSCode, GitHub and Docker is a quite exciting offering. Using this feature within a web browser opens up new opportunities for development practices.

It has always been a frustration that attempting to do C/C++ development on a mobile/lightweight device, such as an iPad, has been difficult. It has typically involved setting up remote machines and using SSH (Secure Shell) access to write code.

This combination of Dev Containers and Codespaces offer a ubiquitous programming environment, aiding code quality improvements through standardisation of environments. As a side-effect of using Docker containers, I have found it forces the issues of defining a standard set of tools to the forefront of people’s minds, and improves project “hygiene”.

Sometimes there are benefits to be on the “bleeding edge“!.

To join the beta waitlist for Codespaces, see Sign up for Codespaces beta.

Dislike (0)

About Niall Cooling

Co-Founder and Director of Feabhas since 1995. Niall has been designing and programming embedded systems for over 30 years. He has worked in different sectors, including aerospace, telecomms, government and banking. His current interest lie in IoT Security and Agile for Embedded Systems.
This entry was posted in Agile, C/C++ Programming, General, Industry Analysis, Testing and tagged , , , , , . Bookmark the permalink.

Leave a Reply