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+ postgres :
23+ image : postgres
24+ env :
25+ POSTGRES_PASSWORD : postgres
26+ POSTGRES_USER : postgres
27+ POSTGRES_DB : casbin
28+ ports :
29+ - 5432:5432
30+ options :
31+ --health-cmd pg_isready
32+ --health-interval 10s
33+ --health-timeout 5s
34+ --health-retries 5
35+
36+ strategy :
37+ fail-fast : true
38+ matrix :
39+ php : [ 7.1, 7.2, 7.3, 7.4, 8.0 ]
40+ stability : [ prefer-lowest, prefer-stable ]
41+
42+ name : PHP ${{ matrix.php }} - ${{ matrix.stability }}
43+
44+ steps :
45+ - name : Checkout code
46+ uses : actions/checkout@v2
47+
48+ - name : Setup PHP
49+ uses : shivammathur/setup-php@v2
50+ with :
51+ php-version : ${{ matrix.php }}
52+ tools : composer:v2
53+ coverage : xdebug
54+
55+ - name : Validate composer.json and composer.lock
56+ run : composer validate
57+
58+ - name : Install dependencies
59+ if : steps.composer-cache.outputs.cache-hit != 'true'
60+ run : composer install --prefer-dist --no-progress --no-suggest
61+
62+ - name : Run test suite
63+ run : ./vendor/bin/phpunit -v
64+
65+ - name : Run Coveralls
66+ env :
67+ COVERALLS_REPO_TOKEN : ${{ secrets.GITHUB_TOKEN }}
68+ COVERALLS_PARALLEL : true
69+ COVERALLS_FLAG_NAME : ${{ runner.os }} - ${{ matrix.php }} - ${{ matrix.stability }}
70+ run : ./vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
71+
72+ upload-coverage :
73+ runs-on : ubuntu-latest
74+ needs : [ test ]
75+ steps :
76+ - name : Coveralls Finished
77+ uses : coverallsapp/github-action@master
78+ with :
79+ github-token : ${{ secrets.GITHUB_TOKEN }}
80+ parallel-finished : true
81+
82+ semantic-release :
83+ runs-on : ubuntu-latest
84+ needs : [ test, upload-coverage ]
85+ steps :
86+ - uses : actions/checkout@v2
87+ - uses : actions/setup-node@v1
88+ with :
89+ node-version : ' 12'
90+
91+ - name : Run semantic-release
92+ env :
93+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
94+ run : npx semantic-release
0 commit comments