Skip to content

GuilhermeStracini/POC-GHActions-CI-PHPLaravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ PoC GitHub Actions CI pipeline for Laravel (PHP)

wakatime GitHub license GitHub last commit

Build Deploy PHP Lint

Maintainability Test Coverage CodeFactor


πŸ”¬ 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 or environment 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.