Continuous Integration Step by Step
When it comes to continuous integration, Github Actions changed the game. With a few lines of YAML, we can now automate repetitive tasks and ensure code quality across our codebase. So, let's pair Github Actions with Laravel to build some really cool workflows that you can drop into almost any project. You'll be applying for that DevOps role before you know it!
Progress
Series Info
- Episodes
- 9
- Run Time
- 1h 42m
- Difficulty
- Advanced
- Last Updated
- Oct 17, 2024
- Version
- Latest
Series Episodes
- An Intro to Workflows (2)
No Plans to Merge
Continuous Integration raises a few questions: How do you write a workflow? How do you trigger it? And how can we use one to make Taylor's life easier as he closes PRs? Let's tackle that in our introductory lesson!Automated Code Cleanup
We all know that the biggest argument in software is how to format code - so much so that we have tools like Laravel Pint to settle such disputes. But we don't want to run Pint manually! What are we, animals?! Instead, let's write a workflow that will automatically clean up our codebase any time we make a change.
- Running Your Test Suite (2)
Running Your Test Suite
When you think of Continuous Integration, you think of running tests. It's very common to ensure you have a green suite before you push to production. Let's tackle setting up a workflow that allows us to run Pest, and we'll cover some considerations you'll want to keep in mind along the way.Mimicking a Production Database
I tend to stick with SQLite for as long as I can get away with it, but you'll inevitably find yourself needing to execute tests against MySQL or Postgres at some point. How do we do that in Github Actions? In a word: services! Let's take a look.
- Digging Deeper (4)
A Little Trick to Keep It Quick
Every time our workflow runs, we have to rebuild the world from scratch. Whether that's compiling PHP extensions or installing Composer dependencies, it takes time - sometimes minutes! Thankfully, Github provides a solution by allowing us to cache resources across workflow runs. This can dramatically decrease the runtime (and perhaps even cost) of your CI pipeline, so it's well worth your time.Don't Repeat Yourself
In programming, we have a mantra - "Don't Repeat Yourself". Why should it be any different with Github Actions? Let's take a look at how we can extract the common setup steps across our workflows into a single, tidy composite action.Working with Secrets
We don't push sensitive information to source control. In Laravel, we have a local.envfile that sits outside of our repository. Is it possible to do something similar in a workflow file? You bet it is! It's time to introduce you to secrets.Uncovering Coverage Reports
It's common in CI to run a coverage report to make sure your team continue to back up new features with tests. To support coverage, we'll need to install and configure a coverage driver, like XDebug. Turns out it's not as tricky as you might first think.
- Deployment (1)
