1+ name : CI
2+
3+ on :
4+ push :
5+ pull_request :
6+ workflow_dispatch :
7+
8+ jobs :
9+ testsuite-linux :
10+ runs-on : ubuntu-18.04
11+ strategy :
12+ fail-fast : false
13+ matrix :
14+ php-version : ['7.2', '7.4', '8.0']
15+ prefer-lowest : ['']
16+ include :
17+ - php-version : ' 7.2'
18+ prefer-lowest : ' prefer-lowest'
19+
20+ steps :
21+ - uses : actions/checkout@v2
22+ with :
23+ fetch-depth : 1
24+
25+ - name : Setup PHP
26+ uses : shivammathur/setup-php@v2
27+ with :
28+ php-version : ${{ matrix.php-version }}
29+ extensions : mbstring, intl
30+ coverage : pcov
31+
32+ - name : Get composer cache directory
33+ id : composer-cache
34+ run : echo "::set-output name=dir::$(composer config cache-files-dir)"
35+
36+ - name : Get date part for cache key
37+ id : key-date
38+ run : echo "::set-output name=date::$(date +'%Y-%m')"
39+
40+ - name : Cache composer dependencies
41+ uses : actions/cache@v2
42+ with :
43+ path : ${{ steps.composer-cache.outputs.dir }}
44+ key : ${{ runner.os }}-composer-${{ steps.key-date.outputs.date }}-${{ hashFiles('composer.json') }}-${{ matrix.prefer-lowest }}
45+
46+ - name : Composer install
47+ run : |
48+ if [[ ${{ matrix.php-version }} == '8.0' ]]; then
49+ composer install --ignore-platform-reqs
50+ elif ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then
51+ composer update --prefer-lowest --prefer-stable
52+ else
53+ composer install
54+ fi
55+
56+ - name : Run PHPUnit
57+ run : |
58+ if [[ ${{ matrix.php-version }} == '7.4' ]]; then
59+ vendor/bin/phpunit --coverage-clover=coverage.xml
60+ else
61+ vendor/bin/phpunit
62+ fi
63+
64+ - name : Code Coverage Report
65+ if : success() && matrix.php-version == '7.4'
66+ uses : codecov/codecov-action@v1
67+
68+ validation :
69+ name : Coding Standard & Static Analysis
70+ runs-on : ubuntu-18.04
71+
72+ steps :
73+ - uses : actions/checkout@v2
74+ with :
75+ fetch-depth : 1
76+
77+ - name : Setup PHP
78+ uses : shivammathur/setup-php@v2
79+ with :
80+ php-version : ' 7.4'
81+ extensions : mbstring, intl
82+ coverage : none
83+ tools : psalm:~4.1.0
84+
85+ - name : Composer Install
86+ run : composer stan-setup
87+
88+ - name : Run phpstan
89+ run : composer phpstan
90+
91+ - name : Run phpcs
92+ run : composer cs-check
93+
94+ - name : Run psalm
95+ run : psalm --output-format=github
0 commit comments