diff --git a/.editorconfig b/.editorconfig index 020231b3..5a909cb9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,6 +2,7 @@ root = true [*] charset = utf-8 +end_of_line = lf indent_size = 4 indent_style = space insert_final_newline = true @@ -10,6 +11,9 @@ trim_trailing_whitespace = true [*.json] indent_size = 2 +[*.md] +indent_size = 2 + [*.{yaml,yml}] indent_size = 2 diff --git a/.gitattributes b/.gitattributes index f8866dbb..23134608 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4,6 +4,9 @@ /.editorconfig export-ignore /.gitattributes export-ignore /.gitignore export-ignore -/.php_cs.dist export-ignore +/.php-cs-fixer.php export-ignore +/.yamllint.yaml export-ignore /Makefile export-ignore +/phive.xml export-ignore /phpunit.xml export-ignore +/psalm.xml export-ignore diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 64bf50cc..21dd5340 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,3 @@ -* @localheinz +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners + +* @ergebnis-bot @localheinz diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md index d9159b22..b948174b 100644 --- a/.github/CODE_OF_CONDUCT.md +++ b/.github/CODE_OF_CONDUCT.md @@ -8,19 +8,19 @@ In the interest of fostering an open and welcoming environment, we as contributo Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a professional setting +- The use of sexualized language or imagery and unwelcome sexual attention or advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3a6c9659..8a8c3e33 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -1,57 +1,70 @@ -# CONTRIBUTING +# Contributing -We are using [GitHub Actions](https://github.com/features/actions) as a continuous integration system. +We use [GitHub Actions](https://github.com/features/actions) as a continuous integration system. For details, take a look at the following workflow configuration files: - [`workflows/integrate.yaml`](workflows/integrate.yaml) +- [`workflows/merge.yaml`](workflows/merge.yaml) - [`workflows/release.yaml`](workflows/release.yaml) - [`workflows/triage.yaml`](workflows/triage.yaml) +## Backward-Compatibility Analysis + +We use [`roave/backward-compatibility-check`](https://github.com/Roave/BackwardCompatibilityCheck) to prevent breaking backwards-compatibility. + +Run + +```sh +make backward-compatibility-analysis +``` + +to run a backward-compatibility analysis. + ## Coding Standards -We are using [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`. +We use [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize) to normalize `composer.json`. -We are using [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files. +We use [`yamllint`](https://github.com/adrienverge/yamllint) to enforce coding standards in YAML files. If you do not have `yamllint` installed yet, run ```sh -$ brew install yamllint +brew install yamllint ``` to install `yamllint`. -We are using [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards in PHP files. +We use [`friendsofphp/php-cs-fixer`](https://github.com/FriendsOfPHP/PHP-CS-Fixer) to enforce coding standards in PHP files. Run ```sh -$ make coding-standards +make coding-standards ``` to automatically fix coding standard violations. ## Static Code Analysis -We are using [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code. +We use [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code. Run ```sh -$ make static-code-analysis +make static-code-analysis ``` to run a static code analysis. ## Tests -We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development. +We use [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development. Run ```sh -$ make tests +make tests ``` to run all the tests. @@ -61,7 +74,7 @@ to run all the tests. Run ```sh -$ make +make ``` to enforce coding standards, run a static code analysis, and run tests! @@ -71,7 +84,7 @@ to enforce coding standards, run a static code analysis, and run tests! :bulb: Run ```sh -$ make help +make help ``` to display a list of available targets with corresponding descriptions. diff --git a/.github/FUNDING.yaml b/.github/FUNDING.yaml new file mode 100644 index 00000000..8730580c --- /dev/null +++ b/.github/FUNDING.yaml @@ -0,0 +1,5 @@ +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/displaying-a-sponsor-button-in-your-repository + +github: + - "ergebnis" + - "localheinz" diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 9fd01781..00000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1 +0,0 @@ -github: "sebastianbergmann" diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 1788742b..4f697f15 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -6,8 +6,8 @@ #### Expected Result -* +- #### Actual Result -* +- diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 6020dcb2..45485df2 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,6 @@ -This PR +This pull request -* [x] -* [ ] +- [x] Follows #. Related to #. diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 00000000..e36d6dbd --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,17 @@ +# Security Policy + +## Supported Versions + +The following versions of `localheinz/diff` have active support: + +- `^1.1.0` + +## Unsupported Versions + +The following versions of `localheinz/diff` have reached their end of life: + +- `<1.1.0` + +## Reporting a Vulnerability + +If you believe that you have found a security vulnerability, please send an email to `am@localheinz.com`. Ensure to include all details required to understand the severity of the issue. diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 00000000..f2b724a7 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,32 @@ +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 + +updates: + - allow: + - dependency-type: "development" + commit-message: + include: "scope" + prefix: "composer" + directory: "/" + ignore: + - dependency-name: "phpunit/phpunit" + - dependency-name: "symfony/process" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "composer" + schedule: + interval: "weekly" + versioning-strategy: "increase" + + - commit-message: + include: "scope" + prefix: "github-actions" + directory: "/" + labels: + - "dependency" + open-pull-requests-limit: 10 + package-ecosystem: "github-actions" + schedule: + interval: "weekly" diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 9475dfc6..00000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,15 +0,0 @@ -# https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates - -version: 2 - -updates: - - commit-message: - include: "scope" - prefix: "github-actions" - directory: "/" - labels: - - "dependency" - open-pull-requests-limit: 10 - package-ecosystem: "github-actions" - schedule: - interval: "daily" diff --git a/.github/release.yaml b/.github/release.yaml new file mode 100644 index 00000000..5226faf2 --- /dev/null +++ b/.github/release.yaml @@ -0,0 +1,6 @@ +# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes#configuring-automatically-generated-release-notes + +changelog: + exclude: + authors: + - "dependabot" diff --git a/.github/settings.yml b/.github/settings.yml index fe17f8e9..71c2512d 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -1,4 +1,4 @@ -# https://github.com/probot/settings +# https://github.com/repository-settings/app branches: - name: "main" @@ -13,19 +13,21 @@ branches: require_code_owner_reviews: true required_approving_review_count: 1 required_status_checks: - contexts: - - "Code Coverage (7.4, highest)" - - "Coding Standards (7.1)" - - "Tests (7.1, highest)" - - "Tests (7.1, lowest)" - - "Tests (7.2, highest)" - - "Tests (7.2, lowest)" - - "Tests (7.3, highest)" - - "Tests (7.3, lowest)" - - "Tests (7.4, highest)" - - "Tests (7.4, lowest)" - - "Tests (8.0, highest)" - - "Tests (8.0, lowest)" + checks: + - context: "Backward-Compatibility Analysis (7.4, locked)" + - context: "Code Coverage (7.4, locked)" + - context: "Coding Standards (7.4, locked)" + - context: "Static Code Analysis (7.4, locked)" + - context: "Tests (7.1, highest)" + - context: "Tests (7.1, lowest)" + - context: "Tests (7.2, highest)" + - context: "Tests (7.2, lowest)" + - context: "Tests (7.3, highest)" + - context: "Tests (7.3, lowest)" + - context: "Tests (7.4, highest)" + - context: "Tests (7.4, lowest)" + - context: "Tests (8.0, highest)" + - context: "Tests (8.0, lowest)" strict: false restrictions: null @@ -45,10 +47,6 @@ labels: color: "0e8a16" description: "" - - name: "merge" - color: "6f42c1" - description: "" - - name: "question" color: "cc317c" description: "" @@ -57,10 +55,6 @@ labels: color: "ee0701" description: "" - - name: "stale" - color: "eeeeee" - description: "" - # https://docs.github.com/en/rest/reference/repos#update-a-repository repository: @@ -71,10 +65,18 @@ repository: default_branch: "main" delete_branch_on_merge: true description: ":fork_and_knife: Fork of sebastian/diff for use with ergebnis/composer-normalize." + enable_automated_security_fixes: true + enable_vulnerability_alerts: true + has_discussions: false has_downloads: true - has_issues: false + has_issues: true has_pages: false has_projects: false has_wiki: false + is_template: false name: "diff" private: false + + # https://docs.github.com/en/rest/reference/repos#replace-all-repository-topics + + topics: "php, diff" diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index ad300d41..f1065abf 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -9,35 +9,65 @@ on: # yamllint disable-line rule:truthy - "main" jobs: - backward-compatibility: - name: "Backward Compatibility" + backward-compatibility-analysis: + name: "Backward-Compatibility Analysis" runs-on: "ubuntu-latest" + timeout-minutes: 5 + + strategy: + matrix: + php-version: + - "7.4" + + dependencies: + - "highest" + steps: - name: "Checkout" uses: "actions/checkout@v4.2.2" with: fetch-depth: 0 - - name: "Fetch tags" - run: "git fetch --depth=1 origin +refs/tags/*:refs/tags/*" - - - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.31.1" with: - php-version: "7.4" coverage: "none" - extensions: "intl" + extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + php-version: "${{ matrix.php-version }}" + + - name: "Set up problem matchers for PHP" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" - - name: "Run roave/backward-compatibility-check" - run: "tools/roave-backward-compatibility-check --from=1.0.0" + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + + - name: "Determine composer cache directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v4.1.2" + 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: "ergebnis/.github/actions/composer/install@1.9.2" + with: + dependencies: "${{ matrix.dependencies }}" + + - name: "Run backward-compatibility analysis with roave/backward-compatibility-check" + run: "tools/roave-backward-compatibility-check --ansi --format=github-actions --from=1.1.0" code-coverage: name: "Code Coverage" runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -50,95 +80,109 @@ jobs: - name: "Checkout" uses: "actions/checkout@v4.2.2" - - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.31.1" with: coverage: "xdebug" + extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" + - name: "Set up problem matchers for PHP" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + + - name: "Set up problem matchers for phpunit/phpunit" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v4.1.2" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + 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 lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "ergebnis/.github/actions/composer/install@1.9.2" + with: + dependencies: "${{ matrix.dependencies }}" - name: "Collect code coverage with Xdebug and phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=phpunit.xml --coverage-clover=.build/logs/clover.xml" - - - name: "Send code coverage report to Codecov.io" env: - CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" - run: "bash <(curl -s https://codecov.io/bash)" + XDEBUG_MODE: "coverage" + run: "vendor/bin/phpunit --colors=always --configuration=phpunit.xml --coverage-clover=.build/phpunit/clover.xml" + + - name: "Send code coverage report to codecov.io" + uses: "codecov/codecov-action@v5.0.2" + with: + files: ".build/phpunit/logs/clover.xml" + token: "${{ secrets.CODECOV_TOKEN }}" coding-standards: name: "Coding Standards" runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: - "7.1" + dependencies: + - "locked" + steps: - name: "Checkout" uses: "actions/checkout@v4.2.2" - name: "Lint YAML files" - uses: "ibiqlik/action-yamllint@v1" + uses: "ibiqlik/action-yamllint@v3.1.1" with: config_file: ".yamllint.yaml" file_or_dir: "." strict: true - - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.31.1" with: coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" + extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - - name: "Validate composer.json and composer.lock" - run: "composer validate --strict" + - name: "Set up problem matchers for PHP" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" - name: "Run ergebnis/composer-normalize" run: "tools/composer-normalize --dry-run" - name: "Create cache directory for friendsofphp/php-cs-fixer" - run: "mkdir -p .build/php-cs-fixer" + run: "mkdir -p .build/php-cs-fixer/" - name: "Cache cache directory for friendsofphp/php-cs-fixer" - uses: "actions/cache@v2" + uses: "actions/cache@v4.1.2" with: - path: ".build/php-cs-fixer" - key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('tools/php-cs-fixer') }}" - restore-keys: "php-${{ matrix.php-version }}-php-cs-fixer-" + path: ".build/php-cs-fixer/" + key: "php-${{ matrix.php-version }}-php-cs-fixer-${{ github.ref_name }}" + restore-keys: | + php-${{ matrix.php-version }}-php-cs-fixer-main + php-${{ matrix.php-version }}-php-cs-fixer- - name: "Run friendsofphp/php-cs-fixer" - run: "tools/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --dry-run --verbose" + run: "tools/php-cs-fixer fix --config=.php-cs-fixer.php --diff --diff-format=udiff --dry-run --verbose" static-code-analysis: name: "Static Code Analysis" runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: matrix: php-version: @@ -151,42 +195,38 @@ jobs: - name: "Checkout" uses: "actions/checkout@v4.2.2" - - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.31.1" with: coverage: "none" + extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, opcache, pcntl, phar, posix, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" + - name: "Set up problem matchers for PHP" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v4.1.2" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + 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 lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" - - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" - - - name: "Create cache directory for vimeo/psalm" - run: "mkdir -p .build/psalm" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "ergebnis/.github/actions/composer/install@1.9.2" + with: + dependencies: "${{ matrix.dependencies }}" - name: "Cache cache directory for vimeo/psalm" uses: "actions/cache@v2" with: - path: ".build/psalm" + path: ".build/psalm/" key: "php-${{ matrix.php-version }}-psalm-${{ github.sha }}" restore-keys: "php-${{ matrix.php-version }}-psalm-" @@ -198,7 +238,10 @@ jobs: runs-on: "ubuntu-latest" + timeout-minutes: 5 + strategy: + fail-fast: false matrix: php-version: - "7.1" @@ -215,34 +258,40 @@ jobs: - name: "Checkout" uses: "actions/checkout@v4.2.2" - - name: "Install PHP with extensions" - uses: "shivammathur/setup-php@v2" + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.31.1" with: coverage: "none" + extensions: "none, bcmath, ctype, curl, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" + - name: "Set up problem matchers for PHP" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + + - name: "Set up problem matchers for phpunit/phpunit" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\"" + + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + - name: "Determine composer cache directory" - id: "determine-composer-cache-directory" - run: "echo \"::set-output name=directory::$(composer config cache-dir)\"" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.9.2" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v2" + uses: "actions/cache@v4.1.2" with: - path: "${{ steps.determine-composer-cache-directory.outputs.directory }}" + 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 lowest dependencies from composer.json" - if: "matrix.dependencies == 'lowest'" - run: "composer update --no-interaction --no-progress --no-suggest --prefer-lowest" - - - name: "Install locked dependencies from composer.lock" - if: "matrix.dependencies == 'locked'" - run: "composer install --no-interaction --no-progress --no-suggest" + - name: "Remove platform configuration with composer" + if: "matrix.dependencies != 'locked'" + run: "composer config platform.php --ansi --unset" - - name: "Install highest dependencies from composer.json" - if: "matrix.dependencies == 'highest'" - run: "composer update --no-interaction --no-progress --no-suggest" + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "ergebnis/.github/actions/composer/install@1.9.2" + with: + dependencies: "${{ matrix.dependencies }}" - name: "Run tests with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=phpunit.xml" + run: "vendor/bin/phpunit --colors=always --configuration=phpunit.xml" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b233e4a8..2921cc87 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,17 +13,10 @@ jobs: runs-on: "ubuntu-latest" - steps: - - name: "Determine tag" - id: "determine-tag" - run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\"" + timeout-minutes: 5 + steps: - name: "Create release" - uses: "actions/create-release@v1.1.1" - env: - ERGEBNIS_BOT_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + uses: "ergebnis/.github/actions/github/release/create@1.9.2" with: - draft: false - prerelease: false - release_name: "${{ steps.determine-tag.outputs.tag }}" - tag_name: "${{ steps.determine-tag.outputs.tag }}" + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" diff --git a/.gitignore b/.gitignore index 2726cad3..3d13ea05 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ /.build/ -/.notes/ +/.note/ /vendor/ /from.txt.orig /composer.lock diff --git a/.php_cs b/.php-cs-fixer.php similarity index 99% rename from .php_cs rename to .php-cs-fixer.php index 1abc0858..8176983e 100644 --- a/.php_cs +++ b/.php-cs-fixer.php @@ -14,7 +14,7 @@ ->in(__DIR__ . '/tests'); return PhpCsFixer\Config::create() - ->setCacheFile(__DIR__ . '/.build/php-cs-fixer/.php_cs.cache') + ->setCacheFile(__DIR__ . '/.build/php-cs-fixer/.php-cs-fixer.cache') ->setFinder($finder) ->setRiskyAllowed(true) ->setRules([ diff --git a/.yamllint.yaml b/.yamllint.yaml index b2129ac2..af99fe0f 100644 --- a/.yamllint.yaml +++ b/.yamllint.yaml @@ -2,7 +2,7 @@ extends: "default" ignore: | .build/ - .notes/ + .note/ vendor/ rules: diff --git a/Makefile b/Makefile index 7c156d39..be2b3c8b 100644 --- a/Makefile +++ b/Makefile @@ -1,29 +1,35 @@ .PHONY: it it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis, and tests targets +.PHONY: backward-compatibility-analysis +backward-compatibility-analysis: vendor ## Runs a backward-compatibility analysis with roave/backward-compatibility-check + tools/roave-backward-compatibility-check --from=1.1.0 + +.PHONY: code-coverage +code-coverage: vendor ## Collects code coverage from running unit tests with phpunit/phpunit + vendor/bin/phpunit --configuration=phpunit.xml --coverage-text + .PHONY: coding-standards -coding-standards: vendor ## Normalizes composer.json with ergebnis/composer-normalize, lints YAML files with yamllint and fixes code style issues with friendsofphp/php-cs-fixer - tools/composer-normalize +coding-standards: vendor ## Lints YAML files with yamllint, normalizes composer.json with ergebnis/composer-normalize, and fixes code style issues with friendsofphp/php-cs-fixer yamllint -c .yamllint.yaml --strict . - mkdir -p .build/php-cs-fixer - tools/php-cs-fixer fix --config=.php_cs --diff --diff-format=udiff --verbose + tools/composer-normalize + tools/php-cs-fixer fix --config=.php-cs-fixer.php --diff --diff-format=udiff --verbose .PHONY: help help: ## Displays this list of targets with descriptions @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' -.PHONY: tests -tests: vendor ## Runs tests with phpunit/phpunit - mkdir -p .build/phpunit - composer dump-autoload - vendor/bin/phpunit --configuration=phpunit.xml .PHONY: static-code-analysis static-code-analysis: vendor ## Runs a static code analysis with vimeo/psalm - mkdir -p .build/psalm composer dump-autoload tools/psalm --config=psalm.xml --diff --diff-methods --show-info=false --stats --threads=4 +.PHONY: tests +tests: vendor ## Runs unit tests with phpunit/phpunit + composer dump-autoload + vendor/bin/phpunit --configuration=phpunit.xml + vendor: composer.json composer validate --strict - composer install --no-interaction --no-progress --no-suggest + composer install --no-interaction --no-progress diff --git a/README.md b/README.md index 554549c9..f3fda01a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,16 @@ # diff -[![Integrate](https://github.com/localheinz/diff/workflows/Integrate/badge.svg?branch=main)](https://github.com/localheinz/diff/actions) -[![Release](https://github.com/localheinz/diff/workflows/Release/badge.svg?branch=main)](https://github.com/localheinz/diff/actions) +[![Integrate](https://github.com/localheinz/diff/workflows/Integrate/badge.svg)](https://github.com/localheinz/diff/actions) +[![Merge](https://github.com/localheinz/diff/workflows/Merge/badge.svg)](https://github.com/localheinz/diff/actions) +[![Release](https://github.com/localheinz/diff/workflows/Release/badge.svg)](https://github.com/localheinz/diff/actions) +[![Renew](https://github.com/localheinz/diff/workflows/Renew/badge.svg)](https://github.com/localheinz/diff/actions) [![Code Coverage](https://codecov.io/gh/localheinz/diff/branch/main/graph/badge.svg)](https://codecov.io/gh/localheinz/diff) [![Type Coverage](https://shepherd.dev/github/localheinz/diff/coverage.svg)](https://shepherd.dev/github/localheinz/diff) [![Latest Stable Version](https://poser.pugx.org/localheinz/diff/v/stable)](https://packagist.org/packages/localheinz/diff) [![Total Downloads](https://poser.pugx.org/localheinz/diff/downloads)](https://packagist.org/packages/localheinz/diff) +[![Monthly Downloads](http://poser.pugx.org/localheinz/diff/d/monthly)](https://packagist.org/packages/localheinz/diff) This is a fork of [`sebastian/diff`](https://github.com/sebastianbergmann/diff) for use with [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize), with permission from Sebastian Bergmann.