1+ name : build 
2+ 
3+ on :
4+   push :
5+     branches : [ master ] 
6+   pull_request :
7+     branches : [ master ] 
8+ 
9+ jobs :
10+   test :
11+     runs-on : ubuntu-latest 
12+ 
13+     services :
14+       mysql :
15+         image : mysql:5.7 
16+         env :
17+           MYSQL_ALLOW_EMPTY_PASSWORD : yes 
18+           MYSQL_DATABASE : casbin 
19+         ports :
20+           - 3306:3306 
21+         options : --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 
22+ 
23+     strategy :
24+       fail-fast : true 
25+       matrix :
26+         php : [ 7.2, 7.3,7.4,8.0 ] 
27+ 
28+         stability : [ prefer-lowest, prefer-stable ]             
29+ 
30+     name : PHP ${{ matrix.php }} - ${{ matrix.stability }} 
31+ 
32+     steps :
33+       - name : Checkout code 
34+         uses : actions/checkout@v2 
35+ 
36+       - name : Setup PHP 
37+         uses : shivammathur/setup-php@v2 
38+         with :
39+           php-version : ${{ matrix.php }} 
40+           tools : composer:v2 
41+           coverage : xdebug 
42+ 
43+       - name : Validate composer.json and composer.lock 
44+         run : composer validate 
45+ 
46+       - name : Install dependencies 
47+         if : steps.composer-cache.outputs.cache-hit != 'true' 
48+         run : | 
49+           composer install --prefer-dist --no-progress --no-suggest 
50+ 
51+        - name : Run test suite 
52+         run : ./vendor/bin/phpunit 
53+ 
54+       - name : Run Coveralls 
55+         env :
56+           COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }} 
57+           COVERALLS_PARALLEL : true 
58+           COVERALLS_FLAG_NAME : ${{ runner.os }} - ${{ matrix.php }} 
59+         run : | 
60+           composer global require php-coveralls/php-coveralls:^2.4 
61+           php-coveralls --coverage_clover=build/logs/clover.xml -v 
62+ 
63+    upload-coverage :
64+     runs-on : ubuntu-latest 
65+     needs : [ test ] 
66+     steps :
67+       - name : Coveralls Finished 
68+         uses : coverallsapp/github-action@master 
69+         with :
70+           github-token : ${{ secrets.GITHUB_TOKEN }} 
71+           parallel-finished : true 
72+ 
73+   semantic-release :
74+     runs-on : ubuntu-latest 
75+     needs : [ test, upload-coverage ] 
76+     steps :
77+       - uses : actions/checkout@v2 
78+       - uses : actions/setup-node@v1 
79+         with :
80+           node-version : ' 12' 
81+ 
82+       - name : Run semantic-release 
83+         env :
84+           GITHUB_TOKEN : ${{ secrets.GH_TOKEN }} 
85+         run : npx semantic-release 
0 commit comments