DEV Community

Cover image for Getting started with GitHub Actions for Rust
Roger Torres (he/him/ele)
Roger Torres (he/him/ele)

Posted on

14 1

Getting started with GitHub Actions for Rust

TL;DR: Create an Action on GitHub so your code gets built and tested after every push, and do all this with nothing more than a "next-next-finish".

You never used GitHub Actions and you want do do it with your Rust project; if that's the case, this might help you.

What is and Why GitHub Actions?

GitHub Actions automatize software workflow, which per se is not CI/CD (Continuous Integration/Continuous Delivery), but is used in this method.

So, which workflow are we going to automatize? Test and build. In other words, this:



$ cargo test
$ cargo build

Enter fullscreen mode Exit fullscreen mode




How to do it

First, open your GitHub repository and go to Actions.
GitHub Actions

The example is from this repository that I wrote about here.

This will lead you to this GitHub proposal, which will do exactly what we're set to do here, i.e., build and test:
Workflow proposal

GitHub will preview the .yml file it will create. For this scope, you don't have to change anything (except maybe the name from "Rust" to something else — I used "test").
yml preview

Commit the change clicking on the button that will appear on the right and the file will be created:
After commit

Now, if you go to Actions again, you will see GitHub creating your .yml file. For me, it took around 2 minutes.
Building ymlyml built

And that's it. From now on, every time you push against the repository, GitHub will run the tests for you.
After push

To see the result of the commit above, see the Build log here.


And that's all for today.

See ya 🙃

Cover image by Susan Q Yin

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay