name: 'Usage of phplint GitHub Action'
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lint PHP files
uses: overtrue/phplint@main
with:
path: .
options: --exclude=vendor
PHP Lint
A tool that can speed up linting of php files by running several lint processes at once.
What is PHP Lint?
For those working on PHP projects, ensuring that our code is free of syntax errors is crucial. PHPLint is a robust tool designed to speed up the linting process by executing multiple lint processes simultaneously. This makes it an excellent choice for integrating into our CI/CD pipeline with GitHub Actions.
How to Set Up PHPLint for Different PHP Versions and Operating Systems in GitHub Actions
For projects that need to ensure compatibility across various PHP versions and operating systems, setting up a dynamic CI/CD pipeline is essential. This guide will help you configure GitHub Actions to use PHPLint for detecting specific PHP features dependent on your runtime environment.
jobs:
php-lint:
name: "PHPLint v9"
runs-on: "${{ matrix.operating-system }}"
strategy:
fail-fast: false
matrix:
operating-system:
- "ubuntu-20.04"
- "ubuntu-22.04"
php-version:
- "8.1"
- "8.2"
- "8.3"
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: sebastianbergmann/phpunit
- name: Setup PHP runtime
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
coverage: "none"
- name: Lint PHP files
run: |
curl -Ls https://github.com/overtrue/phplint/releases/latest/download/phplint.phar -o /usr/local/bin/phplint
chmod +x /usr/local/bin/phplint
/usr/local/bin/phplint --no-cache --no-progress -v
Monitoring GitHub Actions Workflows
CICube is a GitHub Actions monitoring tool that provides you with detailed insights into your workflows to further optimize your CI/CD pipeline. With CICube, you will be able to track your workflow runs, understand where the bottlenecks are, and tease out the best from your build times. Go to cicube.io now and create a free account to better optimize your GitHub Actions workflows!