From 3e2d896014f051159241abae0ea1ddc2a60db2ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sun, 24 Jul 2022 10:19:31 +0200 Subject: [PATCH] Enhancement: Synchronize with ergebnis/php-package-template --- .github/CONTRIBUTING.md | 116 ---------------- .../determine-cache-directory/action.yaml | 16 --- .../composer/composer/install/action.yaml | 22 ---- .../actions/composer/composer/install/run.sh | 25 ---- .github/settings.yml | 32 ++--- .github/workflows/integrate.yaml | 124 ++++++++++-------- .github/workflows/merge.yaml | 58 +------- .github/workflows/prune.yaml | 2 +- .github/workflows/release.yaml | 13 +- .github/workflows/renew.yaml | 24 ++-- .github/workflows/triage.yaml | 27 +--- 11 files changed, 111 insertions(+), 348 deletions(-) delete mode 100644 .github/CONTRIBUTING.md delete mode 100644 .github/actions/composer/composer/determine-cache-directory/action.yaml delete mode 100644 .github/actions/composer/composer/install/action.yaml delete mode 100755 .github/actions/composer/composer/install/run.sh diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md deleted file mode 100644 index 46ffbaf1..00000000 --- a/.github/CONTRIBUTING.md +++ /dev/null @@ -1,116 +0,0 @@ -# CONTRIBUTING - -We are using [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/prune.yaml`](workflows/prune.yaml) -- [`workflows/release.yaml`](workflows/release.yaml) -- [`workflows/renew.yaml`](workflows/renew.yaml) -- [`workflows/triage.yaml`](workflows/triage.yaml) - -## Coding Standards - -We are using [`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. - -If you do not have `yamllint` installed yet, run - -```sh -$ 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. - -Run - -```sh -$ make coding-standards -``` - -to automatically fix coding standard violations. - -## Dependency Analysis - -We are using [`maglnet/composer-require-checker`](https://github.com/maglnet/ComposerRequireChecker) to prevent the use of unknown symbols in production code. - -Run - -```sh -$ 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. - -Run - -```sh -$ make static-code-analysis -``` - -to run a static code analysis. - -We are also using the baseline feature of [`vimeo/psalm`](https://psalm.dev/docs/running_psalm/dealing_with_code_issues/#using-a-baseline-file). - -Run - -```sh -$ make static-code-analysis-baseline -``` - -to regenerate the baseline in [`../psalm-baseline.xml`](../psalm-baseline.xml). - -:exclamation: Ideally, the baseline should shrink over time. - -## Tests - -We are using [`phpunit/phpunit`](https://github.com/sebastianbergmann/phpunit) to drive the development. - -Run - -```sh -$ make tests -``` - -to run all the tests. - -## Extra lazy? - -Run - -```sh -$ make -``` - -to enforce coding standards, run a static code analysis, and run tests! - -## Help - -:bulb: Run - -```sh -$ make help -``` - -to display a list of available targets with corresponding descriptions. diff --git a/.github/actions/composer/composer/determine-cache-directory/action.yaml b/.github/actions/composer/composer/determine-cache-directory/action.yaml deleted file mode 100644 index 4842e88c..00000000 --- a/.github/actions/composer/composer/determine-cache-directory/action.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action -# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs -# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions -# https://getcomposer.org/doc/03-cli.md#composer-cache-dir - -name: "Determine composer cache directory" - -description: "Determines the composer cache directory and exports it as COMPOSER_CACHE_DIR environment variable" - -runs: - using: "composite" - - steps: - - name: "Determine composer cache directory" - shell: "bash" - run: "echo \"COMPOSER_CACHE_DIR=$(composer config cache-dir)\" >> $GITHUB_ENV" diff --git a/.github/actions/composer/composer/install/action.yaml b/.github/actions/composer/composer/install/action.yaml deleted file mode 100644 index bab262e5..00000000 --- a/.github/actions/composer/composer/install/action.yaml +++ /dev/null @@ -1,22 +0,0 @@ -# https://docs.github.com/en/actions/creating-actions/creating-a-composite-run-steps-action -# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#inputs -# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runs-for-composite-run-steps-actions - -name: "Install dependencies with composer" - -description: "Installs dependencies with composer" - -inputs: - dependencies: - description: "Which dependencies to install, one of \"lowest\", \"locked\", \"highest\"" - required: true - -runs: - using: "composite" - - steps: - - name: "Install ${{ inputs.dependencies }} dependencies with composer" - shell: "bash" - run: "${{ github.action_path }}/run.sh" - env: - COMPOSER_INSTALL_DEPENDENCIES: "${{ inputs.dependencies }}" diff --git a/.github/actions/composer/composer/install/run.sh b/.github/actions/composer/composer/install/run.sh deleted file mode 100755 index a052ba6a..00000000 --- a/.github/actions/composer/composer/install/run.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -dependencies="${COMPOSER_INSTALL_DEPENDENCIES}" - -if [[ ${dependencies} == "lowest" ]]; then - composer update --no-interaction --no-progress --prefer-lowest - - exit $? -fi - -if [[ ${dependencies} == "locked" ]]; then - composer install --no-interaction --no-progress - - exit $? -fi - -if [[ ${dependencies} == "highest" ]]; then - composer update --no-interaction --no-progress - - exit $? -fi - -echo "::error::The value for the \"dependencies\" input needs to be one of \"lowest\", \"locked\"', \"highest\"' - got \"${dependencies}\" instead." - -exit 1 diff --git a/.github/settings.yml b/.github/settings.yml index 55072605..3bb6385e 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -13,21 +13,21 @@ branches: require_code_owner_reviews: true required_approving_review_count: 1 required_status_checks: - contexts: - - "Code Coverage (7.4, locked)" - - "Coding Standards (7.4, locked)" - - "Dependency Analysis (7.4, locked)" - - "Mutation Tests (7.4, locked)" - - "Static Code Analysis (7.4, locked)" - - "Tests (7.4, highest)" - - "Tests (7.4, locked)" - - "Tests (7.4, lowest)" - - "Tests (8.0, highest)" - - "Tests (8.0, locked)" - - "Tests (8.0, lowest)" - - "Tests (8.1, highest)" - - "Tests (8.1, locked)" - - "Tests (8.1, lowest)" + checks: + - context: "Code Coverage (7.4, locked)" + - context: "Coding Standards (7.4, locked)" + - context: "Dependency Analysis (7.4, locked)" + - context: "Mutation Tests (7.4, locked)" + - context: "Static Code Analysis (7.4, locked)" + - context: "Tests (7.4, highest)" + - context: "Tests (7.4, locked)" + - context: "Tests (7.4, lowest)" + - context: "Tests (8.0, highest)" + - context: "Tests (8.0, locked)" + - context: "Tests (8.0, lowest)" + - context: "Tests (8.1, highest)" + - context: "Tests (8.1, locked)" + - context: "Tests (8.1, lowest)" strict: false restrictions: @@ -79,6 +79,8 @@ repository: default_branch: "main" delete_branch_on_merge: true description: ":page_with_curl: Provides a JSON printer, allowing for flexible indentation." + enable_automated_security_fixes: true + enable_vulnerability_alerts: true has_downloads: true has_issues: true has_pages: false diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 5b52334f..5501a085 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -8,9 +8,6 @@ on: # yamllint disable-line rule:truthy branches: - "main" -env: - PHP_EXTENSIONS: "mbstring" - jobs: code-coverage: name: "Code Coverage" @@ -27,40 +24,46 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v3.0.2" - - name: "Install PHP with extensions" + - name: "Set up PHP" uses: "shivammathur/setup-php@2.21.0" with: coverage: "xdebug" - extensions: "${{ env.PHP_EXTENSIONS }}" + extensions: "none, ctype, dom, 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: "Determine composer cache directory" - uses: "./.github/actions/composer/composer/determine-cache-directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.5.1" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v3" + uses: "actions/cache@v3.0.5" 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" + uses: "ergebnis/.github/actions/composer/install@1.5.1" 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: "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=test/Unit/phpunit.xml --coverage-clover=.build/phpunit/logs/clover.xml" + + - name: "Send code coverage report to codecov.io" + uses: "codecov/codecov-action@v3.1.0" + with: + files: ".build/phpunit/logs/clover.xml" + token: "${{ secrets.CODECOV_TOKEN }}" coding-standards: name: "Coding Standards" @@ -77,55 +80,58 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v3.0.2" - name: "Lint YAML files" - uses: "ibiqlik/action-yamllint@v3" + uses: "ibiqlik/action-yamllint@v3.1" with: config_file: ".yamllint.yaml" file_or_dir: "." strict: true - - name: "Install PHP with extensions" + - name: "Set up PHP" uses: "shivammathur/setup-php@2.21.0" with: coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" + extensions: "none, ctype, dom, 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: "Validate composer.json and composer.lock" - run: "composer validate --strict" + run: "composer validate --ansi --strict" - name: "Determine composer cache directory" - uses: "./.github/actions/composer/composer/determine-cache-directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.5.1" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v3" + uses: "actions/cache@v3.0.5" 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" + uses: "ergebnis/.github/actions/composer/install@1.5.1" with: dependencies: "${{ matrix.dependencies }}" - name: "Run ergebnis/composer-normalize" - run: ".phive/composer-normalize --dry-run" + run: ".phive/composer-normalize --ansi --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@v3" + uses: "actions/cache@v3.0.5" 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" + run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --dry-run --verbose" dependency-analysis: name: "Dependency Analysis" @@ -142,27 +148,30 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v3.0.2" - - name: "Install PHP with extensions" + - name: "Set up PHP" uses: "shivammathur/setup-php@2.21.0" with: coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" + extensions: "none, ctype, dom, 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: "Determine composer cache directory" - uses: "./.github/actions/composer/composer/determine-cache-directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.5.1" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v3" + uses: "actions/cache@v3.0.5" 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" + uses: "ergebnis/.github/actions/composer/install@1.5.1" with: dependencies: "${{ matrix.dependencies }}" @@ -184,32 +193,37 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v3.0.2" - - name: "Install PHP with extensions" + - name: "Set up PHP" uses: "shivammathur/setup-php@2.21.0" with: coverage: "xdebug" - extensions: "${{ env.PHP_EXTENSIONS }}" + extensions: "none, ctype, dom, 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: "Determine composer cache directory" - uses: "./.github/actions/composer/composer/determine-cache-directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.5.1" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v3" + uses: "actions/cache@v3.0.5" 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" + uses: "ergebnis/.github/actions/composer/install@1.5.1" with: dependencies: "${{ matrix.dependencies }}" - name: "Run mutation tests with Xdebug and infection/infection" - run: "vendor/bin/infection --configuration=infection.json" + env: + XDEBUG_MODE: "coverage" + run: "vendor/bin/infection --ansi --configuration=infection.json --logger-github" static-code-analysis: name: "Static Code Analysis" @@ -226,27 +240,30 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v3.0.2" - - name: "Install PHP with extensions" + - name: "Set up PHP" uses: "shivammathur/setup-php@2.21.0" with: coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" + extensions: "none, ctype, curl, dom, json, mbstring, 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: "Determine composer cache directory" - uses: "./.github/actions/composer/composer/determine-cache-directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.5.1" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v3" + uses: "actions/cache@v3.0.5" 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" + uses: "ergebnis/.github/actions/composer/install@1.5.1" with: dependencies: "${{ matrix.dependencies }}" @@ -254,7 +271,7 @@ jobs: run: "mkdir -p .build/psalm" - name: "Run vimeo/psalm" - run: "vendor/bin/psalm --config=psalm.xml --diff --shepherd --show-info=false --stats --threads=4" + run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4" tests: name: "Tests" @@ -275,32 +292,35 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v3.0.2" - - name: "Install PHP with extensions" + - name: "Set up PHP" uses: "shivammathur/setup-php@2.21.0" with: coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" + extensions: "none, ctype, dom, 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: "Determine composer cache directory" - uses: "./.github/actions/composer/composer/determine-cache-directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.5.1" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v3" + uses: "actions/cache@v3.0.5" 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" + uses: "ergebnis/.github/actions/composer/install@1.5.1" with: dependencies: "${{ matrix.dependencies }}" - name: "Run unit tests with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml" + run: "vendor/bin/phpunit --colors=always --configuration=test/Unit/phpunit.xml" diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 71189d71..4b6fac90 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -25,69 +25,23 @@ jobs: steps: - name: "Request review from @ergebnis-bot" - uses: "actions/github-script@v6" + uses: "ergebnis/.github/actions/github/pull-request/request-review@1.5.1" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - script: | - const pullRequest = context.payload.workflow_run.pull_requests[0] - const repository = context.repo - - const reviewers = [ - "ergebnis-bot", - ] - - await github.rest.pulls.requestReviewers({ - owner: repository.owner, - repo: repository.repo, - pull_number: pullRequest.number, - reviewers: reviewers, - }) + reviewer: "ergebnis-bot" - name: "Assign @ergebnis-bot" - uses: "actions/github-script@v6" + uses: "ergebnis/.github/actions/github/pull-request/add-assignee@1.5.1" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - script: | - const pullRequest = context.payload.workflow_run.pull_requests[0] - const repository = context.repo - - const assignees = [ - "ergebnis-bot", - ] - - await github.rest.issues.addAssignees({ - owner: repository.owner, - repo: repository.repo, - assignees: assignees, - issue_number: pullRequest.number - }) + assignee: "ergebnis-bot" - name: "Approve pull request" - uses: "actions/github-script@v6" + uses: "ergebnis/.github/actions/github/pull-request/approve@1.5.1" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - script: | - const pullRequest = context.payload.workflow_run.pull_requests[0] - const repository = context.repo - - await github.rest.pulls.createReview({ - event: "APPROVE", - owner: repository.owner, - repo: repository.repo, - pull_number: pullRequest.number, - }) - name: "Merge pull request" - uses: "actions/github-script@v6" + uses: "ergebnis/.github/actions/github/pull-request/merge@1.5.1" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - script: | - const pullRequest = context.payload.workflow_run.pull_requests[0] - const repository = context.repo - - await github.rest.pulls.merge({ - merge_method: "merge", - owner: repository.owner, - pull_number: pullRequest.number, - repo: repository.repo, - }) diff --git a/.github/workflows/prune.yaml b/.github/workflows/prune.yaml index 695ab34a..402d4656 100644 --- a/.github/workflows/prune.yaml +++ b/.github/workflows/prune.yaml @@ -18,7 +18,7 @@ jobs: steps: - name: "Prune issues and pull requests" - uses: "actions/stale@v5" + uses: "actions/stale@v5.1.0" with: days-before-close: "${{ env.DAYS_BEFORE_CLOSE }}" days-before-stale: "${{ env.DAYS_BEFORE_STALE }}" diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 11ff85ac..87f7977c 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,16 +14,7 @@ jobs: runs-on: "ubuntu-latest" steps: - - name: "Determine tag" - id: "determine-tag" - run: "echo \"::set-output name=tag::${GITHUB_REF#refs/tags/}\"" - - name: "Create release" - uses: "actions/create-release@v1.1.4" - env: - GITHUB_TOKEN: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" + uses: "ergebnis/.github/actions/github/release/create@1.5.1" 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/.github/workflows/renew.yaml b/.github/workflows/renew.yaml index 0417258a..b2430cc9 100644 --- a/.github/workflows/renew.yaml +++ b/.github/workflows/renew.yaml @@ -6,9 +6,6 @@ on: # yamllint disable-line rule:truthy schedule: - cron: "0 0 1 1 *" -env: - PHP_EXTENSIONS: "mbstring" - jobs: license: name: "License" @@ -25,32 +22,35 @@ jobs: steps: - name: "Checkout" - uses: "actions/checkout@v3" + uses: "actions/checkout@v3.0.2" with: token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - - name: "Install PHP with extensions" + - name: "Set up PHP" uses: "shivammathur/setup-php@2.21.0" with: coverage: "none" - extensions: "${{ env.PHP_EXTENSIONS }}" + extensions: "none, ctype, dom, 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: "Validate composer.json and composer.lock" - run: "composer validate --strict" + run: "composer validate --ansi --strict" - name: "Determine composer cache directory" - uses: "./.github/actions/composer/composer/determine-cache-directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.5.1" - name: "Cache dependencies installed with composer" - uses: "actions/cache@v3" + uses: "actions/cache@v3.0.5" 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" + uses: "ergebnis/.github/actions/composer/install@1.5.1" with: dependencies: "${{ matrix.dependencies }}" @@ -58,14 +58,14 @@ jobs: run: "mkdir -p .build/php-cs-fixer" - name: "Cache cache directory for friendsofphp/php-cs-fixer" - uses: "actions/cache@v3" + uses: "actions/cache@v3.0.5" 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 --verbose" + run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --verbose" - name: "Commit modified files" uses: "stefanzweifel/git-auto-commit-action@v4.14.1" diff --git a/.github/workflows/triage.yaml b/.github/workflows/triage.yaml index 17fdf978..59fa6c40 100644 --- a/.github/workflows/triage.yaml +++ b/.github/workflows/triage.yaml @@ -15,31 +15,6 @@ jobs: steps: - name: "Add labels based on branch name" - uses: "actions/github-script@v6" + uses: "ergebnis/.github/actions/github/pull-request/add-label-based-on-branch-name@1.5.1" with: github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - script: | - const branchPrefixLabels = { - feature: "enhancement", - fix: "bug", - } - - const pullRequest = context.payload.pull_request - const repository = context.repo - - const branchName = pullRequest.head.ref - - const matches = branchName.match(new RegExp('^([^/]+)\/')); - - if (matches instanceof Array && branchPrefixLabels.hasOwnProperty(matches[1])) { - const label = branchPrefixLabels[matches[1]] - - github.rest.issues.addLabels({ - issue_number: pullRequest.number, - labels: [ - label - ], - owner: repository.owner, - repo: repository.repo, - }); - }