Skip to content

Commit

Permalink
Simplify workflow (bamarni#101)
Browse files Browse the repository at this point in the history
With the introducing of end-to-end tests, I do not feel it is needed anymore to use the plugin on itself for PHPUnit. Since using the plugin on itself actually comes with a non-negligible cost:

- the CI is a bit more complex
- when developing on the project you need to install the plugin globally (not ideal)
  • Loading branch information
theofidry committed Jul 8, 2022
1 parent 6788f23 commit 6512428
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 44 deletions.
29 changes: 0 additions & 29 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,24 +31,11 @@ jobs:
php-version: "${{ matrix.php }}"
tools: "composer"

- name: "Configure global composer"
run: |
composer global config repositories.bin path $PWD
composer global config allow-plugins.bamarni/composer-bin-plugin true
# It is not used in the CI and the PHP constraints may not match
# the CI.
- name: "Remove PHP-CS-Fixer"
run: composer remove --dev --no-update php-cs-fixer/shim

- name: "Install bin plugin globally (PR-only)"
if: github.event_name == 'pull_request'
run: composer global require bamarni/composer-bin-plugin:dev-${GITHUB_SHA}

- name: "Install bin plugin globally (master-only)"
if: github.event_name != 'pull_request'
run: composer global require bamarni/composer-bin-plugin:dev-master

- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
Expand Down Expand Up @@ -79,35 +66,19 @@ jobs:
php-version: "${{ matrix.php }}"
tools: "composer"

- name: "Configure global composer"
run: |
composer global config repositories.bin path $PWD
composer global config allow-plugins.bamarni/composer-bin-plugin true
# It is not used in the CI and the PHP constraints may not match
# the CI.
- name: "Remove PHP-CS-Fixer"
run: composer remove --dev --no-update php-cs-fixer/shim

- name: "Install bin plugin globally (PR-only)"
if: github.event_name == 'pull_request'
run: composer global require bamarni/composer-bin-plugin:dev-${GITHUB_SHA}

- name: "Correct bin plugin version for e2e scenarios (PR-only)"
if: github.event_name == 'pull_request'
run: find e2e -maxdepth 1 -mindepth 1 -type d -exec bash -c "cd {} && composer require --dev bamarni/composer-bin-plugin:dev-${GITHUB_SHA} --no-update" \;

- name: "Install bin plugin globally (master-only)"
if: github.event_name != 'pull_request'
run: composer global require bamarni/composer-bin-plugin:dev-master

- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
with:
dependency-versions: "highest"

- name: "Validate composer.json"
run: "composer validate --strict --no-check-lock"

- name: "Run tests"
run: "vendor/bin/phpunit --group e2e"
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ vendor-bin/**/composer.lock binary
Before getting started, you need to install the plugin globally:

```bash
$ composer global require --dev bamarni/composer-bin-plugin
$ composer install # now works
$ composer install
$ vendor/bin/phpunit # run the tests
$ vendor/bin/php-cs-fixer # run PHP-CS-Fixer
```


Expand Down
9 changes: 1 addition & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"composer/composer": "^2.0",
"php-cs-fixer/shim": "^3.8",
"phpstan/extension-installer": "^1.1",
"phpunit/phpunit": "^8.5 || ^9.5",
"symfony/console": "^5.4.7 || ^6.0.7",
"symfony/finder": "^5.4.7 || ^6.0.7",
"symfony/process": "^5.4.7 || ^6.0.7"
Expand All @@ -42,13 +43,5 @@
"psr-4": {
"Bamarni\\Composer\\Bin\\Tests\\": "tests"
}
},
"scripts": {
"post-install-cmd": [
"@composer bin phpunit install"
],
"post-update-cmd": [
"@post-install-cmd"
]
}
}
5 changes: 0 additions & 5 deletions vendor-bin/phpunit/composer.json

This file was deleted.

0 comments on commit 6512428

Please sign in to comment.