π PoC GitHub Actions CI pipeline for Laravel (PHP)
π¬ Proof of Concept (PoC) for using GitHub Actions with a Laravel (PHP) project to automate CI/CD processes β including building, testing, code quality analysis, and deployment via FTP/SFTP.
π¦ Whatβs in the box?
This project demonstrates a full CI/CD workflow using GitHub Actions:
β CI - Continuous Integration
- π₯ Checkout code from the repository
- π§° Set up environment:
- PHP
- Composer
- Java (required for SonarCloud Scanner)
- πΎ Cache dependencies:
- Composer packages
- SonarCloud binaries
- π¨ Build the project
- π§ͺ Run tests
- π§Ή Static analysis & quality gates using:
- SonarCloud
- Code Climate
- Codecov
- CodeFactor
- Snyk
- π΅οΈ Lint PHP files for syntax errors
π CD - Continuous Deployment
- π€ Upload built artifacts via FTP/SFTP
- π SSH into the remote server and execute deployment commands
- π© Optional: trigger manual approval for deployment (via
workflow_dispatch
orenvironment protection rules
)
π Detailed guide
π Refer to the blog post for a deep dive into how this works:
π Using GitHub Actions to create a Laravel (PHP) pipeline. Build, test, and deploy!
π Repository structure
.github/
workflows/
build.yml # Build & test workflow
deploy.yml # Deploy to (S)FTP server
php-lint.yml # Lint PHP files
.env.example # Example environment file
composer.json # Laravel dependencies
README.md # This file
βοΈ Requirements
To replicate this setup, make sure you have:
- Laravel project setup with
composer install
- (S)FTP credentials or SSH access to your server
- GitHub secrets configured:
SFTP_HOST
,SFTP_USERNAME
,SFTP_PASSWORD
, etc.
- A basic understanding of GitHub Actions workflows
β€οΈ Contributing
This is a PoC, but feel free to fork, experiment, or suggest improvements via PRs or issues!
π License
This project is licensed under the MIT License. See the LICENSE file for details.