Skip to content

Commit 6cc2359

Browse files
authored
Merge pull request #10 from basakest/githubAction
feat: use 'Github Actions' to run tests and auto release
2 parents da1a81b + 3e85608 commit 6cc2359

File tree

3 files changed

+86
-30
lines changed

3 files changed

+86
-30
lines changed

.github/semantic.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Always validate the PR title AND all the commits
2+
titleAndCommits: true

.github/workflows/build.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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.1, 7.2, 7.3, 7.4 ]
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

.travis.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

0 commit comments

Comments
 (0)