1+ name : test
2+
3+ on :
4+ push :
5+ pull_request :
6+
7+ jobs :
8+ test :
9+ runs-on : ${{ matrix.os }}
10+ strategy :
11+ fail-fast : false
12+ matrix :
13+ os :
14+ - ubuntu-latest
15+
16+ services :
17+ mysql :
18+ image : mysql:5.7
19+ env :
20+ MYSQL_ALLOW_EMPTY_PASSWORD : yes
21+ MYSQL_USER : root
22+ MYSQL_PASSWORD : ' '
23+ MYSQL_DATABASE : test_database
24+ ports :
25+ - 3306:3306
26+ options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
27+
28+ redis :
29+ image : redis
30+ options : >-
31+ --health-cmd "redis-cli ping"
32+ --health-interval 10s
33+ --health-timeout 5s
34+ --health-retries 5
35+ ports :
36+ - 6379:6379
37+
38+ steps :
39+ - name : Verify MySQL connection from host
40+ run : |
41+ sudo apt-get install -y mysql-client
42+ mysql --host 127.0.0.1 --port 3306 -uroot --password="" -e "SHOW DATABASES"
43+
44+ - uses : actions/checkout@v2
45+
46+ - uses : shivammathur/setup-php@v2
47+ with :
48+ php-version : ' 7.4'
49+ coverage : xdebug
50+
51+ - name : Set files permission
52+ run : |
53+ sudo chown -R www-data:www-data /var/lib/php/sessions/
54+ sudo chmod -R 777 /var/lib/php/sessions/
55+
56+ - name : Validate composer.json and composer.lock
57+ run : composer validate
58+
59+ - name : Cache Composer packages
60+ id : composer-cache
61+ uses : actions/cache@v2
62+ with :
63+ path : vendor
64+ key : ${{ runner.os }}-node-${{ hashFiles('**/composer.lock') }}
65+ restore-keys : |
66+ ${{ runner.os }}-node-
67+
68+ - name : Install dependencies
69+ if : steps.composer-cache.outputs.cache-hit != 'true'
70+ run : composer install --prefer-dist --no-progress --no-suggest
71+
72+ - name : PHPCS
73+ if : ${{ runner.os != 'Windows' }}
74+ run : |
75+ vendor/bin/php-cs-fixer fix --diff --dry-run
76+
77+ - name : PHPUnit
78+ run : |
79+ vendor/bin/phpunit --colors --coverage-text --coverage-clover coverage/clover.xml
80+ env :
81+ MYSQL_HOST : 127.0.0.1
82+ MYSQL_PORT : ${{ job.services.mysql.ports[3306] }}
83+ MYSQL_USER : root
84+ MYSQL_PASSWORD :
85+
86+ - name : Upload coverage
87+ uses : codecov/codecov-action@v1.0.7
88+ if : success()
89+ with :
90+ token : ${{ secrets.CODECOV_TOKEN }}
91+ file : ./coverage/clover.xml
0 commit comments