scrutinizer-ci / ocular

CLI for uploading external code coverage data
https://scrutinizer-ci.com
41 stars 24 forks source link

Uploads failing since 1.8.0 release #53

Closed badams closed 3 years ago

badams commented 3 years ago

I've got multiple code coverage reports being uploaded per PR for a project (PHP and JS), this has worked well up until the last few days, where the second report is being rejected now..

In my case the php test suite is finishing first and uploading the coverage report, and then the js test suite will finish a bit later, and results in this error

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

 23 3837k   23  882k    0     0   655k      0  0:00:05  0:00:01  0:00:04  655k
 56 3837k   56 2174k    0     0   934k      0  0:00:04  0:00:02  0:00:02 1317k
 65 3837k   65 2531k    0     0   764k      0  0:00:05  0:00:03  0:00:02  839k
 73 3837k   73 2837k    0     0   660k      0  0:00:05  0:00:04  0:00:01  662k
 79 3837k   79 3058k    0     0   572k      0  0:00:06  0:00:05  0:00:01  544k
 86 3837k   86 3330k    0     0   527k      0  0:00:07  0:00:06  0:00:01  492k
 92 3837k   92 3551k    0     0   486k      0  0:00:07  0:00:07 --:--:--  277k
100 3837k  100 3837k    0     0   459k      0  0:00:08  0:00:08 --:--:--  259k
100 3837k  100 3837k    0     0   459k      0  0:00:08  0:00:08 --:--:--  246k

  [Guzzle\Common\Exception\InvalidArgumentException]  
  Invalid handle provided                             

code-coverage:upload [--api-url="..."] [--repository="..."] [--revision="..."] [--format="..."] [--parent="..."] coverage-file

Uploading code coverage for repository "g/****/*****" and revision "fe4f0e******7f947befeb3"... 
Error: Process completed with exit code 1.
schmittjoh commented 3 years ago

Thanks for this report. Are you using PHP 8 for uploading or another PHP version? Also, do you use the phar file or do you use ocular as a dependency in your project?

badams commented 3 years ago

Hi @schmittjoh,

afaik we're using PHP 7.4 (whatever defaults with ubuntu 20), but I can confirm.

Heres a copy of the github action we're running that has this issue

name: 'Frontend CI'
on:
  push:
    branches:
      - master
      - develop
      - test
      - stage
  pull_request:

jobs:
  test:
    env:
      SCRUTINIZER_ACCESS_TOKEN: ${{secrets.SCRUTINIZER_ACCESS_TOKEN}}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Install Dependencies
        run: npm install
      - name: Eslint
        run: npm run eslint
      - name: Prettier
        run: npm run prettier
      - name: Jest
        run: npm run jest -- --coverage

      - name: Upload Coverage report
        run: |
          curl -L https://scrutinizer-ci.com/ocular.phar > ./ocular.phar
          php ocular.phar code-coverage:upload --access-token="${SCRUTINIZER_ACCESS_TOKEN}" --format=clover coverage/clover.xml
badams commented 3 years ago

@schmittjoh I've finally got a chance to do some debugging, and yes - this appears to be related to php 8.

I've been able to work around this for now by forcing php7.4

schmittjoh commented 3 years ago

Thanks for the update. The ocular.phar file is not updated to the latest release of the package as it would break some older PHP versions. Have you already tried adding it as a dev dependency to your project, and uploading via vendor/bin/ocular?

badams commented 3 years ago

Thanks for the update. The ocular.phar file is not updated to the latest release of the package as it would break some older PHP versions. Have you already tried adding it as a dev dependency to your project, and uploading via vendor/bin/ocular?

@schmittjoh Yes have tried, but results in conflicts with guzzle etc, We also looked at installing it globally on the CI but that was resulting in permission issues

godbout commented 3 years ago

Thanks for the update. The ocular.phar file is not updated to the latest release of the package as it would break some older PHP versions. Have you already tried adding it as a dev dependency to your project, and uploading via vendor/bin/ocular?

worked great for me. thanks!

godbout commented 3 years ago

ah. might have spoken too fast. no issue while running the test suite anymore, but scrutinizer doesn't seem to receive/pick up the uploaded files. will investigate.

DevDavido commented 3 years ago

I had the same issue like @badams and setting it up as composer package dependency scrutinizer/ocular as mentioned by @schmittjoh fixed the issue with PHP8 for me.

badams commented 3 years ago

Thanks for the help with this @schmittjoh I've resolved our dependency conflicts so can install it via composer