-
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (57 loc) · 2.09 KB
/
example-lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Example lint
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php: ['8.1']
deps: [highest, lowest]
include:
- php: '8.1'
deps: current
name: PHP ${{ matrix.php }} + ${{ matrix.deps }} dependencies
steps:
- name: Check out repository
uses: actions/checkout@v2
with:
repository: ngmy/php-specification-example
- name: Set up PHP ${{ matrix.php }}
run: sudo update-alternatives --set php /usr/bin/php${{ matrix.php }}
- name: Update Composer to latest version
run: sudo composer self-update
- name: Allow Composer bin plugin
run: sudo composer global config allow-plugins.bamarni/composer-bin-plugin true
- name: Install Composer bin plugin
run: sudo composer global require bamarni/composer-bin-plugin
- name: Validate composer.json and composer.lock
run: composer validate
- name: Cache Composer packages
if: matrix.deps == 'current'
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: |
if [[ "${{ matrix.deps }}" == 'current' && "${{ steps.composer-cache.outputs.cache-hit }}" != 'true' ]]; then
composer install --no-interaction
fi
if [[ "${{ matrix.deps }}" == 'highest' ]]; then
composer update --no-interaction
fi
if [[ "${{ matrix.deps }}" == 'lowest' ]]; then
composer update --no-interaction --prefer-lowest --prefer-stable
fi
- name: Install ngmy/specification to ${{ github.sha }}
run: composer require ngmy/specification:dev-master#${{ github.sha }}
- name: Install tools
run: |
composer bin phpstan install
composer bin phpunit install
- name: Run lint
run: vendor/bin/phpstan analyse