From 74a37bea59ef67205afebe70fc1ed134f3aa9905 Mon Sep 17 00:00:00 2001 From: Alex Shelkovskiy Date: Sat, 5 Aug 2023 18:36:39 +0600 Subject: [PATCH] Migrate to GitHub Actions --- .coveralls.yml | 2 +- .github/workflows/test.yml | 85 ++++++++++++++++++++++++++++++ .travis.yml | 23 -------- README.md | 4 +- tests/SimpleAcl/RuleResultTest.php | 6 +-- 5 files changed, 91 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.coveralls.yml b/.coveralls.yml index eb9b6b0..ffbd7b4 100644 --- a/.coveralls.yml +++ b/.coveralls.yml @@ -1,4 +1,4 @@ # for php-coveralls service_name: travis-ci coverage_clover: tmp/clover.xml -json_path: tmp/coveralls-upload.json \ No newline at end of file +json_path: tmp/coveralls-upload.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0435b9a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,85 @@ +name: CI + +on: + push: + tags: + - 'v*.*.*' + branches: + - master + - develop + paths-ignore: + - '**/README.md' + pull_request: + branches: + - master + - develop + paths-ignore: + - '**/README.md' + +jobs: + tests: + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - php: 5.3 + php-unit: 4 + coveralls: 1 + - php: 5.4 + php-unit: 4 + coveralls: 1 + - php: 5.5 + php-unit: 4 + coveralls: 2 + - php: 5.6 + php-unit: 5 + coveralls: 2 + - php: 7.0 + php-unit: 5 + coveralls: 2 + - php: 7.1 + php-unit: 5 + coveralls: 2 + - php: 7.2 + php-unit: 5 + coveralls: 2 + - php: 7.3 + php-unit: 5 + coveralls: 2 + + name: Tests PHP ${{ matrix.php }} PHPUnit ${{ matrix.php-unit }} + + steps: + - uses: actions/checkout@v3 + + - name: Setup PHP ${{ matrix.php }} PHPUnit ${{ matrix.php-unit }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + tools: composer, phpunit:${{ matrix.php-unit }} + + - run: composer install + + - run: phpunit --coverage-clover tmp/clover.xml + + - name: Coveralls + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + COVERALLS_PARALLEL: true + COVERALLS_FLAG_NAME: php-${{ matrix.php }}-${{ matrix.php-unit }} + run: | + composer global require php-coveralls/php-coveralls:${{ matrix.coveralls }}.* + php-coveralls --coverage_clover=tmp/clover.xml -v + + coveralls: + needs: tests + + if: ${{ success() }} + + runs-on: ubuntu-latest + + steps: + - uses: coverallsapp/github-action@v2 + with: + parallel-finished: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1b0da10..0000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -language: php - -matrix: - include: - - php: 7.2 - - php: 7.1 - - php: 7.0 - - php: 5.6 - - php: 5.5 - - php: 5.4 - - php: 5.3 - dist: precise - -before_script: - - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" || ${TRAVIS_PHP_VERSION:0:3} == "7.1" || ${TRAVIS_PHP_VERSION:0:3} == "7.2" ]]; then composer require phpunit/phpunit "~5.7"; fi - - if [[ ${TRAVIS_PHP_VERSION:0:3} == "5.4" || ${TRAVIS_PHP_VERSION:0:3} == "5.3" ]]; then composer require satooshi/php-coveralls '~1.0'; else composer require satooshi/php-coveralls; fi - - composer install - -script: - - if [[ ${TRAVIS_PHP_VERSION:0:3} == "7.0" || ${TRAVIS_PHP_VERSION:0:3} == "7.1" || ${TRAVIS_PHP_VERSION:0:3} == "7.2" ]]; then vendor/bin/phpunit --version && vendor/bin/phpunit --coverage-clover tmp/clover.xml; else phpunit --version && phpunit --coverage-clover tmp/clover.xml; fi - -after_success: - - php vendor/bin/coveralls -v diff --git a/README.md b/README.md index da51f80..249b430 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Simple Access Control List (ACL) for PHP. -[![Build Status](https://travis-ci.org/alexshelkov/SimpleAcl.svg?branch=master)](https://travis-ci.org/alexshelkov/SimpleAcl) +[![Test Status](https://github.com/alexshelkov/SimpleAcl/actions/workflows/test.yml/badge.svg)](https://github.com/alexshelkov/SimpleAcl/actions/workflows/test.yml) [![Coverage Status](https://coveralls.io/repos/alexshelkov/SimpleAcl/badge.svg?branch=master&service=github)](https://coveralls.io/github/alexshelkov/SimpleAcl?branch=master) _____________________________________________________________________________________________________________________ #### Install @@ -151,4 +151,4 @@ $acl->addRule($user, $siteFrontend, 'View', function (SimpleAcl\RuleResult $rule var_dump($acl->isAllowed($all, 'SiteFrontend', 'View')); // true ``` -__For more help check out wiki pages.__ \ No newline at end of file +__For more help check out wiki pages.__ diff --git a/tests/SimpleAcl/RuleResultTest.php b/tests/SimpleAcl/RuleResultTest.php index c015218..104d5b6 100644 --- a/tests/SimpleAcl/RuleResultTest.php +++ b/tests/SimpleAcl/RuleResultTest.php @@ -10,8 +10,8 @@ class RuleResultTest extends PHPUnit_Framework_TestCase { public function testRuleResult() { - $roleAggregate = $this->getMock('SimpleAcl\Role\RoleAggregateInterface'); - $resourceAggregate = $this->getMock('SimpleAcl\Resource\ResourceAggregateInterface'); + $roleAggregate = $this->getMockBuilder('SimpleAcl\Role\RoleAggregateInterface')->getMock(); + $resourceAggregate = $this->getMockBuilder('SimpleAcl\Resource\ResourceAggregateInterface')->getMock(); $rule = new Rule('Test'); @@ -34,4 +34,4 @@ public function testRuleResult() $this->assertNotEmpty($result->getId()); } -} \ No newline at end of file +}