From 689b8b674727735aa9794a3006cc171ebfd63c71 Mon Sep 17 00:00:00 2001 From: Luc De Brouwer Date: Mon, 23 Feb 2026 19:21:51 +0000 Subject: [PATCH] Combine workflows, generate code coverage and upload it to Codecov. --- .github/workflows/php_84.yml | 39 ----------------- .github/workflows/php_85.yml | 39 ----------------- .github/workflows/tests.yml | 83 ++++++++++++++++++++++++++++++++++++ README.md | 2 +- 4 files changed, 84 insertions(+), 79 deletions(-) delete mode 100644 .github/workflows/php_84.yml delete mode 100644 .github/workflows/php_85.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/php_84.yml b/.github/workflows/php_84.yml deleted file mode 100644 index aa7d89b..0000000 --- a/.github/workflows/php_84.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: PHP 8.4 -on: push - -jobs: - build: - name: Static analysis, unit tests, and linting - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Setup PHP 8.4 - uses: shivammathur/setup-php@v2 - with: - php-version: '8.4' - tools: composer - - - name: Cache Composer dependencies - uses: actions/cache@v5 - with: - path: ./vendor - key: composer-${{ runner.os }}-8.4 - - - name: Install dependencies - run: | - composer install - - - name: Run PHPStan - run: | - ./vendor/bin/phpstan - - - name: PHP Code Sniffer - run: | - ./vendor/bin/phpcs - - - name: Run PHPUnit - run: | - ./vendor/bin/phpunit \ No newline at end of file diff --git a/.github/workflows/php_85.yml b/.github/workflows/php_85.yml deleted file mode 100644 index b44a2d1..0000000 --- a/.github/workflows/php_85.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: PHP 8.5 -on: push - -jobs: - build: - name: Static analysis, unit tests, and linting - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v6 - - - name: Setup PHP 8.5 - uses: shivammathur/setup-php@v2 - with: - php-version: '8.5' - tools: composer - - - name: Cache Composer dependencies - uses: actions/cache@v5 - with: - path: ./vendor - key: composer-${{ runner.os }}-8.5 - - - name: Install dependencies - run: | - composer install - - - name: Run PHPStan - run: | - ./vendor/bin/phpstan - - - name: PHP Code Sniffer - run: | - ./vendor/bin/phpcs - - - name: Run PHPUnit - run: | - ./vendor/bin/phpunit \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..73faf98 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,83 @@ +name: Tests +on: push + +jobs: + build-84: + name: Static analysis, unit tests, and linting on PHP 8.4 + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup PHP 8.4 + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + tools: composer + + - name: Cache Composer dependencies + uses: actions/cache@v5 + with: + path: ./vendor + key: composer-${{ runner.os }}-8.4 + + - name: Install dependencies + run: | + composer install + + - name: Run PHPStan + run: | + ./vendor/bin/phpstan + + - name: PHP Code Sniffer + run: | + ./vendor/bin/phpcs + + - name: Run PHPUnit + run: | + ./vendor/bin/phpunit + + build-85: + name: Static analysis, unit tests, and linting on PHP 8.5 + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup PHP 8.5 + uses: shivammathur/setup-php@v2 + with: + php-version: '8.5' + tools: composer + coverage: pcov + + - name: Cache Composer dependencies + uses: actions/cache@v5 + with: + path: ./vendor + key: composer-${{ runner.os }}-8.5 + + - name: Install dependencies + run: | + composer install + + - name: Run PHPStan + run: | + ./vendor/bin/phpstan + + - name: PHP Code Sniffer + run: | + ./vendor/bin/phpcs + + - name: Run PHPUnit + run: | + ./vendor/bin/phpunit --coverage-clover ./coverage.xml + + - name: Upload to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./coverage.xml + verbose: true \ No newline at end of file diff --git a/README.md b/README.md index a3877bf..3517722 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Distance -[![Build Status](https://travis-ci.org/ldebrouwer/distance.svg)](https://travis-ci.org/ldebrouwer/distance) +[![Tests](https://github.com/ldebrouwer/distance/actions/workflows/tests.yml/badge.svg)](https://github.com/ldebrouwer/distance/actions/workflows/tests.yml) [![Latest Stable Version](https://poser.pugx.org/ldebrouwer/distance/v/stable)](https://packagist.org/packages/ldebrouwer/distance) [![Total Downloads](https://poser.pugx.org/ldebrouwer/distance/downloads)](https://packagist.org/packages/ldebrouwer/distance) [![Latest Unstable Version](https://poser.pugx.org/ldebrouwer/distance/v/unstable)](https://packagist.org/packages/ldebrouwer/distance)