DEV Community

dmrp
dmrp

Posted on

Team Ananas makes a github action

So autumn Solidify kickoff came along, and we decided to do the Github actions challenge. Still under the influence of our vacations we decided we don't intend to be useful and came with the idea to simulate a game of life during your build.

The original idea was to have a parallel job that would print the game of life in your workflow run console so you can watch it while your workflow is running.

But it turned out that we cant render each generation in place of the old one, but only sequentially. Obvious in retrospective, you are not looking at a terminal, you are looking at the logs.

So we had to settle to just generate an animation of game of life that you could put as badge in your readme, seeded with the triggering git commit hash.

Challenges

Rendering images and gifs was made easy with great open source contributions but there was a problem: most ways to do that include getting canvas in node, and most ways to do that include system dependent binaries.

Actions are taken as is from your repository, so there is little opportunity to do platform specific packaging to get different binaries for possible runner hosts.

So special shout-out to joshmarinacci/node-pureimage for platform independent node canvas API. Just enough for our needs :)

Gif generation was effortless with:
https://github.com/eugeneware/png-file-stream
https://github.com/eugeneware/gifencoder

Many thanks Eugene!

And the root of our action, the game of life, was, of course, already done. Quite well in fact. Thank you @monarchwadia

Action is in the marketplace if you wish to decorate your repo with game of life badges:
https://github.com/marketplace/actions/game-of-life-build-badge

Top comments (0)