diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index cb570a55..46ffbaf1 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 [`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 481917f4..9cbfbb65 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -12,8 +12,8 @@ env: PHP_EXTENSIONS: "mbstring" jobs: - coding-standards: - name: "Coding Standards" + code-coverage: + name: "Code Coverage" runs-on: "ubuntu-latest" @@ -29,22 +29,15 @@ jobs: - name: "Checkout" uses: "actions/checkout@v2.4.0" - - name: "Lint YAML files" - uses: "ibiqlik/action-yamllint@v3" - with: - config_file: ".yamllint.yaml" - file_or_dir: "." - strict: true - - 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 }}" - - name: "Validate composer.json and composer.lock" - run: "composer validate --strict" + - 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" @@ -61,24 +54,16 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - name: "Run ergebnis/composer-normalize" - run: ".phive/composer-normalize --dry-run" - - - name: "Create cache directory for friendsofphp/php-cs-fixer" - run: "mkdir -p .build/php-cs-fixer" - - - name: "Cache cache directory for friendsofphp/php-cs-fixer" - uses: "actions/cache@v2.1.7" - with: - path: ".build/php-cs-fixer" - key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.sha }}" - restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-" + - name: "Collect code coverage with Xdebug and phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=.build/phpunit/logs/clover.xml" - - name: "Run friendsofphp/php-cs-fixer" - run: "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --dry-run --verbose" + - name: "Send code coverage report to Codecov.io" + env: + CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" + run: "bash <(curl -s https://codecov.io/bash)" - dependency-analysis: - name: "Dependency Analysis" + coding-standards: + name: "Coding Standards" runs-on: "ubuntu-latest" @@ -94,6 +79,13 @@ jobs: - name: "Checkout" uses: "actions/checkout@v2.4.0" + - name: "Lint YAML files" + uses: "ibiqlik/action-yamllint@v3" + with: + config_file: ".yamllint.yaml" + file_or_dir: "." + strict: true + - name: "Install PHP with extensions" uses: "shivammathur/setup-php@2.16.0" with: @@ -101,6 +93,9 @@ jobs: extensions: "${{ env.PHP_EXTENSIONS }}" php-version: "${{ matrix.php-version }}" + - name: "Validate composer.json and composer.lock" + run: "composer validate --strict" + - name: "Determine composer cache directory" uses: "./.github/actions/composer/composer/determine-cache-directory" @@ -116,11 +111,24 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - name: "Run maglnet/composer-require-checker" - run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json" + - name: "Run ergebnis/composer-normalize" + run: ".phive/composer-normalize --dry-run" - static-code-analysis: - name: "Static Code Analysis" + - name: "Create cache directory for friendsofphp/php-cs-fixer" + run: "mkdir -p .build/php-cs-fixer" + + - name: "Cache cache directory for friendsofphp/php-cs-fixer" + uses: "actions/cache@v2.1.7" + with: + path: ".build/php-cs-fixer" + key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.sha }}" + restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-" + + - name: "Run friendsofphp/php-cs-fixer" + run: "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --dry-run --verbose" + + dependency-analysis: + name: "Dependency Analysis" runs-on: "ubuntu-latest" @@ -158,14 +166,11 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - 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 maglnet/composer-require-checker" + run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json" - tests: - name: "Tests" + mutation-tests: + name: "Mutation Tests" runs-on: "ubuntu-latest" @@ -173,13 +178,9 @@ jobs: matrix: php-version: - "7.4" - - "8.0" - - "8.1" dependencies: - - "lowest" - "locked" - - "highest" steps: - name: "Checkout" @@ -188,13 +189,10 @@ 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 }}" - - 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" @@ -210,11 +208,11 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - name: "Run unit tests with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml" + - name: "Run mutation tests with Xdebug and infection/infection" + run: "vendor/bin/infection --configuration=infection.json" - code-coverage: - name: "Code Coverage" + static-code-analysis: + name: "Static Code Analysis" runs-on: "ubuntu-latest" @@ -233,13 +231,10 @@ 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 }}" - - 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" @@ -255,16 +250,14 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - name: "Collect code coverage with Xdebug and phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=.build/phpunit/logs/clover.xml" + - name: "Create cache directory for vimeo/psalm" + run: "mkdir -p .build/psalm" - - name: "Send code coverage report to Codecov.io" - env: - CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" - run: "bash <(curl -s https://codecov.io/bash)" + - name: "Run vimeo/psalm" + run: "vendor/bin/psalm --config=psalm.xml --diff --shepherd --show-info=false --stats --threads=4" - mutation-tests: - name: "Mutation Tests" + tests: + name: "Tests" runs-on: "ubuntu-latest" @@ -272,9 +265,13 @@ jobs: matrix: php-version: - "7.4" + - "8.0" + - "8.1" dependencies: + - "lowest" - "locked" + - "highest" steps: - name: "Checkout" @@ -283,10 +280,13 @@ 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 }}" + - 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" @@ -302,5 +302,5 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" - - name: "Run mutation tests with Xdebug and infection/infection" - run: "vendor/bin/infection --configuration=infection.json" + - name: "Run unit tests with phpunit/phpunit" + run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml"