This repository has been archived by the owner on Dec 3, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ECS] Add ecs.phar
- Loading branch information
Showing
51 changed files
with
758 additions
and
114 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,7 +73,6 @@ jobs: | |
name: Run | ||
run: composer rector | ||
|
||
|
||
binary_files: | ||
runs-on: ubuntu-latest | ||
|
||
|
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,83 @@ | ||
name: Prefixed ECS Deploy | ||
|
||
on: | ||
pull_request: null | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
ecs_phar_compile: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- | ||
name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- | ||
name: Setup PHP | ||
uses: shivammathur/setup-php@v1 | ||
with: | ||
php-version: 7.2 | ||
coverage: none | ||
|
||
- | ||
name: Install | ||
run: | | ||
# install | ||
cd packages/EasyCodingStandard/compiler | ||
composer install | ||
- | ||
name: Compile ecs.phar with Box and PHP Scoper | ||
run: | | ||
# compile | ||
cd packages/EasyCodingStandard/compiler | ||
bin/compile | ||
- | ||
name: Run ecs.phar | ||
run: | | ||
# remove local vendor, to prevent duplicated content | ||
rm -rf packages/EasyCodingStandard/vendor | ||
cd packages/EasyCodingStandard | ||
tmp/ecs.phar | ||
- | ||
name: Run ecs.phar with PSR-12 set | ||
run: | | ||
cd packages/EasyCodingStandard | ||
# create dummy file | ||
echo "<?php echo 'hi';" >> someFile.php | ||
tmp/ecs.phar check someFile.php --set dead-code | ||
# Deploy PHAR to https://github.com/Symplify/EasyCodingStandardPrefixed | ||
- | ||
name: Publish ecs.phar to Symplify/EasyCodingStandardPrefixed | ||
run: | | ||
cd packages/EasyCodingStandard | ||
# reuse tmp/ecs.phar from previous job | ||
git clone https://${ACCESS_TOKEN}@github.com/Symplify/EasyCodingStandardPrefixed.git > /dev/null 2>&1 | ||
# copy phar files inside cloned repository | ||
cp tmp/ecs.phar EasyCodingStandardPrefixed/ecs.phar | ||
cp tmp/ecs.phar EasyCodingStandardPrefixed/ecs | ||
# go to clone repository | ||
cd EasyCodingStandardPrefixed | ||
git config user.email "[email protected]" | ||
git config user.name "Github Actions" | ||
git add ecs ecs.phar | ||
# commit with new tag, if this commit is tagged, or with normal commit | ||
if [ "${TRAVIS_TAG}" != "" ]; then COMMIT_MSG="ECS ${TRAVIS_TAG}"; else COMMIT_MSG="Updated ECS to commit ${TRAVIS_COMMIT}"; fi | ||
git commit -m "${COMMIT_MSG}" | ||
git push --quiet origin master | ||
# push tag, if this commit is tagged, or with normal push | ||
if [ "${TRAVIS_TAG}" != "" ]; then git tag "${TRAVIS_TAG}" && git push --quiet origin ${TRAVIS_TAG}; fi | ||
env: | ||
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} |
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
Empty file.
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
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,3 @@ | ||
/temp | ||
!/temp/.gitkeep | ||
/vendor |
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,29 @@ | ||
# PHAR Compiler for EasyCodingStandard | ||
|
||
## Compile the PHAR | ||
|
||
```bash | ||
composer install | ||
bin/compile | ||
``` | ||
|
||
The compiled PHAR will be in `tmp/ecs.phar`. Test it: | ||
|
||
```bash | ||
php ../tmp/ecs.phar | ||
``` | ||
|
||
Please note that running the compiler will change the contents of `composer.json` file and `vendor` directory. Revert those changes after running it. | ||
|
||
## Notes | ||
|
||
This section si needed in `composer.json`, because it was causing autolaoding bugs. | ||
Box aliases existing Symfony stubs to php, see https://ayesh.me/composer-replace-polyfills. | ||
|
||
```json | ||
{ | ||
"replace": { | ||
"symfony/polyfill-php70": "*" | ||
} | ||
} | ||
``` |
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,23 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
declare(strict_types = 1); | ||
|
||
use Symplify\EasyCodingStandard\Compiler\Console\CompileCommand; | ||
use Symplify\EasyCodingStandard\Compiler\Process\CompileProcessFactory; | ||
use Symfony\Component\Console\Application; | ||
|
||
// use EasyCodingStandard package autoload.php | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$compileCommand = new CompileCommand( | ||
new CompileProcessFactory(), | ||
__DIR__ . '/../build', | ||
__DIR__ . '/../..' | ||
); | ||
|
||
/** @var Application $application */ | ||
$application = new Application(); | ||
$application->add($compileCommand); | ||
$application->setDefaultCommand($compileCommand->getName(), true); | ||
$application->run(); |
Oops, something went wrong.