Skip to content

Commit

Permalink
Enhancement: Run tests using GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
localheinz authored and sebastianbergmann committed Oct 31, 2019
1 parent 4c92a15 commit b2c4101
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 48 deletions.
5 changes: 5 additions & 0 deletions .docker/lint-xml-configuration/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM alpine:latest

RUN apk add --no-cache \
bash \
libxml2-utils
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/.docker export-ignore
/build export-ignore
/tools export-ignore
/tools/* binary
Expand Down
63 changes: 62 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,71 @@ name: CI
jobs:
coding-guidelines:
name: Coding Guidelines

runs-on: ubuntu-latest

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

- name: Run friendsofphp/php-cs-fixer
run: php7.3 tools/php-cs-fixer fix --diff-format=udiff --dry-run --show-progress=dots --using-cache=no --verbose
run: php7.3 ./tools/php-cs-fixer fix --diff-format=udiff --dry-run --show-progress=dots --using-cache=no --verbose

lint-xml-configuration:
name: Lint XML Configuration

runs-on: ubuntu-latest

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

- name: Build Docker image
uses: ./.docker/lint-xml-configuration

- name: Lint XML configuration files
uses: ./.docker/lint-xml-configuration
with:
args: bash ./build/lint-xml-configuration

tests:
name: Tests

runs-on: ubuntu-latest

strategy:
matrix:
php-binary:
- php7.1
- php7.2
- php7.3

dependencies:
- lowest
- highest

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

- name: Install lowest dependencies with composer
if: matrix.dependencies == 'lowest'
run: ${{ matrix.php-binary }} ./tools/composer update --no-ansi --no-interaction --no-progress --no-suggest --prefer-lowest

- name: Install highest dependencies with composer
if: matrix.dependencies == 'highest'
run: ${{ matrix.php-binary }} ./tools/composer update --no-ansi --no-interaction --no-progress --no-suggest

- name: Run sanity check
run: PHP_BINARY=${{ matrix.php-binary }} bash ./build/sanity-check

- name: Run tests with phpunit
run: ${{ matrix.php-binary }} -d assert.exception=1 -d zend.assertions=1 ./phpunit --coverage-clover=coverage.xml

- name: Download code coverage uploader for Codecov.io
run: curl -s https://codecov.io/bash -o codecov

- name: Send code coverage report to Codecov.io
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash codecov -Z
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of

[![Latest Stable Version](https://img.shields.io/packagist/v/phpunit/phpunit.svg?style=flat-square)](https://packagist.org/packages/phpunit/phpunit)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://php.net/)
[![Build Status](https://img.shields.io/travis/sebastianbergmann/phpunit/7.5.svg?style=flat-square)](https://phpunit.de/build-status.html)
[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/phpunit/actions)

## Installation

Expand Down
File renamed without changes.
6 changes: 6 additions & 0 deletions build/lint-xml-configuration
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

xmllint --noout --schema phpunit.xsd phpunit.xml
xmllint --noout --schema phpunit.xsd tests/_files/configuration.xml
xmllint --noout --schema phpunit.xsd tests/_files/configuration_empty.xml
xmllint --noout --schema phpunit.xsd tests/_files/configuration_xinclude.xml -xinclude
12 changes: 12 additions & 0 deletions build/sanity-check
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

PHP_BINARY=${PHP_BINARY:-php}

${PHP_BINARY} -d assert.exception=On -d zend.assertions=1 ./phpunit --configuration ./build/github-ci-fail.xml

if [ $? -eq 0 ]; then
echo "This test should have failed.";
false;
else
echo "This test has failed as expected.";
fi

0 comments on commit b2c4101

Please sign in to comment.