From 0d22a7fb433326eeb78530266073dbb1602427ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Chr=C3=A1steck=C3=BD?= Date: Tue, 20 Apr 2021 13:06:45 +0200 Subject: [PATCH] switch to github actions (#37) --- .coveralls.yml | 3 - .github/workflows/bc_check.yaml | 24 ++++++++ .github/workflows/create_release.yaml | 23 ++++++++ .github/workflows/test.yaml | 79 +++++++++++++++++++++++++++ .travis.yml | 37 ------------- README.md | 2 +- composer.json | 3 +- 7 files changed, 129 insertions(+), 42 deletions(-) delete mode 100644 .coveralls.yml create mode 100644 .github/workflows/bc_check.yaml create mode 100644 .github/workflows/create_release.yaml create mode 100644 .github/workflows/test.yaml delete mode 100644 .travis.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index 41492ae..0000000 --- a/.coveralls.yml +++ /dev/null @@ -1,3 +0,0 @@ -service_name: travis-ci -coverage_clover: ./tmp/clover.xml -json_path: ./tmp/coverage.json \ No newline at end of file diff --git a/.github/workflows/bc_check.yaml b/.github/workflows/bc_check.yaml new file mode 100644 index 0000000..199b1a3 --- /dev/null +++ b/.github/workflows/bc_check.yaml @@ -0,0 +1,24 @@ +name: BC Check +on: + push: + branches: + - master + pull_request: + workflow_dispatch: +jobs: + bc_check: + name: Backwards Compatibility Check + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + - name: Checkout Code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Install BC checker + run: composer require --dev roave/backward-compatibility-check + - name: Check for BC breaks + run: vendor/bin/roave-backward-compatibility-check diff --git a/.github/workflows/create_release.yaml b/.github/workflows/create_release.yaml new file mode 100644 index 0000000..5030f84 --- /dev/null +++ b/.github/workflows/create_release.yaml @@ -0,0 +1,23 @@ +name: Create Release + +on: + push: + tags: + - v* + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Create a Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..9747501 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,79 @@ +name: Tests +on: + push: + branches: + - master + pull_request: + workflow_dispatch: +jobs: + code_style: + name: Test code style + runs-on: ubuntu-latest + strategy: + matrix: + version: ['7.3', '7.4', '8.0'] + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.version }} + - name: Checkout Code + uses: actions/checkout@v2 + - name: Install Dependencies + run: composer install + - name: Test code style + run: composer fixer -- --dry-run + static_analysis: + name: Static analysis + runs-on: ubuntu-latest + strategy: + matrix: + version: ['7.3', '7.4', '8.0'] + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.version }} + - name: Checkout Code + uses: actions/checkout@v2 + - name: Install Dependencies + run: composer install + - name: Run static analysis + run: composer phpstan + tests: + name: Tests + runs-on: ubuntu-latest + strategy: + matrix: + version: ['7.3', '7.4', '8.0'] + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.version }} + - name: Checkout Code + uses: actions/checkout@v2 + - name: Install Dependencies + run: composer install + - name: Run tests + run: composer phpunit + coverage: + name: Report Coverage + runs-on: ubuntu-latest + steps: + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '7.4' + - name: Checkout Code + uses: actions/checkout@v2 + - name: Install Dependencies + run: composer install + - name: Generate Coverage + run: composer phpunit -- --coverage-clover ./build/logs/clover.xml + - name: Download Coverage Client + run: wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar + - name: Publish Coverage + run: php php-coveralls.phar -v + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6c212d4..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: php -dist: xenial - -matrix: - include: - - php: 7.3 - env: - - USE_PHPSTAN="1" - - USE_FIXER="1" - - php: 7.4 - env: - - XDEBUG_MODE="coverage" - - USE_PHPSTAN="1" - - USE_FIXER="1" - - USE_COVERAGE="1" - - PHPUNIT_FLAGS="--coverage-clover ./tmp/clover.xml" - - php: 8.0 - env: - - USE_PHPSTAN="1" - - USE_FIXER="1" -cache: - directories: - - $HOME/.cache/composer/files - -install: composer install $COMPOSER_FLAGS - -script: - - vendor/bin/phpunit $PHPUNIT_FLAGS - - '[[ $USE_FIXER != "1" ]] || vendor/bin/php-cs-fixer fix src/ --dry-run --verbose' - - '[[ $USE_PHPSTAN != "1" ]] || composer phpstan' - -after_script: - - '[[ $USE_COVERAGE != "1" ]] || ./vendor/bin/php-coveralls --verbose' - -branches: - only: - - master diff --git a/README.md b/README.md index d2c3d8f..b152284 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # QR code payment (EU) -[![Build Status](https://img.shields.io/travis/com/RikudouSage/QrPaymentEU/master.svg)](https://travis-ci.com/RikudouSage/QrPaymentEU) +[![Tests](https://github.com/RikudouSage/QrPaymentEU/actions/workflows/test.yaml/badge.svg)](https://github.com/RikudouSage/QrPaymentEU/actions/workflows/test.yaml) [![Coverage Status](https://img.shields.io/coveralls/github/RikudouSage/QrPaymentEU/master.svg)](https://coveralls.io/github/RikudouSage/QrPaymentEU?branch=master) [![Download](https://img.shields.io/packagist/dt/rikudou/euqrpayment.svg)](https://packagist.org/packages/rikudou/euqrpayment) diff --git a/composer.json b/composer.json index 46eee12..0848516 100644 --- a/composer.json +++ b/composer.json @@ -42,6 +42,7 @@ }, "scripts": { "fixer": "php-cs-fixer fix src --verbose", - "phpstan": "phpstan analyse --level=7 src" + "phpstan": "phpstan analyse --level=7 src", + "phpunit": "phpunit" } }