Skip to content

Commit

Permalink
Fix an issue where composer/composer was missing
Browse files Browse the repository at this point in the history
With a previous version adding composer ^2.0 support
the dependency on composer/composer was moved into dev requirement, but this requirement is needed to run
the console command itself.

Also added a new workflow to validate the integrity of the
outcoming .phar file.

Signed-off-by: Andreas Frömer <andreas.froemer@check24.de>
  • Loading branch information
Andreas Frömer authored and icanhazstring committed May 21, 2020
1 parent eafd0b0 commit 6b6758f
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- master

jobs:
run:
validate-code:
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -32,5 +32,9 @@ jobs:
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-suggest

- name: check
- name: Code check
run: composer check

- name: Check unused dependencies
run: bin/composer-unused

36 changes: 36 additions & 0 deletions .github/workflows/validate-phar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PHP Composer

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
validate-phar:
runs-on: ubuntu-latest
name: Validate phar package
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
tools: composer
ini-values: phar.readonly=false

- name: Composer install
run: composer install --no-dev --prefer-dist

- name: Download humbug/box
run: curl -OL https://github.com/humbug/box/releases/download/3.8.3/box.phar > box.phar

- name: Compile phar
run: php box.phar compile

- name: Run phar against code
run: php build/composer-unused.phar
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [Unreleased]
### Added
- Added workflow to verify integrity of build `phar` file
- Added self unused dependency check using `bin/composer-unused`
### Changed
- Readded `composer/composer` into root requirements as its required to run `bin/composer-unused`

## [0.7.2] - 2020-05-19
### Added
- Added `phpspec/prophecy-phpunit` to remove deprecations warnings of `prophecy()` with `phpunit/phpunit:^9.0`
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
"php": ">=7.3",
"ext-json": "*",
"composer-plugin-api": "^1.1 || ^2.0",
"composer/composer": "^1.1 || ^2.0@dev",
"nikic/php-parser": "^4.2",
"psr/container": "^1.0",
"psr/log": "^1.1",
"symfony/finder": "^4.2 || ^5.0"
},
"require-dev": {
"ext-zend-opcache": "*",
"composer/composer": "^1.0 || ^2.0@dev",
"jangregor/phpstan-prophecy": "^0.6.2",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/phpstan": "^0.12.14",
Expand Down
1 change: 1 addition & 0 deletions src/Command/UnusedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ protected function configure(): void
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->io = ($this->symfonyStyleFactory)($input, $output);
/** @var Composer|null $composer */
$composer = $this->getComposer();

if ($composer === null) {
Expand Down

0 comments on commit 6b6758f

Please sign in to comment.