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

Extensions are not removed correctly on self-hosted runners #271

Closed
3 of 5 tasks
Jamesking56 opened this issue Aug 11, 2020 · 5 comments · Fixed by #274
Closed
3 of 5 tasks

Extensions are not removed correctly on self-hosted runners #271

Jamesking56 opened this issue Aug 11, 2020 · 5 comments · Fixed by #274
Assignees
Labels
bug Something isn't working self-hosted

Comments

@Jamesking56
Copy link

Describe the bug
When using a self-hosted runner and setting up coverage with pcov, phpunit says:

Warning:       No code coverage driver available

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 20.04 LTS

PHP versions
PHP 7.3

To Reproduce

laravel-tests:
    runs-on: [self-hosted, ubuntu-latest]
    needs: composer

    services:
      mysql:
        image: mariadb:10.2
        env:
          MYSQL_ROOT_PASSWORD: root
          MYSQL_DATABASE: social-leaderboard
        ports:
          - 3306
        options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3

    steps:
      - uses: actions/checkout@v2
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: 7.3
          coverage: pcov # enable coverage
          tools: cs2pr
        env:
          runner: self-hosted # Specify the runner.
      - name: Copy .env
        run: php -r "file_exists('.env') || copy('.env.example', '.env');"
      - name: Get composer cache directory
        id: composer-cache-directory
        run: echo "::set-output name=dir::$(composer config cache-files-dir)"
      - name: Cache composer dependencies
        id: composer-cache
        uses: actions/cache@v1
        with:
          path: |
            ${{ steps.composer-cache-directory.outputs.dir }}
            composer.lock
            vendor
          key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
          restore-keys: ${{ runner.os }}-composer-
      - name: Install Dependencies
        if: steps.composer-cache.outputs.cache-hit != 'true'
        env:
          COMPOSER_AUTH: ${{ secrets.COMPOSER_AUTH }}
        run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
      - name: Generate key
        run: php artisan key:generate
      - name: Directory Permissions
        run: chmod -R 777 storage bootstrap/cache
      - name: Run migrations
        env:
          DB_PORT: ${{ job.services.mysql.ports[3306] }}
        run: php artisan migrate --force -vvv
      - name: Execute tests (Unit and Feature tests) via PHPUnit
        env:
          DB_PORT: ${{ job.services.mysql.ports[3306] }}
        run: vendor/bin/phpunit --coverage-clover=coverage.xml
      - uses: codecov/codecov-action@v1
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true

Expected behavior
Everything passes and Codecov is sent the codecoverage file

Screenshots/Logs
image

image

Additional context
My server has PHP 5.6 -> 7.4 installed with pcov already installed.

Are you willing to submit a PR?
I'm not sure how this project works

@Jamesking56 Jamesking56 added the bug Something isn't working label Aug 11, 2020
@shivammathur
Copy link
Owner

shivammathur commented Aug 11, 2020

@Jamesking56 I'm not able to reproduce this issue.
Can you try this on a clean server with shivammathur/setup-php@verbose and without composer dependency cache.
Also add a step with php -m after setup-php step to check extensions.

@Jamesking56
Copy link
Author

Clean server a little difficult but I swapped the v2 tag for verbose and here is the output:

/usr/bin/bash /opt/actions-runner/_work/_tool/linux.sh 7.3 /opt/actions-runner/_work/_actions/shivammathur/setup-php/verbose/dist
Set disable_coredump false
Reading package lists...
Building dependency tree...
Reading state information...
make is already the newest version (4.2.1-1.2).
unzip is already the newest version (6.0-25ubuntu1).
curl is already the newest version (7.68.0-1ubuntu2.1).
software-properties-common is already the newest version (0.98.9.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

==> Setup PHP
update-alternatives: using /usr/bin/php7.3 to provide /usr/bin/php (php) in manual mode
update-alternatives: using /usr/bin/phar7.3 to provide /usr/bin/phar (phar) in manual mode
update-alternatives: using /usr/bin/phar.phar7.3 to provide /usr/bin/phar.phar (phar.phar) in manual mode

✓ PHP Switched to PHP 7.3.21

==> Setup Tools
✓ composer Added
✓ cs2pr Added

==> Setup Coverage

==> Setup Extensions
Reading package lists...
Building dependency tree...
Reading state information...
php-pcov is already the newest version (1.0.6-2+ubuntu20.04.1+deb.sury.org+1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
✗ pcov Could not install pcov on PHP 7.3.21

==> Add php.ini values
✓ pcov.enabled=1 Added to php.ini
✓ :xdebug Could not find xdebug on PHP 7.3.21
✓ coverage: pcov PCOV enabled as coverage driver

@shivammathur
Copy link
Owner

ok. Run sudo apt-get purge php-pcov -y on your server and run the workflow again.

@Jamesking56
Copy link
Author

I think I've worked this out.

Some steps disable coverage and some steps enable it, I think multiple workflow runs are running in parallel so the disabling steps are causing this testing step (which requires coverage) to fail.

I'm removed the disabling so that pcov is always enabled on my server (since the speed is negligible) and it seems to have fixed the problem.

@shivammathur
Copy link
Owner

Yes, it does not support multiple workflows in parallel on a single runner instance as they might conflict.
However removing extensions has a bug for self-hosted runners. Patch will be in next release.

@shivammathur shivammathur mentioned this issue Aug 18, 2020
@shivammathur shivammathur changed the title PCOV does not work with a self-hosted runner Extensions are not removed correctly on self-hosted runners Aug 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working self-hosted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants