Migrate unit tests to Github Actions

This commit is contained in:
Grégoire Paris
2020-12-01 21:50:10 +01:00
parent 708cefbf56
commit 9b87ead646
4 changed files with 83 additions and 65 deletions

1
.gitattributes vendored
View File

@@ -8,7 +8,6 @@
/.doctrine-project.json export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.travis.yml export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/phpunit.xml.dist export-ignore

View File

@@ -0,0 +1,82 @@
name: "Continuous Integration"
on:
pull_request:
branches:
- "*.x"
- "master"
push:
branches:
- "*.x"
- "master"
env:
fail-fast: true
jobs:
phpunit:
name: "PHPUnit"
runs-on: "ubuntu-20.04"
strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
- name: "Install PHP with PCOV"
uses: "shivammathur/setup-php@v2"
with:
php-version: "${{ matrix.php-version }}"
coverage: "pcov"
ini-values: "zend.assertions=1"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v2"
with:
path: "~/.composer/cache"
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-locked-"
- name: "Install dependencies with composer"
run: "composer update --no-interaction --prefer-dist"
- name: "Run PHPUnit"
run: "vendor/bin/phpunit --coverage-clover=coverage.xml"
- name: "Upload coverage file"
uses: "actions/upload-artifact@v2"
with:
name: "phpunit-${{ matrix.php-version }}.coverage"
path: "coverage.xml"
upload_coverage:
name: "Upload coverage to Codecov"
runs-on: "ubuntu-20.04"
needs:
- "phpunit"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 2
- name: "Download coverage files"
uses: "actions/download-artifact@v2"
with:
path: "reports"
- name: "Upload to Codecov"
uses: "codecov/codecov-action@v1"
with:
directory: "reports"

View File

@@ -1,63 +0,0 @@
dist: xenial
language: php
php:
- 7.2
- 7.3
- 7.4
cache:
directories:
- $HOME/.composer/cache
before_install:
- |
if [ "x$COVERAGE" != "xyes" ]; then
mv ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini{,.disabled} || true
fi
- travis_retry composer self-update
install: travis_retry composer update --prefer-dist
before_script:
- |
if [ "x$COVERAGE" == "xyes" ] && [[ ! $(php -m | grep -si xdebug) ]]; then
echo "xdebug is required for coverage"
exit 1
fi
script:
- |
if [ "x$COVERAGE" == "xyes" ]; then
./vendor/bin/phpunit --coverage-clover clover.xml
else
./vendor/bin/phpunit
fi
after_script:
- |
if [ "x$COVERAGE" == "xyes" ]; then
wget https://github.com/scrutinizer-ci/ocular/releases/download/1.5.2/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover clover.xml
fi
jobs:
allow_failures:
- php: nightly
include:
- stage: Test
php: 7.2
env: COVERAGE=yes
- stage: Test
php: nightly
before_install:
- composer config platform.php 7.4.99
- stage: Code Quality
env: PHPSTAN
php: 7.3
script: vendor/bin/phpstan analyse
- stage: Code Quality
env: PHPCS
php: 7.2
script: vendor/bin/phpcs

View File

@@ -1,6 +1,6 @@
# Doctrine Lexer
Build Status: [![Build Status](https://travis-ci.org/doctrine/lexer.svg?branch=master)](https://travis-ci.org/doctrine/lexer)
[![Build Status](https://github.com/doctrine/lexer/workflows/Continuous%20Integration/badge.svg)](https://github.com/doctrine/lexer/actions)
Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.