Skip to content

Commit

Permalink
Add GHA worflow
Browse files Browse the repository at this point in the history
  • Loading branch information
slavcodev committed Feb 18, 2020
1 parent 4f43dc1 commit 0a6ce10
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Tests
on: [pull_request]

env:
# see: https://github.com/shivammathur/setup-php
PHP_EXTENSIONS: mbstring, intl, json
EXECUTE_COVERAGE: ${{ matrix.php-version == '7.3' }}

jobs:
unit-tests:
runs-on: ubuntu-latest

strategy:
max-parallel: 1
matrix:
php-version: ['7.3', '7.4']

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.PHP_EXTENSIONS }}

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Login composer
run: composer config -g github-oauth.github.com ${{ secrets.COMPOSER_TOKEN }}

- name: Install dependencies
run: make install

- name: Run PhpUnit with coverage
if: env.EXECUTE_COVERAGE == 'true'
run: make report-coverage

- name: Run PhpUnit
if: env.EXECUTE_COVERAGE != 'true'
run: make test

- name: Coverage monitor
if: env.EXECUTE_COVERAGE == 'true'
uses: slavcodev/coverage-monitor-action@1.0.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clover_file: "logs/clover.xml"
comment: false
threshold_alert: 80
threshold_warning: 90

lint:
runs-on: ubuntu-latest

strategy:
matrix:
php-version: ['7.3']

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.PHP_EXTENSIONS }}

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Login composer
run: composer config -g github-oauth.github.com ${{ secrets.COMPOSER_TOKEN }}

- name: Install dependencies
run: make install

- name: Lint code
run: make lint
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Build Status][ico-travis]][link-travis]
[![Coverage Status][ico-coveralls]][link-coveralls]
[![GitHub Actions status][ico-github-actions]][link-github]

# Money

Expand Down Expand Up @@ -244,11 +245,13 @@ If you discover a security vulnerability, please report it to security at rebill
The Money library is open-sourced under the [MIT License](./LICENSE) distributed with the software.


[ico-github-actions]: https://github.com/Rebilly/money/workflows/Tests/badge.svg
[ico-version]: https://img.shields.io/packagist/v/Rebilly/money.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square
[ico-travis]: https://img.shields.io/travis/Rebilly/money/master.svg?style=flat-square
[ico-coveralls]: https://img.shields.io/coveralls/github/Rebilly/money.svg?style=flat-square

[link-github]: https://github.com/Rebilly/money
[link-packagist]: https://packagist.org/packages/Rebilly/money
[link-license]: LICENSE
[link-travis]: https://travis-ci.org/Rebilly/money
Expand Down

0 comments on commit 0a6ce10

Please sign in to comment.