Deployment
CI/CD Integration
Run Sheath after your CI job installs the application's Composer dependencies. The command works in any CI system that can run PHP and preserves its exit status:
composer install --no-interaction --no-progress --prefer-dist
php artisan sheath:lint --max-warnings=0
--max-warnings=0 makes any warning fail the job. Omit the option when warnings
should remain visible without affecting the exit status. Errors, parse errors,
invalid options, and input or output failures still fail the command.
#GitHub Actions
Sheath's github reporter emits GitHub workflow commands with file, line, and
column information. GitHub Actions turns those commands into annotations.
Change the PHP version and branch triggers to match your application:
# .github/workflows/sheath.yml
name: Sheath
on:
push:
pull_request:
permissions:
contents: read
jobs:
lint-blade:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
coverage: none
- name: Install Composer dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Lint Blade templates
run: php artisan sheath:lint --format=github --max-warnings=0
The workflow needs no Sheath-specific token, service, or GitHub App.
#Other CI Systems
Use the normal command when readable log output is enough:
php artisan sheath:lint --max-warnings=0
For a file artifact, choose a format that the next tool can consume:
php artisan sheath:lint --format=json --output=sheath-report.json
php artisan sheath:lint --format=checkstyle --output=sheath-report.xml
The JSON file uses Sheath's versioned report schema. The XML file uses Checkstyle XML. Writing either file does not register it as a native code quality report with GitLab, CircleCI, Jenkins, SonarQube, Bitbucket, Azure DevOps, or another service. Upload it as an ordinary artifact, or use an adapter that explicitly accepts the selected schema.
#Caching
Caching is optional and changes performance, not lint results. Add --cache
and preserve .sheath-cache between jobs when your CI system provides a cache
service:
php artisan sheath:lint --cache --max-warnings=0
Sheath reuses an entry only when the source and lint context still match. The
context includes the resolved configuration, rules, parser configuration,
installed packages, and Sheath version. Include composer.lock in the CI
provider's cache key so dependency changes select a fresh cache promptly.
#Baselines
When sheath-baseline.json exists at the project root, Sheath applies it
automatically and reports findings that are not in the baseline. Commit the file
if the same baseline should apply locally and in CI.
Do not update the baseline in the normal lint job. --update-baseline writes
the current findings into the baseline, which can accept a new issue instead of
failing the build. Update it as a separate maintenance step and review the file
diff:
php artisan sheath:lint --update-baseline
#Failure Conditions
A job fails when an error or parse error remains after baseline filtering and
fixes, when warnings exceed --max-warnings, or when the run itself cannot
complete. Informational findings never fail the command, and the warning
threshold is disabled unless you set it. See
Exit codes for the
complete list.
#See Also
- CLI Usage: all command options and exit behavior
- Output Reporters: exact output contracts
- Baseline: adopting Sheath with existing findings
- Adoption Recipes: rollout strategies for a project