Skip to content

Commit 6d4579e

Browse files
rootroot
authored andcommitted
feat: use 'Github Actions' to run tests and auto release
1 parent 2144617 commit 6d4579e

File tree

2 files changed

+66
-0
lines changed

2 files changed

+66
-0
lines changed

.github/workflows/default.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Default
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+
strategy:
13+
fail-fast: true
14+
matrix:
15+
php: [ 7.1, 7.2, 7.3, 7.4, 8.0 ]
16+
stability: [ prefer-lowest, prefer-stable ]
17+
18+
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
coverage: xdebug
30+
31+
- name: Validate composer.json and composer.lock
32+
run: composer validate
33+
34+
- name: Cache Composer packages
35+
id: composer-cache
36+
uses: actions/cache@v2
37+
with:
38+
path: vendor
39+
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
40+
restore-keys: |
41+
${{ runner.os }}-${{ matrix.php }}-
42+
43+
- name: Install dependencies
44+
if: steps.composer-cache.outputs.cache-hit != 'true'
45+
run: composer install --prefer-dist --no-progress --no-suggest
46+
47+
- name: Run test suite
48+
run: ./vendor/bin/phpunit
49+
50+
semantic-release:
51+
runs-on: ubuntu-latest
52+
needs: [ test ]
53+
steps:
54+
- uses: actions/checkout@v2
55+
- uses: actions/setup-node@v1
56+
with:
57+
node-version: '12'
58+
59+
- name: Run semantic-release
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
62+
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"

0 commit comments

Comments
 (0)