Skip to content

Commit 9a26e4e

Browse files
authoredSep 20, 2022
Merge pull request #2 from basakest/githubAction
feat: use 'Github Actions' to run tests and auto release
2 parents 4023c6d + 6078fad commit 9a26e4e

File tree

6 files changed

+92
-49
lines changed

6 files changed

+92
-49
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: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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

‎.releaserc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
plugins:
2+
- "@semantic-release/commit-analyzer"
3+
- "@semantic-release/release-notes-generator"
4+
- "@semantic-release/github"

‎.travis.yml

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

‎phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="vendor/codeigniter4/framework/tests/_support/_bootstrap.php"
2+
<phpunit bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
33
backupGlobals="false"
44
colors="true"
55
convertErrorsToExceptions="true"

‎tests/travis/Database.php

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

0 commit comments

Comments
 (0)
Please sign in to comment.