Skip to content

Commit 4e0970c

Browse files
authored
Create php.yml
1 parent ed3b31c commit 4e0970c

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

.github/workflows/php.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Validation Workflow
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
- ready_for_review
10+
paths:
11+
- '**/*.php'
12+
13+
jobs:
14+
lint-and-test:
15+
strategy:
16+
matrix:
17+
operating-system: ['ubuntu-latest']
18+
php-versions: ['8.0']
19+
runs-on: ${{ matrix.operating-system }}
20+
if: github.event.pull_request.draft == false
21+
steps:
22+
- name: Cancel Previous Runs
23+
uses: styfle/[email protected]
24+
with:
25+
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Checkout
28+
uses: actions/checkout@v2
29+
30+
- name: Setup PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php-versions }}
34+
tools: composer:v2
35+
coverage: none
36+
env:
37+
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Display PHP information
40+
run: |
41+
php -v
42+
php -m
43+
composer --version
44+
- name: Get composer cache directory
45+
id: composer-cache
46+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
47+
48+
- name: Cache dependencies
49+
uses: actions/cache@v2
50+
with:
51+
path: ${{ steps.composer-cache.outputs.dir }}
52+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
53+
restore-keys: ${{ runner.os }}-composer-
54+
55+
- name: Run composer validate
56+
run: composer validate
57+
58+
- name: Install dependencies
59+
run: composer install --no-interaction --no-suggest --no-scripts --prefer-dist --ansi
60+
61+
- name: Run phpcstd
62+
run: vendor/bin/phpcstd --ci --ansi
63+
64+
- name: Setup problem matchers for PHPUnit
65+
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
66+
67+
- name: Run Unit tests
68+
run: composer test --ansi

0 commit comments

Comments
 (0)