Github action CI migration (#886)

Migrate from travis-ci to github actions

* Basic github action 'build' added
* Build status badge updated
* Removed .travis.myl
* phpunit `--coverage-text` option added for inline text coverage
This commit is contained in:
Martin Rademacher 2021-01-06 08:46:26 +13:00 committed by GitHub
parent 4931df2e8f
commit 39fecd2fda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 83 additions and 36 deletions

67
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,67 @@
name: build
on:
push:
pull_request_target:
pull_request:
jobs:
php-cs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout repository
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
- uses: ramsey/composer-install@v1
with:
dependency-versions: 'highest'
- name: Static Code Analysis
run: composer lint
test:
runs-on: ${{ matrix.operating-system }}
needs:
- php-cs
strategy:
fail-fast: true
matrix:
operating-system: [ ubuntu-latest ]
php: [ '7.2', '7.3', '7.4', '8.0' ]
dependencies: [ 'lowest', 'highest' ]
name: PHP ${{ matrix.php }} on ${{ matrix.operating-system }} with ${{ matrix.dependencies }} dependencies
steps:
- uses: actions/checkout@v2
name: Checkout repository
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: pcov
- name: Composer install
uses: ramsey/composer-install@v1
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: ${{ matrix.composer-options }}
- name: PHPUnit Tests
uses: php-actions/phpunit@v1
with:
bootstrap: vendor/autoload.php
configuration: phpunit.xml.dist
args: --coverage-text

View File

@ -1,26 +0,0 @@
sudo: false
language: php
cache:
directories:
- $HOME/.composer/cache
php:
- 7.2
- 7.3
- 7.4
- nightly
matrix:
include:
- php: 7.4
env: CS=yes
before_script:
- if [[ $TRAVIS_PHP_VERSION > 7.4 ]] ; then sed -i '/friendsofphp\/php-cs-fixer/d' composer.json; fi;
- composer self-update
- composer install --prefer-dist --no-interaction
script:
- ./bin/phpunit
- if [ $CS = 'yes' ]; then composer run-script lint; fi

View File

@ -1,4 +1,4 @@
[![Build Status](https://img.shields.io/travis/zircote/swagger-php/master.svg?style=flat-square)](https://travis-ci.org/zircote/swagger-php)
[![Build Status](https://img.shields.io/github/workflow/status/zircote/swagger-php/build?style=flat-square)](https://github.com/zircote/swagger-php/actions?query=workflow:build)
[![Total Downloads](https://img.shields.io/packagist/dt/zircote/swagger-php.svg?style=flat-square)](https://packagist.org/packages/zircote/swagger-php)
[![License](https://img.shields.io/badge/license-Apache2.0-blue.svg?style=flat-square)](LICENSE-2.0.txt)

View File

@ -1,10 +1,16 @@
<phpunit bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnFailure="false">
<testsuite name="Swagger-PHP TestSuite">
<directory>tests/</directory>
</testsuite>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false"
colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true"
convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Object Mapper Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>