Skip to content

Commit 482826a

Browse files
committed
feat: use 'Github Actions' to run tests and auto release
1 parent ec12e52 commit 482826a

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed

.github/workflows/build.yml

+137
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
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: lauthz
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: [ ]
27+
# laravel: [ ]
28+
# stability: [ prefer-lowest, prefer-stable ]
29+
include:
30+
# Laravel 5.5
31+
- php: 7.1
32+
laravel: 5.5.*
33+
phpunit: ~6.0
34+
- php: 7.2
35+
laravel: 5.5.*
36+
phpunit: ~6.0
37+
- php: 7.3
38+
laravel: 5.5.*
39+
phpunit: ~6.0
40+
41+
# Laravel 5.6
42+
- php: 7.1
43+
laravel: 5.6.*
44+
phpunit: ~7.0
45+
- php: 7.2
46+
laravel: 5.6.*
47+
phpunit: ~7.0
48+
- php: 7.3
49+
laravel: 5.6.*
50+
phpunit: ~7.0
51+
52+
# Laravel 5.7
53+
- php: 7.1
54+
laravel: 5.7.*
55+
phpunit: ~7.5
56+
- php: 7.2
57+
laravel: 5.7.*
58+
phpunit: ~7.5
59+
- php: 7.3
60+
laravel: 5.7.*
61+
phpunit: ~7.5
62+
63+
# Laravel 5.8
64+
- php: 7.1
65+
laravel: 5.8.*
66+
phpunit: ~7.5
67+
- php: 7.2
68+
laravel: 5.8.*
69+
phpunit: ~8.0
70+
- php: 7.3
71+
laravel: 5.8.*
72+
phpunit: ~8.0
73+
74+
# Laravel 6.x
75+
- php: 7.2
76+
laravel: 6.*
77+
phpunit: ~8.0
78+
- php: 7.3
79+
laravel: 6.*
80+
phpunit: ~8.0
81+
82+
# Laravel 7.x
83+
- php: 7.3
84+
laravel: 7.*
85+
phpunit: ~9.0
86+
- php: 7.4
87+
laravel: 7.*
88+
phpunit: ~9.0
89+
90+
name: Laravel${{ matrix.laravel }}-PHP${{ matrix.php }}
91+
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@v2
95+
96+
- name: Setup PHP
97+
uses: shivammathur/setup-php@v2
98+
with:
99+
php-version: ${{ matrix.php }}
100+
tools: composer:v2
101+
coverage: xdebug
102+
103+
- name: Validate composer.json and composer.lock
104+
run: composer validate
105+
106+
- name: Cache Composer packages
107+
id: composer-cache
108+
uses: actions/cache@v2
109+
with:
110+
path: vendor
111+
key: ${{ runner.os }}-${{ matrix.php }}-Laravel${{ matrix.laravel }}-${{ hashFiles('**/composer.lock') }}
112+
restore-keys: |
113+
${{ runner.os }}-${{ matrix.php }}-Laravel${{ matrix.laravel }}
114+
115+
- name: Install dependencies
116+
if: steps.composer-cache.outputs.cache-hit != 'true'
117+
run: |
118+
composer require laravel/framework:${{ matrix.laravel }} --no-update --no-interaction
119+
composer require laravel/laravel:${{ matrix.laravel }} phpunit/phpunit:${{ matrix.phpunit }} --no-update --no-interaction --dev
120+
composer install --prefer-dist --no-progress --no-suggest
121+
122+
- name: Run test suite
123+
run: ./vendor/bin/phpunit
124+
125+
semantic-release:
126+
runs-on: ubuntu-latest
127+
needs: [ test ]
128+
steps:
129+
- uses: actions/checkout@v2
130+
- uses: actions/setup-node@v1
131+
with:
132+
node-version: '12'
133+
134+
- name: Run semantic-release
135+
env:
136+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
137+
run: npx semantic-release

.releaserc.yml

+4
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)