Skip to content

Use Brigade for coverage #1505

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

Merged
merged 5 commits into from
Nov 23, 2017
Merged

Use Brigade for coverage #1505

merged 5 commits into from
Nov 23, 2017

Conversation

meyerbaptiste
Copy link
Member

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? I hope
Fixed tickets #1489
License MIT
Doc PR N/A

brigade.js Outdated
'export COMPOSER_ALLOW_SUPERUSER=1',
'curl -s -f -L -o /tmp/installer.php https://getcomposer.org/installer',
'curl -s -f -L -o /tmp/install.sig https://composer.github.io/installer.sig',
'php -r "\$signature = trim(file_get_contents(\'/tmp/install.sig\')); \$hash = hash(\'SHA384\', file_get_contents(\'/tmp/installer.php\')); if (!hash_equals(\$signature, \$hash)) { unlink(\'/tmp/installer.php\'); echo \'Integrity check failed, installer is either corrupt or worse.\' . PHP_EOL; exit(1); }"',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use template strings? Would keep us from escaping the ' and allow multi lines on complex tasks like this one.

@alanpoulain
Copy link
Member

Shouldn't we handle the versions used (for php-code-coverage or coveralls for example) elsewhere?

brigade.js Outdated
const coverage = (event, project) => {
console.log(`===> Building ${ project.repo.cloneURL } ${ event.commit }`);

const job = new Job('coverage', 'php:rc-alpine');
Copy link
Member

@dunglas dunglas Nov 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe can you start from the composer image directly?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use a custom Docker image stored on the coopTilleuls account to save some CPU and speed up the builds.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done @dunglas. Can you please review?

@dunglas
Copy link
Member

dunglas commented Nov 21, 2017

@alanpoulain, in the end, we should probably use a pre-built Docker image containing all those tools to speed up the builds.

@meyerbaptiste
Copy link
Member Author

Anyway, it doesn't work for now 😢

@meyerbaptiste meyerbaptiste force-pushed the add_brigade branch 6 times, most recently from fa214ba to b677b33 Compare November 22, 2017 02:07
@meyerbaptiste meyerbaptiste changed the title [WIP] Use Brigade for coverage Use Brigade for coverage Nov 22, 2017
@meyerbaptiste
Copy link
Member Author

It works!

@Simperfit
Copy link
Contributor

I'm glad that this is working, congrats @meyerbaptiste !

@dunglas
Copy link
Member

dunglas commented Nov 22, 2017

Wouhou!

brigade.js Outdated
const job = new Job('coverage', 'php:rc-alpine');

job.tasks = [
`set -xe`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's ok to use backticks for multiple lines but you can keep simple quotes here

@sroze
Copy link
Contributor

sroze commented Nov 22, 2017

But... the brigade commit status is a 404 URL and has Kevin's face on it 😄

@sroze
Copy link
Contributor

sroze commented Nov 22, 2017

What is the point of this by the way? 🤔 (Except the fancyness that I like 😛)

@dunglas
Copy link
Member

dunglas commented Nov 22, 2017

What is the point of this by the way? 🤔 (Except the fancyness that I like 😛)

We cannot compute the code coverage on Travis anymore (we consume too much resources). So we use Brigade to compute the coverage.

@Gregcop1
Copy link

A brigade with @dunglas as avatar is not something you see every day :p

@soyuka
Copy link
Member

soyuka commented Nov 22, 2017

What is the point of this by the way? 🤔 (Except the fancyness that I like 😛)

The full story: https://gist.github.com/soyuka/2c6d55da59b1ab74a9a92deed093df02

@meyerbaptiste
Copy link
Member Author

meyerbaptiste commented Nov 22, 2017

@sroze:

the brigade commit status is a 404 URL

See brigadecore/brigade#126.
Another problematic issue is brigadecore/brigade#125.

has Kevin's face on it

Yes it sounds weird but it's because the Github token used comes from @dunglas' account. Maybe we should create a specific account for API Platform?

brigade.js Outdated
'composer require --dev --no-update \'phpunit/php-code-coverage:^5.2.2\'',
'composer update --prefer-dist --no-progress --no-suggest --ansi',
'phpdbg -qrr vendor/bin/phpunit --coverage-php build/cov/coverage-phpunit.cov',
'for f in $(find features -name \'*.feature\'); do FEATURE=${f//\\//_} phpdbg -qrr vendor/bin/behat --format=progress --profile coverage $f || exit $?; done',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here literals

brigade.js Outdated
'set -xe',
'cd /src/',
'mkdir -p build/logs build/cov',
'composer require --dev --no-update \'phpunit/php-code-coverage:^5.2.2\'',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here literals

brigade.js Outdated
job.env = {
'COVERALLS_RUN_LOCALLY': '1',
'COVERALLS_REPO_TOKEN': project.secrets.coverallsToken,
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quotes are not needed on keys

@soyuka
Copy link
Member

soyuka commented Nov 23, 2017

🎆 thanks @meyerbaptiste!

@meyerbaptiste meyerbaptiste deleted the add_brigade branch November 23, 2017 10:27
@sroze
Copy link
Contributor

sroze commented Nov 23, 2017

The 404 link is expected?

@meyerbaptiste
Copy link
Member Author

@sroze: #1505 (comment) 😛

@sroze
Copy link
Contributor

sroze commented Nov 23, 2017

🙊 🏃

@soyuka
Copy link
Member

soyuka commented Nov 23, 2017

@sroze anyway not a problem because this is only to keep the coverage up to date, we don't really care about the job itself :).

hoangnd25 pushed a commit to hoangnd25/core that referenced this pull request Feb 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants