Skip to content

Commit

Permalink
Run tests on Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Aug 6, 2023
1 parent 14880f5 commit 30e4599
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: build

on:
pull_request:
push:

jobs:
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
include:
- php-version: 7.1
coverage: none
- php-version: 7.2
coverage: none
- php-version: 7.3
coverage: none
- php-version: 7.4
coverage: none
- php-version: 8.0
coverage: xdebug
- php-version: 8.1
coverage: none
- php-version: 8.2
coverage: none

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Use PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v2
coverage: "${{ matrix.coverage }}"

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/composer
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: php${{ matrix.php-version }}-composer-

- name: Install dependencies
run: |
composer install --no-progress;
composer show;
- name: Run tests (no coverage)
if: "${{ matrix.coverage == 'none' }}"
run: ./vendor/bin/phpunit test --no-coverage

- name: Run tests (coverage)
if: "${{ matrix.coverage != 'none' }}"
run: ./vendor/bin/phpunit test

- name: Install "php-coveralls/php-coveralls"
if: "${{ matrix.coverage != 'none' }}"
run: composer require php-coveralls/php-coveralls --no-progress

- name: Upload coverage results to Coveralls
if: "${{ matrix.coverage != 'none' }}"
continue-on-error: true
run: ./vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
Handy `require-dev` testing tool for [PhpUnit](https://github.com/sebastianbergmann/phpunit).
It allows to manage data providers with `zip()`, `join()`, `cross()`, `pairs()`, `slice()` and more.

[![Build Status](https://github.com/t-regx/CrossDataProviders/workflows/build/badge.svg?branch=master)][build]
[![Coverage Status](https://coveralls.io/repos/github/t-regx/CrossDataProviders/badge.svg?branch=master)][coveralls]
[![Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)][repository]
[![Repository Size](https://img.shields.io/github/repo-size/t-regx/CrossDataProviders?label=size)][repository]
[![License](https://img.shields.io/github/license/t-regx/CrossDataProviders.svg)][license]
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
</exclude>
</whitelist>
</filter>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<log type="coverage-php" target="build/cov/coverage.cov"/>
</logging>
</phpunit>

0 comments on commit 30e4599

Please sign in to comment.