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 ]
27+ stability : [ prefer-lowest, prefer-stable ]
28+
29+ name : PHP ${{ matrix.php }} - ${{ matrix.stability }}
30+
31+ steps :
32+ - name : Checkout code
33+ uses : actions/checkout@v2
34+
35+ - name : Setup PHP
36+ uses : shivammathur/setup-php@v2
37+ with :
38+ php-version : ${{ matrix.php }}
39+ tools : composer:v2
40+ coverage : xdebug
41+
42+ - name : Validate composer.json and composer.lock
43+ run : composer validate
44+
45+ - name : Install dependencies
46+ if : steps.composer-cache.outputs.cache-hit != 'true'
47+ run : |
48+ composer install --prefer-dist --no-progress --no-suggest
49+
50+ - name : Run test suite
51+ run : ./vendor/bin/phpunit
52+
53+ - name : Run Coveralls
54+ env :
55+ COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56+ COVERALLS_PARALLEL : true
57+ COVERALLS_FLAG_NAME : ${{ runner.os }} - ${{ matrix.php }}
58+ run : |
59+ composer global require php-coveralls/php-coveralls:^2.4
60+ php-coveralls --coverage_clover=build/logs/clover.xml -v
61+
62+ upload-coverage :
63+ runs-on : ubuntu-latest
64+ needs : [ test ]
65+ steps :
66+ - name : Coveralls Finished
67+ uses : coverallsapp/github-action@master
68+ with :
69+ github-token : ${{ secrets.GITHUB_TOKEN }}
70+ parallel-finished : true
71+
72+ semantic-release :
73+ runs-on : ubuntu-latest
74+ needs : [ test, upload-coverage ]
75+ steps :
76+ - uses : actions/checkout@v2
77+ - uses : actions/setup-node@v1
78+ with :
79+ node-version : ' 12'
80+
81+ - name : Run semantic-release
82+ env :
83+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
84+ run : npx semantic-release
0 commit comments