Skip to content

Commit

Permalink
update GitHub Actions usage (following @mimmi20 question #181)
Browse files Browse the repository at this point in the history
  • Loading branch information
llaville committed Feb 19, 2023
1 parent 108f713 commit e7a391f
Showing 1 changed file with 63 additions and 4 deletions.
67 changes: 63 additions & 4 deletions docs/usage/github-actions.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,67 @@
# GitHub Actions

Quick start, if you PHP runtime set up is not important for you.

```yaml
uses: overtrue/phplint@main
with:
path: .
options: --exclude=vendor
jobs:
php-lint:
name: Linting with overtrue/phplint

runs-on: ubuntu-latest

steps:
- name: Lint PHP files

uses: overtrue/phplint@main
with:
path: .
options: --exclude=vendor
```
Otherwise, if you want to detect specific PHP features used by scripts depending of your PHP runtime, then use this case.
```yaml
jobs:
php-lint:
name: "Linting with overtrue/phplint"

runs-on: "${{ matrix.operating-system }}"

strategy:
fail-fast: false

matrix:
operating-system:
- "ubuntu-20.04"
- "ubuntu-22.04"

php-version:
- "8.1"
- "8.2"

steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: overtrue/phplint

- 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 -vvv --no-cache
```
Follows steps:
- retrieve source code to check with [actions/checkout](https://github.com/actions/checkout)
- set up the PHP runtime you want to use with [shivammathur/setup-php](https://github.com/shivammathur/setup-php)
- download the latest (or specific) version of the PHAR distribution
- and finally run PHPLint as usual, with a YAML config file or console command options

0 comments on commit e7a391f

Please sign in to comment.