scrutinizer-ci / ocular Goto Github PK
View Code? Open in Web Editor NEWCLI for uploading external code coverage data
Home Page: https://scrutinizer-ci.com
CLI for uploading external code coverage data
Home Page: https://scrutinizer-ci.com
and https://scrutinizer-ci.com/ocular.phar is down:
Resolving scrutinizer-ci.com (scrutinizer-ci.com)... 104.26.1.85, 104.26.0.85, 172.67.75.7
Connecting to scrutinizer-ci.com (scrutinizer-ci.com)|104.26.1.85|:443... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2020-10-08 23:29:41 ERROR 503: Service Unavailable.
This is a follow-up on #2.
If you have version tags people installing Ocular via Composer would not have to require the dev-master
version.
Requiring a dev-*
branch is not cool, because if the minimum-stability
flag for a package is stable
(which is the default), then a not-stable nested dependency would not be installed.
Example:
Package A have a dependency of package B. Package B requires the scrutinizer/ocular
package. When you download package A and run composer install
, Composer would give you a warning (or an error?) saying it would not install not-stable dependencies.
The change requested here #51 has not been published
Hello,
When I run my tests on the CI server I have one run that installs composer packages like this:
composer update --prefer-stable --prefer-lowest --no-interaction --prefer-source
This causes ocular to install version 2.0.4 of symfony/console, which results in this error:
PHP Fatal error: Class 'Symfony\Component\Console\Application' not found in /home/travis/build/yuloh/stream/vendor/scrutinizer/ocular/src/Scrutinizer/Ocular/Ocular.php on line 10
Version 2.0.4 of symfony/console looks like this:
https://github.com/symfony/console/tree/ce34bc50cf78ef247a1506d4894e54830fa84737
I'm pretty sure the error is because there isn't an autoload section in that version.
Here is the list of old symfony/console tags:
https://github.com/symfony/console/tags?after=v2.0.12
In 2.0.5 they added an autoload section to composer.json, so I think any version after that one will work.
https://github.com/symfony/console/blob/d7b1718424b3eed1a58f9d96b01f1590716a9365/composer.json
The phar is reported as corrupted in HHVM: https://travis-ci.org/Behat/MinkBrowserKitDriver/jobs/24218053#L122
While debugging a Guzzle request I noticed the access token appears twice in the url. It is set in line 39 and line 55:
One should probably be removed?
Is there are a reason to have no public CI (like travis)?
If not I will create a PR ;)
I'm using this in GitHub Actions like;
- name: Report results to Scrutinizer (https://scrutinizer-ci.com/g/tarlepp/symfony-flex-backend/)
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --access-token ${{ secrets.SCRUTINIZER_ACCESS_TOKEN }} --format=php-clover ./build/logs/clover.xml
And I'm getting this;
Run wget https://scrutinizer-ci.com/ocular.phar
--2021-02-04 18:34:47-- https://scrutinizer-ci.com/ocular.phar
Resolving scrutinizer-ci.com (scrutinizer-ci.com)... 172.67.75.7, 104.26.1.85, 104.26.0.85
Connecting to scrutinizer-ci.com (scrutinizer-ci.com)|172.67.75.7|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://s3-eu-west-1.amazonaws.com/scrutinizer-static/ocular.phar [following]
--2021-02-04 18:34:48-- https://s3-eu-west-1.amazonaws.com/scrutinizer-static/ocular.phar
Resolving s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)... 52.218.108.147
Connecting to s3-eu-west-1.amazonaws.com (s3-eu-west-1.amazonaws.com)|52.218.108.147|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3929473 (3.7M) [application/octet-stream]
Saving to: ‘ocular.phar’
0K .......... .......... .......... .......... .......... 1% 757K 5s
50K .......... .......... .......... .......... .......... 2% 377K 7s
100K .......... .......... .......... .......... .......... 3% 90.1M 5s
150K .......... .......... .......... .......... .......... 5% 754K 5s
200K .......... .......... .......... .......... .......... 6% 98.9M 4s
250K .......... .......... .......... .......... .......... 7% 68.4M 3s
300K .......... .......... .......... .......... .......... 9% 768K 3s
350K .......... .......... .......... .......... .......... 10% 86.0M 3s
400K .......... .......... .......... .......... .......... 11% 50.4M 3s
450K .......... .......... .......... .......... .......... 13% 104M 2s
500K .......... .......... .......... .......... .......... 14% 68.6M 2s
550K .......... .......... .......... .......... .......... 15% 123M 2s
600K .......... .......... .......... .......... .......... 16% 795K 2s
650K .......... .......... .......... .......... .......... 18% 62.7M 2s
700K .......... .......... .......... .......... .......... 19% 116M 2s
750K .......... .......... .......... .......... .......... 20% 121M 2s
800K .......... .......... .......... .......... .......... 22% 119M 1s
850K .......... .......... .......... .......... .......... 23% 99.0M 1s
900K .......... .......... .......... .......... .......... 24% 62.4M 1s
950K .......... .......... .......... .......... .......... 26% 208M 1s
1000K .......... .......... .......... .......... .......... 27% 310M 1s
1050K .......... .......... .......... .......... .......... 28% 316M 1s
1100K .......... .......... .......... .......... .......... 29% 111M 1s
1150K .......... .......... .......... .......... .......... 31% 108M 1s
1200K .......... .......... .......... .......... .......... 32% 111M 1s
1250K .......... .......... .......... .......... .......... 33% 814K 1s
1300K .......... .......... .......... .......... .......... 35% 59.2M 1s
1350K .......... .......... .......... .......... .......... 36% 68.1M 1s
1400K .......... .......... .......... .......... .......... 37% 65.2M 1s
1450K .......... .......... .......... .......... .......... 39% 69.7M 1s
1500K .......... .......... .......... .......... .......... 40% 74.4M 1s
1550K .......... .......... .......... .......... .......... 41% 73.8M 1s
1600K .......... .......... .......... .......... .......... 42% 65.7M 1s
1650K .......... .......... .......... .......... .......... 44% 68.3M 1s
1700K .......... .......... .......... .......... .......... 45% 77.8M 1s
1750K .......... .......... .......... .......... .......... 46% 74.6M 1s
1800K .......... .......... .......... .......... .......... 48% 79.0M 1s
1850K .......... .......... .......... .......... .......... 49% 88.6M 0s
1900K .......... .......... .......... .......... .......... 50% 173M 0s
1950K .......... .......... .......... .......... .......... 52% 170M 0s
2000K .......... .......... .......... .......... .......... 53% 149M 0s
2050K .......... .......... .......... .......... .......... 54% 160M 0s
2100K .......... .......... .......... .......... .......... 56% 161M 0s
2150K .......... .......... .......... .......... .......... 57% 159M 0s
2200K .......... .......... .......... .......... .......... 58% 135M 0s
2250K .......... .......... .......... .......... .......... 59% 163M 0s
2300K .......... .......... .......... .......... .......... 61% 154M 0s
2350K .......... .......... .......... .......... .......... 62% 167M 0s
2400K .......... .......... .......... .......... .......... 63% 150M 0s
2450K .......... .......... .......... .......... .......... 65% 163M 0s
2500K .......... .......... .......... .......... .......... 66% 918K 0s
2550K .......... .......... .......... .......... .......... 67% 61.1M 0s
2600K .......... .......... .......... .......... .......... 69% 66.1M 0s
2650K .......... .......... .......... .......... .......... 70% 88.8M 0s
2700K .......... .......... .......... .......... .......... 71% 156M 0s
2750K .......... .......... .......... .......... .......... 72% 144M 0s
2800K .......... .......... .......... .......... .......... 74% 144M 0s
2850K .......... .......... .......... .......... .......... 75% 146M 0s
2900K .......... .......... .......... .......... .......... 76% 149M 0s
2950K .......... .......... .......... .......... .......... 78% 138M 0s
3000K .......... .......... .......... .......... .......... 79% 147M 0s
3050K .......... .......... .......... .......... .......... 80% 157M 0s
3100K .......... .......... .......... .......... .......... 82% 164M 0s
3150K .......... .......... .......... .......... .......... 83% 158M 0s
3200K .......... .......... .......... .......... .......... 84% 136M 0s
3250K .......... .......... .......... .......... .......... 85% 175M 0s
3300K .......... .......... .......... .......... .......... 87% 190M 0s
3350K .......... .......... .......... .......... .......... 88% 183M 0s
3400K .......... .......... .......... .......... .......... 89% 165M 0s
3450K .......... .......... .......... .......... .......... 91% 188M 0s
3500K .......... .......... .......... .......... .......... 92% 188M 0s
3550K .......... .......... .......... .......... .......... 93% 185M 0s
3600K .......... .......... .......... .......... .......... 95% 172M 0s
3650K .......... .......... .......... .......... .......... 96% 162M 0s
3700K .......... .......... .......... .......... .......... 97% 159M 0s
3750K .......... .......... .......... .......... .......... 99% 167M 0s
3800K .......... .......... .......... ....... 100% 125M=0.5s
2021-02-04 18:34:49 (6.94 MB/s) - ‘ocular.phar’ saved [3929473/3929473]
Uploading code coverage for repository "g/tarlepp/symfony-flex-backend" and revision "f7a3d30252008f6edaf1d38e4c9e96dca70e6a97"...
[Guzzle\Common\Exception\InvalidArgumentException]
Invalid handle provided
code-coverage:upload [--api-url="..."] [--repository="..."] [--revision="..."] [--format="..."] [--parent="..."] coverage-file
Error: Process completed with exit code 1.
And this same worked with PHP 7.4.x and now I'm getting this after I upgraded to PHP 8.0.x - any ideas how to fix this?
We've just migrated our CI system to one that uses build artifacting. As a consequence, when we run our unit tests, we're no longer doing so within a Git repository.
Most of UploadCommand
is careful not to assume the current dir is a repository, and we can specify --repository
, --parent
and --revision
manually. However, the ->getBasePath()
call assumes one of the parents of the working directory will have a .git
directory (here: https://github.com/scrutinizer-ci/ocular/blob/master/src/Scrutinizer/Ocular/Command/CodeCoverage/UploadCommand.php#L106) and there's no way to override this strategy.
Could you establish GPG-signed releases, so that the phive.phar project could include ocular as an installable phar?
Hello, i'm new at sending data to scrutinizer-ci and github actions, but i've some automation on my actions on github, but i'm getting same erro and can't putting work. I'm always get same error:
In RepositoryIntrospector.php line 39:
Failed to retrieve commit parents. If you use a shallow git checkout, pleas
e checkout at least a depth of one.
code-coverage:upload [--api-url API-URL] [--repository REPOSITORY] [--revision REVISION] [--format FORMAT] [--parent PARENT] [--] <coverage-file>
Error: Process completed with exit code 1.
This is my action:
./vendor/bin/ocular code-coverage:upload build/logs/clover.xml --format=php-clover --repository='g/gravataLonga/container' --revision=${{ github.event.pull_request.head.sha || github.sha }}
What i'm doing wrong?
Many thank for any help, probably this isn't best place, you can remove my issue.
Best Regards,
Jonathan Fontes
See: https://packagist.org/packages/scrutinizer/ocular#dev-master
The composer.json parsed on packagist does not reflect the composer.json that is on Github.
How such things is possible ?
Steps to reproduce:
php ocular.phar --version
:ocular version 8e0a8c7f085bc4857bd52132833679dcfd504fc1
self-update
command using php ocular.phar self-update
:#!/usr/bin/env php
Updating from 8e0a8c to #!/usr.
What not right:
#!/usr/bin/env php
is shown (something wrong with phar creation process probably)#!/usr
is shown instead of new version (new version check is broken)It needs only
@schmittjoh It will be this easy: phive install ocular
Based on the source, this should return the SHA-1 (revision) of the PHAR file. Whole PHAR is downloaded instead.
ocular/src/Scrutinizer/Ocular/Command/SelfUpdateCommand.php
Lines 26 to 31 in 2c14102
ocular code-coverage:upload
fails when running tests with the lowest package requirements. This is advisable as it ensures your package continues to run with minimum required versions of dependencies.
$ php vendor/bin/ocular code-coverage:upload --format=php-clover tests/reports/clover.xml
[InvalidArgumentException]
The "access-token" option does not exist.
https://travis-ci.org/lukewaite/monolog-memory-usage-processor/jobs/325652270
access-token
via by overriding getDefaultInputOption
ocular
allows a minimum symfony/console
version of 2.0.5
.getDefaultInputOption
was not introduced until 2.1.0
, so is not executed in 2.0.5
In require-dev
, pull in a higher minimum version of symfony/console
:
"require-dev": {
"phpunit/phpunit": "^5.7",
"scrutinizer/ocular": "^1.4",
"symfony/console": "^2.1|~3.0"
}
lukewaite/monolog-memory-usage-processor@d80d5a8
https://travis-ci.org/lukewaite/monolog-memory-usage-processor/jobs/325658601
PR to follow.
Hi, can you please tag a new version with the updated SF 3.0 dependency?
Thanks.
When explicitly specifying the commit hash like so:
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload -v --format=php-clover --repository=g/$TRAVIS_REPO_SLUG --revision=$TRAVIS_COMMIT ~/builds/ss/shop/coverage.xml
The coverage links up fine for branch pushes, but never lands in Scrutinizer for pull requests. Is this a bug or is there a different syntax to use for PR's?
jms/serializer version is set to ~0.13. It will be great to update to at least 1.0.
wget https://scrutinizer-ci.com/ocular.phar
php -f ocular.phar
ocular version 8e0a8c7f085bc4857bd52132833679dcfd504fc1
8e0a8c7 is very old!
Is the built phar outdated ?
My goal was to update https://github.com/sudo-bot/action-scrutinizer
It would fix #55
On Windows, if you run the upload command and .git is not in any parent directory, you get an infinite loop: https://github.com/scrutinizer-ci/ocular/blob/master/src/Scrutinizer/Ocular/Command/CodeCoverage/UploadCommand.php#L104
$dir will eventually become the drive letter, for example: C:\
The documentation does not mention anything but it seems that ocular do not support gitlab repositories.
The current version is very old, and will be EOL soon. I can submit a PR if you're interested?
Hi,
while working on multriple coverage reports for Doctrine DBAL, I ran into problems with uploading coverage to Scrutinizer on AppVeyor. It seems to either fail executing the introspector processes or parse its CLI outputs correctly.
After simply running:
php.exe ocular.phar code-coverage:upload --format=php-clover clover.xml
I am getting the following error error:
#!/usr/bin/env php
php.exe :
At line:3 char:3
+ php.exe ocular.phar code-coverage:upload --format=php-clover clover ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
[RuntimeException]
Could not extract repository name from:
code-coverage:upload [--api-url="..."] [--repository="..."] [--revision="..."] [--format="..."] [--parent="..."] coverage-file
Command executed with exception: Could not extract repository name from:
code-coverage:upload [--api-url="..."] [--repository="..."] [--revision="..."] [--format="..."] [--parent="..."] coverage-file
I executed the commands ran by introspector separately to see if they work and they do:
git remote -v
origin https://github.com/Majkl578/doctrine-dbal.git (fetch)
origin https://github.com/Majkl578/doctrine-dbal.git (push)
git rev-parse HEAD
679ee9732663db57d7d3927770ab887fd4f11d58
git log --pretty="%P" -n1 HEAD
f28f0977ac78738bd777b05424988aa2b5e9c51c
You can find the failing build here: https://ci.appveyor.com/project/Majkl578/doctrine-dbal/build/1.0.310/job/20bkb4l3wn2uho0j#L1776
Used script is here: https://github.com/Majkl578/doctrine-dbal/blob/679ee9732663db57d7d3927770ab887fd4f11d58/.appveyor.yml#L115-L127
PR #44 added support for installing Symfony 5 components, but this project is actually NOT compatible with symfony/process
5.x. The ability to accept a string as the first parameter of the Process
constructor was deprecated in 4.2 and removed in 5.0. See the CHANGELOG for more information.
As a result, requiring version 1.7.0 of this project on newer versions of PHP leads to fatal errors like thephpleague/commonmark#410:
The platform
field is present with a php version, but this information needs to be in the requirements. The way it is at the moment, version 1.9
will get installed if you have php5.6 and require ^1.7
in your project.
Related to #59
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.
Uploading code coverage with your tool no longer works.
Here's the output from a failed build:
$ php ocular.phar code-coverage:upload --format=php-clover test/build/clover.xml
Uploading code coverage for repository "g/mindplay-dk/sql" and revision "ab4325ea8e0aaa84c39c7c4fa990ab6dd0220bc5"...
[Guzzle\Common\Exception\InvalidArgumentException]
Invalid handle provided
I recently switched to PHP 8, so maybe your tool needs an upgrade to support that?
➜ ocular (master) ✗ git config --global user.email
[email protected]
➜ ocular (master) ✗ phpunit
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from /Users/ayoub/Projects/ocular/phpunit.xml.dist
..
Time: 12.69 seconds, Memory: 3.25Mb
OK (2 tests, 2 assertions)
➜ ocular (master) ✗ git config --global user.email
[email protected]
Ocular should be submitted to packagist.org.
This way it could be installed via Composer.
I found that the latest ocular.phar
is not compatible with PHP 8.
Steps to reproduce:
docker run -it php:8-cli /bin/bash -c "apt-get update && apt-get install -y wget && wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --repository test --revision test --parent test ."
This is error message that is returned:
root@7df1e08850a8:/# php ocular.phar code-coverage:upload --repository test --revision test --parent test .
Notifying that no code coverage data is available for repository "test" and revision "test"...
[Guzzle\Common\Exception\InvalidArgumentException]
Invalid handle provided
Resource handlers are changed in PHP 8: https://php.watch/versions/8.0/resource-CurlHandle.
A newer guzzle
fixed the issue.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.