GHYGEN: GitHub Actions Yaml Generator

robertobutti

Roberto B.

Posted on January 9, 2021

GHYGEN: GitHub Actions Yaml Generator

What I built

I built Ghygen is a GitHub Actions configurator for your Laravel Application.

Category Submission:

Built for Business

App Link

Setup Database Service, use multiple PHP version, use multiple Laravel versions, build frontend, cache packages, execute Browser, Functional, and Unit tests…
https://ghygen.hi-folks.dev/

Screenshots

GHYGEN GitHub Actions Yaml Generator Screenshot

Description

Ghygen is a GitHub Actions Yaml Generator.

For Laravel/PHP Developers, Ghygen allows you creating your Yaml file for GitHub Actions workflows, so you can:

  • select events trigger (manually , on push, on pull request);
  • select branches;
  • enable caching for all vendors;
  • enable caching PHP packages;
  • select multiple PHP versions;
  • select Node version for NPM (npm run something);
  • caching node packages;
  • setup Mysql service;
  • run migrations;
  • execute tests via phpunit;
  • static code analysis;
  • code sniffer (via phpcs);
  • validate Yaml file.

Link to Source Code

Source Code

Permissive License

MIT License

Background

In these weeks, in my spare time, I was working a little bit with Laravel, GitHub Actions, for some side projects.
One nice aspect, of these projects, was to use Github Actions to validate the source code, every time I perform/create a "push" or a "pull request".
Typically I'm used to validate code with:

  • phpunit: for executing test suite;
  • phpcs: for checking some consistency of source code with PSR*
  • phpstan: for analyzing code.

Thanks to my side projects, I was learning a lot about how to create and maintain workflows with GitHub Actions. I wrote some posts and articles about this topic (specially for Laravel and PHP web applications). I collected a lot of questions from developers for example:

  • how to configure a MySql/MariaDb database in a GitHub Actions workflow;
  • how to store environment configurations;
  • how to store some secrets, like password etc;
  • how to cache vendors;
  • how to cache npm packages. So , with this Hackathon, I'm building GHYGEN (GitHub Yaml Generator), a kind of form/configurator where developer can configure his workflow.

How I built it

When I built Laravel Application, I was used to instantiating droplets with Ubuntu LTS + Ngnix + php + MariaDb.
For the first time, with this Hackathon, I'm starting to play with DigitalOcean App Platform.
Creating a new environment for Laravel it is very easy.
Here, my notes specific for Laravel application deployed on DigitalOcean App Platform:

  • use environment variables in the "component" instead of using .env parameters.
  • forcing HTTPS scheme for loading assets (using asset() helper).

Additional Resources/Info

For forcing HTTPS Scheme:

  • i added APP_FORCE_HTTPS ( boolean ) parameter
  • in config/app.php file I added
'force_https'=>env('APP_FORCE_HTTPS', false),
Enter fullscreen mode Exit fullscreen mode
  • in app/Providers/AppServiceProvide.php , in the boot function I added forceScheme :
    public function boot()
    {
        if (config("app.force_https")) {
            \URL::forceScheme('https');
        }
    }
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
robertobutti
Roberto B.

Posted on January 9, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

GHYGEN: GitHub Actions Yaml Generator
dohackathon GHYGEN: GitHub Actions Yaml Generator

January 9, 2021