1+ name : CI
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - beta
8+ - sdk-release/**
9+ - feature/**
10+ pull_request :
11+ branches :
12+ - main
13+ - beta
14+ - sdk-release/**
15+ - feature/**
16+
17+ # Allows you to run this workflow manually from the Actions tab
18+ workflow_dispatch :
19+
20+ jobs :
21+ php-cs-fixer :
22+ name : PHP-CS-Fixer
23+ runs-on : ${{ matrix.operating-system }}
24+ strategy :
25+ matrix :
26+ operating-system : ['ubuntu-latest', 'windows-latest', 'macos-latest']
27+ php-versions : ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
28+ phpunit-versions : ['latest']
29+ include :
30+ - operating-system : ' ubuntu-latest'
31+ php-versions : ' 7.2'
32+ phpunit-versions : ' 8.5.21'
33+ steps :
34+ - uses : actions/checkout@master
35+ - name : PHP-CS-Fixer
36+ uses : shivammathur/setup-php@v2
37+ with :
38+ args : --format=txt --diff --dry-run --using-cache=no --verbose .
39+ phpstan :
40+ name : PHPStan
41+ runs-on : ubuntu-latest
42+ strategy :
43+ fail-fast : false
44+ matrix :
45+ php-version :
46+ - " 7.1"
47+ - " 7.2"
48+ - " 7.3"
49+ - " 7.4"
50+ - " 8.0"
51+ - " 8.1"
52+ steps :
53+ - uses : actions/checkout@master
54+ - name : Setup PHP
55+ uses : shivammathur/setup-php@v2
56+ with :
57+ php-version : ${{ matrix.php-version }}
58+ - name : Get Composer Cache Directory
59+ id : composer-cache
60+ run : |
61+ echo "::set-output name=dir::$(composer config cache-files-dir)"
62+ - uses : actions/cache@v2
63+ with :
64+ path : ${{ steps.composer-cache.outputs.dir }}
65+ # Conventionally you would hash "composer.lock", but we don't commit
66+ # that, so we hash on "composer.json" instead.
67+ key : ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
68+ # We run php-cs-fixer in a separate job, but the version we use is not compatible
69+ # with all the versions of PHP that we want to execute PHPStan upon
70+ - name : Trim dependency
71+ run : composer remove --dev friendsofphp/php-cs-fixer
72+ - name : Validate composer.json and composer.lock
73+ run : composer validate
74+ - name : Install dependencies
75+ run : composer install --prefer-dist --no-progress --no-suggest
76+ - name : Run phpstan
77+ run : vendor/bin/phpstan analyse src
78+ tests :
79+ name : Tests
80+ runs-on : ubuntu-latest
81+ strategy :
82+ fail-fast : false
83+ matrix :
84+ env :
85+ - AUTOLOAD=0
86+ - AUTOLOAD=1
87+ php-version :
88+ - " 7.1"
89+ - " 7.2"
90+ - " 7.3"
91+ - " 7.4"
92+ - " 8.0"
93+ - " 8.1"
94+ steps :
95+ - uses : actions/checkout@master
96+ - name : Setup PHP
97+ uses : shivammathur/setup-php@v2
98+ with :
99+ php-version : ${{ matrix.php-version }}
100+ coverage : xdebug
101+ - name : Get Composer Cache Directory
102+ id : composer-cache
103+ run : |
104+ echo "::set-output name=dir::$(composer config cache-files-dir)"
105+ - uses : actions/cache@v2
106+ with :
107+ path : ${{ steps.composer-cache.outputs.dir }}
108+ key : ${{ runner.os }}-composer-${{ hashFiles('composer.json') }}
109+ # We run php-cs-fixer and PHPStan in separate jobs, but the versions we use are not compatible
110+ # with all the versions of PHP that we want to execute PHPUnit upon
111+ - name : Trim dependency
112+ run : composer remove --dev friendsofphp/php-cs-fixer phpstan/phpstan
113+ - name : Validate composer.json and composer.lock
114+ run : composer validate
115+ - name : Install dependencies
116+ run : composer install --prefer-dist --no-progress --no-suggest
117+ - name : Change build.php permissions
118+ run : chmod +x ./build.php
119+ - name : Run test suite
120+ run : |
121+ php --version
122+ ./build.php $env:AUTOLOAD
0 commit comments