From 60bb08b8b867c8a5d88b4570d5eafbb58d1d9dfa Mon Sep 17 00:00:00 2001 From: Peter Elmered Date: Tue, 5 Oct 2021 10:46:35 +0200 Subject: [PATCH] Replace Travis with GutHub Action for running tests (#21) * Fix dependabot config * Add GitHub Actions workflow for running tests * Remove Travis config * Require PHPUnit 9.5+ --- .github/dependabot.yml | 6 ++--- .github/workflows/run-tests.yml | 48 +++++++++++++++++++++++++++++++++ .travis.yml | 32 ---------------------- composer.json | 2 +- 4 files changed, 52 insertions(+), 36 deletions(-) create mode 100644 .github/workflows/run-tests.yml delete mode 100644 .travis.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 63b09dc..4b5f9ae 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,11 +7,11 @@ version: 2 updates: - package-ecosystem: "composer" directory: "/" - target-branch: "develop" schedule: - interval: "daily" + interval: "daily" + target-branch: "master" commit-message: prefix: "Composer" include: "scope" labels: - - "composer dependencies" + - "composer" diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..dfcf045 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,48 @@ +name: run-tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-latest] + php: [7.3, 7.4, 8.0, 8.1] + stability: [prefer-lowest, prefer-stable] + + name: P${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo + coverage: pcov + - name: Setup problem matchers + run: | + echo "::add-matcher::${{ runner.tool_cache }}/php.json" + echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + - name: Install dependencies + run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction + - name: Execute tests + run: vendor/bin/phpunit --coverage-clover=coverage.xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: tests + name: codecov-umbrella + #yml: ./codecov.yml + fail_ci_if_error: true + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6d656e0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ - -language: php -os: linux -dist: bionic - -notifications: - email: - on_success: never - on_failure: change - -before_script: -- composer install --dev - -script: - - vendor/bin/phpunit --coverage-clover=coverage.clover - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover coverage.clover - -after_success: - - bash <(curl -s https://codecov.io/bash) - - codecov - -php: - - 7.3 - - 7.4 - - nightly - -jobs: - allow_failures: - - php: nightly diff --git a/composer.json b/composer.json index 9d0439f..4da9c45 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "fakerphp/faker": "^1.10" }, "require-dev": { - "phpunit/phpunit": "^9.0" + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": {