Skip to content

Commit

Permalink
Move Travis to GitHub Actions (#198)
Browse files Browse the repository at this point in the history
Move Travis to GitHub Actions
  • Loading branch information
TomasVotruba committed Jan 7, 2020
2 parents 24a24d2 + 8d79e33 commit 9d82dd0
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 51 deletions.
1 change: 0 additions & 1 deletion .coveralls.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
service_name: travis-ci
coverage_clover: coverage.xml
json_path: coverage.json
80 changes: 80 additions & 0 deletions .github/workflows/code_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Code_Checks

on:
- pull_request

jobs:
ecs:
runs-on: ubuntu-latest

steps:
-
name: Checkout code
uses: actions/checkout@v2

-
name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: 7.3
coverage: none

-
name: Install
run:
composer install --no-progress

-
name: Run
run:
composer check-cs

phpstan:
runs-on: ubuntu-latest

steps:
-
name: Checkout code
uses: actions/checkout@v2

-
name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: 7.3
coverage: none

-
name: Install
run:
composer install --no-progress

-
name: Run
run:
composer phpstan

rector:
runs-on: ubuntu-latest

steps:
-
name: Checkout code
uses: actions/checkout@v2

-
name: Setup PHP
uses: shivammathur/setup-php@v1
with:
php-version: 7.3
coverage: none

-
name: Install
run:
composer install --no-progress

-
name: Run
run:
composer rector
32 changes: 3 additions & 29 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
language: php

dist: bionic

php:
- 7.2
- 7.3
Expand All @@ -10,7 +8,7 @@ php:
before_script:
- git --version
# disable xdebug if not coverage
- phpenv config-rm xdebug.ini || echo "xdebug not available"
- phpenv config-rm xdebug.ini

script:
- vendor/bin/phpunit
Expand All @@ -32,38 +30,14 @@ jobs:
name: Unit Tests

-
name: ECS
php: 7.3
script:
- composer check-cs

-
name: PHPStan
php: 7.3
script:
- composer phpstan

-
name: Rector
php: 7.3
script:
- vendor/bin/rector process src tests --config rector-ci.yaml --dry-run

-
stage: coverage
name: Test Coverage
if: branch = master AND type = push
php: 7.3
before_script:
- echo "keep xdebug"
script:
# code coverage run + upload to coveralls.io
- vendor/bin/phpunit --coverage-clover coverage.xml
- phpdbg -qrr -d memory_limit=-1 vendor/bin/phpunit --coverage-clover coverage.xml
# Coveralls.io
- wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
- php php-coveralls.phar --verbose

matrix:
fast_finish: true

notifications:
email: false
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# PHP Wrapper around GIT

[![Build Status](https://img.shields.io/travis/cpliakas/git-wrapper/master.svg?style=flat-square)](https://travis-ci.org/cpliakas/git-wrapper)
[![Build Status Github Actions](https://img.shields.io/github/workflow/status/cpliakas/git-wrapper/Code_Checks?style=flat-square)](https://github.com/cpliakas/git-wrapper/actions)
[![Build Travis CI Status](https://img.shields.io/travis/cpliakas/git-wrapper/master.svg?style=flat-square)](https://travis-ci.org/cpliakas/git-wrapper)
[![Coverage Status](https://img.shields.io/coveralls/cpliakas/git-wrapper/master.svg?style=flat-square)](https://coveralls.io/github/cpliakas/git-wrapper?branch=master)
[![Total Downloads](https://img.shields.io/packagist/dt/cpliakas/git-wrapper.svg?style=flat-square)](https://packagist.org/packages/cpliakas/git-wrapper)
[![Latest Stable Version](https://img.shields.io/packagist/v/cpliakas/git-wrapper.svg?style=flat-square)](https://packagist.org/packages/cpliakas/git-wrapper)
Expand Down
21 changes: 11 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
],
"require": {
"php": "^7.2",
"symfony/process": "^4.3|^5.0",
"symfony/event-dispatcher": "^4.3|^5.0"
"symfony/process": "^4.4|^5.0",
"symfony/event-dispatcher": "^4.4|^5.0"
},
"require-dev": {
"phpunit/phpunit": "^8.4",
"symfony/filesystem": "^4.3|^5.0",
"phpunit/phpunit": "^8.5",
"symfony/filesystem": "^4.4|^5.0",
"psr/log": "^1.1",
"symplify/easy-coding-standard": "^7.1",
"symplify/easy-coding-standard": "^7.2",
"nette/utils": "^3.0",
"phpstan/phpstan": "^0.12",
"symplify/changelog-linker": "^7.1",
"symplify/phpstan-extensions": "^7.1",
"rector/rector": "dev-master",
"phpstan/phpstan": "^0.12.4",
"symplify/changelog-linker": "^7.2",
"symplify/phpstan-extensions": "^7.2",
"rector/rector": "^0.6.7",
"tracy/tracy": "^2.7",
"phpstan/phpstan-phpunit": "^0.12"
},
Expand All @@ -42,6 +42,7 @@
"check-cs": "vendor/bin/ecs check src tests --ansi",
"fix-cs": "vendor/bin/ecs check src tests --fix --ansi",
"phpstan": "vendor/bin/phpstan analyse src tests --error-format symplify --ansi",
"changelog": "vendor/bin/changelog-linker dump-merges --in-categories --ansi"
"changelog": "vendor/bin/changelog-linker dump-merges --in-categories --ansi",
"rector": "vendor/bin/rector process src tests --config rector-ci.yaml"
}
}
14 changes: 7 additions & 7 deletions ecs.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
imports:
- { resource: 'vendor/symplify/easy-coding-standard/config/set/psr12.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/php71.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/common.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/clean-code.yaml' }
- { resource: 'vendor/symplify/easy-coding-standard/config/set/symplify.yaml' }

parameters:
sets:
- 'psr12'
- 'php71'
- 'common'
- 'clean-code'
- 'symplify'

skip:
PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\AssignmentInConditionSniff: ~
Symplify\CodingStandard\Sniffs\DependencyInjection\NoClassInstantiationSniff: ~
Expand Down
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ parameters:
- '#Method GitWrapper\\GitWrapper\:\:setEnvVar\(\) has parameter \$value with no typehint specified#'
- '#Method GitWrapper\\GitCommand\:\:getOption\(\) has parameter \$default with no typehint specified#'
- '#Method GitWrapper\\GitCommand\:\:getOption\(\) has no return typehint specified#'
- '#Method (.*?) returns bool type, so the name should start with is/has/was#'
9 changes: 6 additions & 3 deletions src/GitWorkingCopy.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,20 @@ public function addRemote(string $name, string $url, array $options = []): strin
// Add tracking branches.
if (! empty($options['-t'])) {
foreach ($options['-t'] as $branch) {
array_push($args, '-t', $branch);
$args[] = '-t';
$args[] = $branch;
}
}

// Add master branch.
if (! empty($options['-m'])) {
array_push($args, '-m', $options['-m']);
$args[] = '-m';
$args[] = $options['-m'];
}

// Add remote name and URL.
array_push($args, $name, $url);
$args[] = $name;
$args[] = $url;

return $this->remote(...$args);
}
Expand Down

0 comments on commit 9d82dd0

Please sign in to comment.