An open API service indexing awesome lists of open source software.

https://github.com/guilhermestracini/poc-ghactions-ci-phplaravel

πŸ”¬ Proof of Concept of a Laravel (PHP) project using GitHub Actions for build, testing and deploy
https://github.com/guilhermestracini/poc-ghactions-ci-phplaravel

ci composer github-actions github-actions-composer github-actions-laravel github-actions-php hacktoberfest laravel packagist php phpunit poc proof-of-concept

Last synced: 4 months ago
JSON representation

πŸ”¬ Proof of Concept of a Laravel (PHP) project using GitHub Actions for build, testing and deploy

Awesome Lists containing this project

README

          

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

[![wakatime](https://wakatime.com/badge/github/GuilhermeStracini/POC-GHActions-CI-PHPLaravel.svg)](https://wakatime.com/badge/github/GuilhermeStracini/POC-GHActions-CI-PHPLaravel)
[![GitHub license](https://img.shields.io/github/license/GuilhermeStracini/POC-GHActions-CI-PHPLaravel)](https://github.com/GuilhermeStracini/POC-GHActions-CI-PHPLaravel)
[![GitHub last commit](https://img.shields.io/github/last-commit/GuilhermeStracini/POC-GHActions-CI-PHPLaravel)](https://github.com/GuilhermeStracini/POC-GHActions-CI-PHPLaravel)

[![Build](https://github.com/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/actions/workflows/build.yml/badge.svg)](https://github.com/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/actions/workflows/build.yml)
[![Deploy](https://github.com/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/actions/workflows/deploy.yml/badge.svg)](https://github.com/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/actions/workflows/deploy.yml)
[![PHP Lint](https://github.com/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/actions/workflows/php-lint.yml/badge.svg)](https://github.com/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/actions/workflows/php-lint.yml)

[![Maintainability](https://api.codeclimate.com/v1/badges/83c1d6f45041d9d67d30/maintainability)](https://codeclimate.com/github/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/maintainability)
[![Test Coverage](https://api.codeclimate.com/v1/badges/83c1d6f45041d9d67d30/test_coverage)](https://codeclimate.com/github/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/test_coverage)
[![CodeFactor](https://www.codefactor.io/repository/github/GuilhermeStracini/POC-GHActions-CI-PHPLaravel/badge)](https://www.codefactor.io/repository/github/GuilhermeStracini/POC-GHActions-CI-PHPLaravel)

---

πŸ”¬ **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!**](https://blog.guilhermebranco.com.br/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](LICENSE) file for details.