At our company setting up gitlab ci configuration is one of the jobs I end up doing by default.
This weekend I wrote a package to help speed that process up by generating a .gitlab-ci.yml file as well as installing some of the packages and configuration files to make the following possible:
- Setting an edbizarro docker image based on your target php version
- Handle Javascript asset compilation using NPM or Yarn
- Lint Javascript and Vue files with Eslint
- Lint php files using the laravel shift rules for PHP-Code-Fixer
- Perform static analysis with Larastan
- Run phpunit tests
The package currently provides a single artisan command to do all of the above after answering a few simple questions.
Check the repo out here:
https://github.com/talvbansal/laravel-gitlab-ci-config-generator
Currently the package doesn’t build anything for automatically deploying code but in time I hope to add this in using Laravel Deployer.
This should mean that eventually the sum of these 2 blog posts (Config and Deploying) could be replaced with a single package and artisan command.
In order to make the yaml generation easier this package requires the php-yaml
extension. Which is installable as follows:
1 | // ubuntu |
Currently php-yaml
is installed in the CI process but I think I should be able to drop that requirement since we’re not going to be generating yaml files in our pipelines.
Hopefully this should help speed things up for people setting up new projects.