forked from alfred-nutile-inc/laravel-feature-flag
-
Notifications
You must be signed in to change notification settings - Fork 7
58 lines (49 loc) · 1.84 KB
/
ci-cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
name: CI-CD
on: [push]
# Thanks to https://github.com/shivammathur/setup-php/blob/master/examples/laravel-mysql.yml
jobs:
ci:
runs-on: ubuntu-latest
env:
DB_DATABASE: test
DB_USERNAME: root
DB_PASSWORD: password
BROADCAST_DRIVER: log
strategy:
fail-fast: false
matrix:
php-versions: ["8.0"]
steps:
- uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
tools: phpmd
extensions: mbstring, dom, fileinfo, mysql
coverage: xdebug #optional
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
# Use composer.json for key, if composer.lock is not committed.
# key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install Composer dependencies
run: |
composer config github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
composer install --no-progress --prefer-dist --optimize-autoloader
# Again another lint before we do the js build
- name: PHP Code Style (phpcs)
uses: chindit/actions-phpcs@master
with:
cli: "--standard=PSR2"
dir: src/
- name: Test with phpunit
run: XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text
- name: Do we pass the coverage amount
run: composer coverage