Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buggy version from composer-unused being pulled on GHA. #668

Closed
2 of 5 tasks
yourwebmaker opened this issue Nov 30, 2022 · 2 comments
Closed
2 of 5 tasks

Buggy version from composer-unused being pulled on GHA. #668

yourwebmaker opened this issue Nov 30, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@yourwebmaker
Copy link

Describe the bug
When running composer-unused I'm getting the following error:

PHP Fatal error:  Uncaught Error: Class "Symfony\Component\PropertyAccess\PropertyAccess" not found in /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:328
Stack trace:
#0 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/symfony/serializer/Serializer.php(227): Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->denormalize()
#1 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/symfony/serializer/Serializer.php(145): Symfony\Component\Serializer\Serializer->denormalize()
#2 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/icanhazstring/composer-unused/src/Composer/ConfigFactory.php(36): Symfony\Component\Serializer\Serializer->deserialize()
#3 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/icanhazstring/composer-unused/src/Console/Command/UnusedCommand.php(136): ComposerUnused\ComposerUnused\Composer\ConfigFactory->fromPath()
#4 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/symfony/console/Command/Command.php(312): ComposerUnused\ComposerUnused\Console\Command\UnusedCommand->execute()
#5 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/symfony/console/Application.php([10](https://github.com/AffilyAds/lead-magnet/actions/runs/3587516347/jobs/6037950478#step:12:11)20): Symfony\Component\Console\Command\Command->run()
#6 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/symfony/console/Application.php(312): Symfony\Component\Console\Application->doRunCommand()
#7 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/symfony/console/Application.php(168): Symfony\Component\Console\Application->doRun()
#8 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/icanhazstring/composer-unused/bin/composer-unused(45): Symfony\Component\Console\Application->run()
#9 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/icanhazstring/composer-unused/bin/composer-unused(46): {closure}()
#10 /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c15c55f0ee9/vendor/bin/composer-unused(120): include('...')
#[11](https://github.com/AffilyAds/lead-magnet/actions/runs/3587516347/jobs/6037950478#step:12:12) {main}
  thrown in /home/runner/.composer/vendor/bin/_tools/composer-unused-8242d0c9b008ccec92acbc44d7fb8322623222f88964aae2fbff2c[15](https://github.com/AffilyAds/lead-magnet/actions/runs/3587516347/jobs/6037950478#step:12:16)c55f0ee9/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php on line 328

The error only happens on my GH action (code from the yaml bellow), running the composer-unsed.phar standalone locally works fine.

I've tried to use the same version as the one I'm using locally in my project by doing a tools: composer:v2, composer-normalize, composer-require-checker, composer-unused:0.8.4 but no success so far.

I belive the action is pulling an outdated/buggy version from composer-unused or cached version.

Version

  • I have checked releases, and the bug exists in the latest patch version of v1 or v2.
  • v2
  • v1

Runners

  • GitHub Hosted
  • Self Hosted

Operating systems
ubuntu-latest

PHP versions
8.1

To Reproduce

name: "Lint composer.json"

on:
  push:

jobs:
  coding-standards:
    name: "Lint composer.json"

    runs-on: ${{ matrix.operating-system }}

    strategy:
      matrix:
        dependencies:
          - "highest"
        php-version:
          - "8.1"
        operating-system:
          - "ubuntu-latest"

    steps:
      - name: "Checkout"
        uses: "actions/checkout@v3"

      - name: "Install PHP"
        uses: "shivammathur/setup-php@v2"
        with:
          coverage: "none"
          php-version: "${{ matrix.php-version }}"
          ini-values: memory_limit=-1
          tools: composer:v2, composer-normalize, composer-require-checker, composer-unused

      - name: Get composer cache directory
        id: composer-cache
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"

      - name: "Cache dependencies"
        uses: "actions/cache@v3.0.11"
        with:
          path: ${{ steps.composer-cache.outputs.dir }}
          key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }}"
          restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-"

      - name: "Install lowest dependencies"
        if: ${{ matrix.dependencies == 'lowest' }}
        run: "composer update --prefer-lowest --no-interaction --no-progress"

      - name: "Install highest dependencies"
        if: ${{ matrix.dependencies == 'highest' }}
        run: "composer update --no-interaction --no-progress"

      - name: "Install locked dependencies"
        if: ${{ matrix.dependencies == 'locked' }}
        run: "composer install --no-interaction --no-progress"

      - name: "Validate composer.json"
        run: "composer validate --strict"

      - name: "Normalize composer.json"
        run: "composer-normalize --dry-run"

      - name: "Check composer.json explicit dependencies"
        run: "composer-require-checker check"

      - name: "Check composer.json unused dependencies"
        run: "composer-unused"

Expected behavior

  • composer-unused should run

Screenshots/Logs
Screenshot 2022-11-30 at 19 22 28

@yourwebmaker yourwebmaker added the bug Something isn't working label Nov 30, 2022
@shivammathur
Copy link
Owner

Fixed in 51f83e0, will be in next release

@shivammathur shivammathur added the awaiting-release Added/Fixed and tested, awaiting release label Dec 11, 2022
@shivammathur shivammathur removed the awaiting-release Added/Fixed and tested, awaiting release label Dec 25, 2022
@shivammathur
Copy link
Owner

Released 2.23.0 with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants