@AshleyS I chatted with @axil and we're going to work on a part 1 introduction so we will have GitLab CI content for users for the newsletter.
Part 1 - Testing applications with GitLab CI. What it does, how it to use it, where to get info about it.
Part 2 - Will cover testing PHP applications using GitLab CI.
We can continue the GitLab CI series after that :)
@marcia I don't have time nor the experience to write this (at least not without spending some time to figure things out). We have a volunteer @mehranrasulian !!
@marcia What I want to write will be different than blog-posts#298 (closed) since it is about Laravel Forge/GitLab integration and not about testing and Gitlab CI. Am I wrong ?
I have to do the build, test and deploy manually since I don't have any forge account.
Cool @mehranrasulian, that's fine, I just wanted to make sure we're not writing 2 posts on the same subject. Anyway, your post would be exactly about building, testing, and deploying PHP/Lavarel applications with GitLab CI, right?
@SeanPackham given the evolution of this thread, I'll keep this issue opened, okay? I'll rename it to "build, test, and deploy PHP/Lavarel applications with GitLab CI" and update the meta adding this one as PHP/Lavarel. How does it sound?
username-removed-236961changed title from How to test your PHP applications using GitLab CI to Build, test, and deploy PHP/Lavarel applications with GitLab CI
changed title from How to test your PHP applications using GitLab CI to Build, test, and deploy PHP/Lavarel applications with GitLab CI
I see I'm a bit late to the party. I have deployed several PHP websites to production with the help of Gitlab CI. In the past half year a good chunk of them were Laravel based.
Most of the Gitlab CI setup which uses separate jobs, caching and artifacts to pipe data between tagged docker based runners was implemented by me. This does not compensate for my lack of experience writing posts, but if this issue doesn't get the love it needs then I would like to have a crack at it.
I will check back in the coming days, @mehranrasulian if for any reason you won't have time to work on this, please let me know. Thanks!
@mehranrasulian we'd better get your app working before publishing your post. What you could do is, create your outlines and let me take a look at them. Pretend your app is working when writing them. Also, create the first paragraph of your post and add here with the outlines, so I can evaluate your writing style and how you put your ideas together (for this specific purpose). Thank you!
Hi @nnniotex, Community Writers Leader here. Thanks for your interest!
I'm curious about your projects, can you tell me more about them? Let's leave Lavarel apps aside for now, since Mehran has already put come efforts into it. But what else you can do with PHP apps built, tested, and deployed with GitLab CI? How different is your script for other PHP apps compared to your Lavarel ones?
Hey @marcia, appreciate the fast response. I don't want to go into too much detail in comments. I'll try to outline my thoughts on what is missing from the tutorials section as well as answer your questions.
We build websites for clients, and most of them are set up with Gitlab CI from the very beginning to ensure changes can go live as fast and seamlessly as possible.
It frees us from repetitive tasks like testing, quality checking, building, deploying. Anything that can be automatized, should be, and Gitlab CI helps us a lot with that.
Difference between the script for other PHP apps and Laravel ones?
Not much, most of them are centered around the fact that Laravel has a great command-line interface which has prebuilt tools for you to use when deploying an application. These tools help you with tasks like putting the app in maintenance mode, running database migrations, clearing caches. We add these to are deploy script, so they are run at the correct time during a deploy. Essentially allowing us to just sit back and watch a log as it all happens almost magically :D
Some examples of tools that are run by Gitlab CI during deploys:
composer
npm
bower
gulp
grumphp
phpunit
rsync
But, what I wanted to point out is how you can run all these jobs on different runners in docker. This allows you to have an ecosystem of these tools where you can have a different one for every version that comes out. This has many advantages like giving you the chance of using the bleeding edge, while still supporting older projects.
Did I mention you don't need a server farm to run all of this? All you need is one machine, and it doesn't even have to be dedicated.
That's basically it, my general thoughts on what the tutorial should explain in more detail. Let me know what you think :)
@nnniotex your perspective is very interesting! Perhaps we could change the theme, to something broader than Lavarel/PHP. Would you be up to thinking on something like you explained to me, but more like "Continuously Deployment with GitLab CI: enjoy the magic!" => you could cover a lot of different deployment methods, platforms, scripts, etc. I would need you to think with me how to make a logical structure for the post, and how exactly to contextualize it.
Please let me know what do you think of this approach. If you interested, please create a new issue with a proposal, so we can follow up from there.
In your introduction, please define your audience. Also, add something important (just a couple sentences) about Lavarel/PHP.
Instead of "What is GitLab CI?", you could change the heading to "Continuous Integration with GitLab". I think it makes more sense, considering you're explaining more than what GitLab CI is.
This is a tutorial, so, please don't jump any steps, and please make sure you define a concept before talking about it. For example, here you say "Laravel Envoy allows us to define stories and tasks and runs those on multiple servers in Parallel Execution or one by one", which explains what you can do with it, but doesn't explain what is it, and what is it for. So, in this case, it's important to introduce the concept (what is it, what is it for), and then telling what is interesting about it or what you can do with it. :)
In the section where you explain .gitlab-ci.yml, please break its code in small parts and explain one by one.
It would be interesting, perhaps, to explain how you use the GitLab Workflow to develop your apps.
Having a good development workflow is crucial for making a good team great. But a bad workflow will take your team developers productivity down on wasting time doing some things manually such as testing new code changes before merging them to the main project. Or even worse maybe a developer forget to verify new code changes by tests before merging them into the main project and when something broke, the team also should spend their time on fixing them. Also, it takes too long Adding new changes to the production server manually.
I enjoy using GitLab! It offers anything a modern development workflow needs. It brings together source control, issue tracking, boards, Build email notifications, Slack integration, CI and many other features all in one UI.
In this tutorial, We'll cover how to initialize a Laravel application and to write a simple test, then we'll jump into seeing how to build, test and deploy it with GitLab CI.
Laravel is a high quality PHP web framework written in PHP. It has a great community with a really fantastic documentation on Laravel.com. A few features for Laravel can be An amazing ORM, painless routing, powerful queue library, and simple authentication.
We also use Envoy which is a PHP based SSH task runner. It uses a clean, minimal Blade syntax to setup tasks that can be run on remote servers. This tasks can be cloning your project from the repository, installing the Composer dependencies, running database migrations and more.
We assume you have a basic experience with Laravel, you know how to use PHPUnit to write PHP tests, you have some basic experience with Linux servers, and you know how to use GIT.
Note: This guide is not unique to Laravel, which means you can still follow reading it even if you're not using Laravel framework! [ It is not tested yet!!! But it is expected to fit any PHP developer ]
We assume you have a basic experience with Laravel, you know how to use PHPUnit to write PHP tests, you have some basic experience with Linux servers, and you know how to use GIT.
I think this looks a little restrictive. I'd like you to focus on Lavarel, so you can assume your audience is familiar with it, and with GitLab. Explaining why you need the test units and everything else you need to your app, is up to you to do in your post. Long story short, keep the focus on your proposal: "In this tutorial, we'll cover how to initialize a Laravel application and to write a simple test, then we'll jump into seeing how to build, test and deploy it with GitLab CI." Stick to the subject and to your outlines :)
As a tutorial, your post is a step-by-step guide. To inspire you, see how Marco explained everything here in his post, not losing focus, and being absolutely clear on what to do, in a logical sequence of steps.
That said, go for it. I'll review it in January, after a short break for the holidays :)
Thank you so far, and happy holidays to you and your family!