generated from ergebnis/php-package-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement: Build phpunit-slow-test-detector.phar
- Loading branch information
1 parent
8a5bca1
commit 4d51a61
Showing
18 changed files
with
2,605 additions
and
2,235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,6 +138,76 @@ jobs: | |
- name: "Run friendsofphp/php-cs-fixer" | ||
run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --dry-run --verbose" | ||
|
||
compile-phar: | ||
name: "Compile Phar" | ||
|
||
runs-on: "ubuntu-latest" | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "8.1" | ||
|
||
dependencies: | ||
- "locked" | ||
|
||
env: | ||
PHPUNIT_SLOW_TEST_DETECTOR_PHAR: ".build/phar/phpunit-slow-test-detector.phar" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Set up PHP" | ||
uses: "shivammathur/[email protected]" | ||
with: | ||
coverage: "none" | ||
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" | ||
ini-values: "memory_limit=-1, phar.readonly=0" | ||
php-version: "${{ matrix.php-version }}" | ||
tools: "phive" | ||
|
||
- name: "Set up problem matchers for PHP" | ||
run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" | ||
|
||
- name: "Determine composer cache directory" | ||
uses: "ergebnis/.github/actions/composer/[email protected]" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/[email protected]" | ||
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/[email protected]" | ||
with: | ||
dependencies: "${{ matrix.dependencies }}" | ||
|
||
- name: "Remove phpunit/phpunit" | ||
run: "composer remove phpunit/phpunit --ansi --no-interaction --no-progress" | ||
|
||
- name: "Remove git placeholder configuration with jq" | ||
run: "echo $(cat box.json | jq 'del(.git)') > box.json" | ||
|
||
- name: "Install dependencies with phive" | ||
uses: "ergebnis/.github/actions/phive/[email protected]" | ||
with: | ||
trust-gpg-keys: "0x2DF45277AEF09A2F,0x033E5F8D801A2F8D,0x4AA394086372C20A" | ||
|
||
- name: "Validate configuration for humbug/box" | ||
run: ".phive/box validate box.json --ansi" | ||
|
||
- name: "Compile phpunit-slow-test-detector.phar with humbug/box" | ||
run: ".phive/box compile --ansi --config=box.json" | ||
|
||
- name: "Show info about phpunit-slow-test-detector.phar with humbug/box" | ||
run: ".phive/box info ${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR }} --ansi" | ||
|
||
- name: "Run phar tests with phpunit/phpunit" | ||
run: ".phive/phpunit --colors=always --configuration=test/Phar/phpunit.xml" | ||
|
||
dependency-analysis: | ||
name: "Dependency Analysis" | ||
|
||
|
@@ -187,7 +257,7 @@ jobs: | |
- name: "Install dependencies with phive" | ||
uses: "ergebnis/.github/actions/phive/[email protected]" | ||
with: | ||
trust-gpg-keys: "0x033E5F8D801A2F8D" | ||
trust-gpg-keys: "0x2DF45277AEF09A2F,0x033E5F8D801A2F8D,0x4AA394086372C20A" | ||
|
||
- name: "Run maglnet/composer-require-checker" | ||
run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,119 @@ jobs: | |
|
||
runs-on: "ubuntu-latest" | ||
|
||
strategy: | ||
matrix: | ||
php-version: | ||
- "8.1" | ||
|
||
dependencies: | ||
- "locked" | ||
|
||
env: | ||
GPG_KEYS: ".build/phar/keys.asc" | ||
GPG_KEYS_ENCRYPTED: "phar/keys.asc.gpg" | ||
PHPUNIT_SLOW_TEST_DETECTOR_PHAR: ".build/phar/phpunit-slow-test-detector.phar" | ||
PHPUNIT_SLOW_TEST_DETECTOR_PHAR_SIGNATURE: ".build/phar/phpunit-slow-test-detector.phar.asc" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/[email protected]" | ||
|
||
- name: "Set up PHP" | ||
uses: "shivammathur/[email protected]" | ||
with: | ||
coverage: "none" | ||
extensions: "none, ctype, curl, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" | ||
php-version: "${{ matrix.php-version }}" | ||
tools: "phive" | ||
|
||
- name: "Determine composer cache directory" | ||
uses: "ergebnis/.github/actions/composer/[email protected]" | ||
|
||
- name: "Cache dependencies installed with composer" | ||
uses: "actions/[email protected]" | ||
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/[email protected]" | ||
with: | ||
dependencies: "${{ matrix.dependencies }}" | ||
|
||
- name: "Remove phpunit/phpunit" | ||
run: "composer remove phpiunit/phpunit --ansi --no-interaction --no-progress" | ||
|
||
- name: "Install dependencies with phive" | ||
uses: "ergebnis/.github/actions/phive/[email protected]" | ||
with: | ||
trust-gpg-keys: "0x2DF45277AEF09A2F,0x033E5F8D801A2F8D,0x4AA394086372C20A" | ||
|
||
- name: "Validate configuration for humbug/box" | ||
run: ".phive/box validate box.json --ansi" | ||
|
||
- name: "Compile phpunit-slow-test-detector.phar with humbug/box" | ||
run: ".phive/box compile --ansi --config=box.json" | ||
|
||
- name: "Show info about phpunit-slow-test-detector.phar with humbug/box" | ||
run: ".phive/box info ${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR }} --ansi" | ||
|
||
- name: "Run phar tests with phpunit/phpunit" | ||
run: ".phive/phpunit --colors=always --configuration=test/Phar/phpunit.xml" | ||
|
||
- name: "Show gpg version" | ||
run: "gpg --version" | ||
|
||
- name: "Decrypt keys.asc.gpg with gpg" | ||
run: "gpg --batch --output ${{ env.GPG_KEYS }} --passphrase \"${{ secrets.GPG_DECRYPT_PASSPHRASE }}\" --yes --decrypt ${{ env.GPG_KEYS_ENCRYPTED }}" | ||
|
||
- name: "Import keys from keys.asc with gpg" | ||
run: "gpg --batch --import ${{ env.GPG_KEYS }}" | ||
|
||
- name: "Sign phpunit-slow-test-detector.phar with gpg" | ||
run: "gpg --armor --local-user \"${{ secrets.GPG_LOCAL_USER }}\" --output ${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR_SIGNATURE }} --passphrase \"${{ secrets.GPG_KEY_PASSPHRASE }}\" --pinentry-mode loopback --yes --detach-sig ${{ env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR }}" | ||
|
||
- name: "Remove decrypted keys.asc" | ||
run: "rm ${{ env.GPG_KEYS }}" | ||
|
||
- name: "Determine tag" | ||
run: "echo \"RELEASE_TAG=${GITHUB_REF#refs/tags/}\" >> $GITHUB_ENV" | ||
|
||
- name: "Create release" | ||
uses: "ergebnis/.github/actions/github/release/[email protected]" | ||
with: | ||
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" | ||
|
||
- name: "Upload release assets" | ||
uses: "actions/[email protected]" | ||
with: | ||
github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" | ||
script: | | ||
const fs = require("fs"); | ||
const files = [ | ||
{ | ||
name: "phpunit-slow-test-detector.phar", | ||
path: process.env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR, | ||
}, | ||
{ | ||
name: "phpunit-slow-test-detector.phar.asc", | ||
path: process.env.PHPUNIT_SLOW_TEST_DETECTOR_PHAR_SIGNATURE, | ||
}, | ||
]; | ||
for (const file of files) { | ||
try { | ||
await github.rest.repos.uploadReleaseAsset({ | ||
data: fs.readFileSync(file.path), | ||
name: file.name, | ||
origin: process.env.RELEASE_UPLOAD_URL, | ||
owner: context.repo.owner, | ||
release_id: process.env.RELEASE_ID, | ||
repo: context.repo.repo, | ||
}); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phive xmlns="https://phar.io/phive"> | ||
<phar name="humbug/box" version="^4.3.8" installed="4.3.8" location="./.phive/box" copy="false"/> | ||
<phar name="composer-require-checker" version="^4.5.0" installed="4.5.0" location="./.phive/composer-require-checker" copy="false"/> | ||
<phar name="phpunit" version="^10.1.3" installed="10.1.3" location="./.phive/phpunit" copy="false"/> | ||
</phive> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/humbug/box/4.3.8/res/schema.json", | ||
"compactors": [ | ||
"KevinGH\\Box\\Compactor\\Json", | ||
"KevinGH\\Box\\Compactor\\Php" | ||
], | ||
"compression": "GZ", | ||
"files": [ | ||
"manifest.xml" | ||
], | ||
"git": "git", | ||
"main": "phar/phpunit-slow-test-detector.php", | ||
"output": ".build/phar/phpunit-slow-test-detector.phar" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,3 @@ | ||
{ | ||
"symbol-whitelist": [ | ||
"PHPUnit\\Event\\Code\\Test", | ||
"PHPUnit\\Event\\Telemetry\\Duration", | ||
"PHPUnit\\Event\\Telemetry\\HRTime", | ||
"PHPUnit\\Event\\Test\\Passed", | ||
"PHPUnit\\Event\\Test\\PassedSubscriber", | ||
"PHPUnit\\Event\\Test\\Prepared", | ||
"PHPUnit\\Event\\Test\\PreparedSubscriber", | ||
"PHPUnit\\Event\\TestRunner\\ExecutionFinished", | ||
"PHPUnit\\Event\\TestRunner\\ExecutionFinishedSubscriber", | ||
"PHPUnit\\Metadata\\Annotation\\Parser\\Registry", | ||
"PHPUnit\\Runner\\Extension\\Extension", | ||
"PHPUnit\\Runner\\Extension\\Facade", | ||
"PHPUnit\\Runner\\Extension\\ParameterCollection", | ||
"PHPUnit\\TextUI\\Configuration\\Configuration" | ||
] | ||
"symbol-whitelist": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.