Skip to content

Instantly share code, notes, and snippets.

@JohnnyWalkerDigital
Last active December 9, 2025 19:52
Show Gist options
  • Select an option

  • Save JohnnyWalkerDigital/1b80922a06fb441fb3b44d97ed65b21f to your computer and use it in GitHub Desktop.

Select an option

Save JohnnyWalkerDigital/1b80922a06fb441fb3b44d97ed65b21f to your computer and use it in GitHub Desktop.
Laravel CI Pipeline
# Laravel CI Pipeline
# Description: Run static analysis and tests
# Author: Johnny Walker
# Version: 1.0
# Date: 27 November 2025
# Requirements:
# PHP_CodeSniffer - https://github.com/squizlabs/PHP_CodeSniffer
# Custom Codesniffer Config - https://gist.github.com/JohnnyWalkerDesign/aca5ee0d21c12d31440327079ae40c23
# Larastan - https://github.com/larastan/larastan
# Latest version at: https://gist.github.com/JohnnyWalkerDigital/1b80922a06fb441fb3b44d97ed65b21f
# Usage: Place in .github/workflows folder
name: Laravel CI Pipeline
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
laravel-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Install npm
run: npm ci
- name: Create npm manifest
run: npm run build
- name: Run PHP_CodeSniffer
run: ./vendor/bin/phpcs -n || ./vendor/bin/phpcbf
- name: Run PHP Larastan
run: php vendor/bin/phpstan analyse --memory-limit=2G
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit/Pest
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan test --stop-on-failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment