diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a6263b63..385930c9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -47,6 +47,18 @@ $ make dependency-analysis to run a dependency analysis. +## Mutation Tests + +We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests. + +Enable `Xdebug` and run + +```sh +$ make mutation-tests +``` + +to run mutation tests. + ## Static Code Analysis We are using [`phpstan/phpstan`](https://github.com/phpstan/phpstan) and [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code. @@ -83,18 +95,6 @@ $ make tests to run all the tests. -## Mutation Tests - -We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests. - -Enable `Xdebug` and run - -```sh -$ make mutation-tests -``` - -to run mutation tests. - ## Extra lazy? Run diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 1b3d848f..63d91dab 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -12,6 +12,56 @@ env: PHP_EXTENSIONS: "mbstring" jobs: + code-coverage: + name: "Code Coverage" + + runs-on: "ubuntu-latest" + + strategy: + matrix: + php-version: + - "7.4" + + dependencies: + - "locked" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2.4.0" + + - name: "Install PHP with extensions" + uses: "shivammathur/setup-php@2.16.0" + with: + coverage: "xdebug" + extensions: "${{ env.PHP_EXTENSIONS }}" + php-version: "${{ matrix.php-version }}" + + - name: "Set up problem matchers for phpunit/phpunit" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + + - name: "Determine composer cache directory" + uses: "./.github/actions/composer/composer/determine-cache-directory" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v2.1.7" + with: + path: "${{ env.COMPOSER_CACHE_DIR }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "./.github/actions/composer/composer/install" + with: + dependencies: "${{ matrix.dependencies }}" + + - name: "Collect code coverage with Xdebug and phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-clover=.build/phpunit/logs/clover.xml --testsuite=unit,integration" + + - name: "Send code coverage report to Codecov.io" + env: + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" + run: "bash <(curl -s https://codecov.io/bash)" + coding-standards: name: "Coding Standards" @@ -122,8 +172,8 @@ jobs: - name: "Run maglnet/composer-require-checker" run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json" - static-code-analysis: - name: "Static Code Analysis" + mutation-tests: + name: "Mutation Tests" runs-on: "ubuntu-latest" @@ -142,7 +192,7 @@ jobs: - name: "Install PHP with extensions" uses: "shivammathur/setup-php@2.16.0" with: - coverage: "none" + coverage: "xdebug" extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" @@ -161,20 +211,11 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - name: "Create cache directory for phpstan/phpstan" - run: "mkdir -p .build/phpstan" - - - name: "Run phpstan/phpstan" - run: "vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=-1" - - - name: "Create cache directory for vimeo/psalm" - run: "mkdir -p .build/psalm" - - - name: "Run vimeo/psalm" - run: "vendor/bin/psalm --config=psalm.xml --diff --shepherd --show-info=false --stats --threads=4" + - name: "Run mutation tests with Xdebug and infection/infection" + run: "vendor/bin/infection --configuration=infection.json" - tests: - name: "Tests" + static-code-analysis: + name: "Static Code Analysis" runs-on: "ubuntu-latest" @@ -182,13 +223,9 @@ jobs: matrix: php-version: - "7.4" - - "8.0" - - "8.1" dependencies: - - "lowest" - "locked" - - "highest" steps: - name: "Checkout" @@ -201,9 +238,6 @@ jobs: extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" - - name: "Set up problem matchers for phpunit/phpunit" - run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" - - name: "Determine composer cache directory" uses: "./.github/actions/composer/composer/determine-cache-directory" @@ -219,29 +253,20 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - name: "Show Doctrine mapping information" - run: "vendor/bin/doctrine orm:info" - - - name: "Validate Doctrine mapping" - run: "vendor/bin/doctrine orm:validate-schema --skip-sync" - - - name: "Run auto-review tests with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=auto-review" - - - name: "Run unit tests with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=unit" + - name: "Create cache directory for phpstan/phpstan" + run: "mkdir -p .build/phpstan" - - name: "Run integration tests with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=integration" + - name: "Run phpstan/phpstan" + run: "vendor/bin/phpstan analyse --configuration=phpstan.neon --memory-limit=-1" - - name: "Run auto-review tests for examples with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=example/test/AutoReview/phpunit.xml" + - name: "Create cache directory for vimeo/psalm" + run: "mkdir -p .build/psalm" - - name: "Run unit tests for examples with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=example/test/Unit/phpunit.xml" + - name: "Run vimeo/psalm" + run: "vendor/bin/psalm --config=psalm.xml --diff --shepherd --show-info=false --stats --threads=4" - code-coverage: - name: "Code Coverage" + tests: + name: "Tests" runs-on: "ubuntu-latest" @@ -249,9 +274,13 @@ jobs: matrix: php-version: - "7.4" + - "8.0" + - "8.1" dependencies: + - "lowest" - "locked" + - "highest" steps: - name: "Checkout" @@ -260,7 +289,7 @@ jobs: - name: "Install PHP with extensions" uses: "shivammathur/setup-php@2.16.0" with: - coverage: "xdebug" + coverage: "none" extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" @@ -282,52 +311,23 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - name: "Collect code coverage with Xdebug and phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=test/phpunit.xml --coverage-clover=.build/phpunit/logs/clover.xml --testsuite=unit,integration" - - - name: "Send code coverage report to Codecov.io" - env: - CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" - run: "bash <(curl -s https://codecov.io/bash)" - - mutation-tests: - name: "Mutation Tests" - - runs-on: "ubuntu-latest" - - strategy: - matrix: - php-version: - - "7.4" - - dependencies: - - "locked" + - name: "Show Doctrine mapping information" + run: "vendor/bin/doctrine orm:info" - steps: - - name: "Checkout" - uses: "actions/checkout@v2.4.0" + - name: "Validate Doctrine mapping" + run: "vendor/bin/doctrine orm:validate-schema --skip-sync" - - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@2.16.0" - with: - coverage: "xdebug" - extensions: "${{ env.PHP_EXTENSIONS }}" - php-version: "${{ matrix.php-version }}" + - name: "Run auto-review tests with phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=auto-review" - - name: "Determine composer cache directory" - uses: "./.github/actions/composer/composer/determine-cache-directory" + - name: "Run unit tests with phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=unit" - - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2.1.7" - with: - path: "${{ env.COMPOSER_CACHE_DIR }}" - key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" - restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + - name: "Run integration tests with phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=test/phpunit.xml --testsuite=integration" - - name: "Install ${{ matrix.dependencies }} dependencies with composer" - uses: "./.github/actions/composer/composer/install" - with: - dependencies: "${{ matrix.dependencies }}" + - name: "Run auto-review tests for examples with phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=example/test/AutoReview/phpunit.xml" - - name: "Run mutation tests with Xdebug and infection/infection" - run: "vendor/bin/infection --configuration=infection.json" + - name: "Run unit tests for examples with phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=example/test/Unit/phpunit.xml"