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

Create phar build flow #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Create phar build flow #31

wants to merge 2 commits into from

Conversation

jaapio
Copy link

@jaapio jaapio commented Jan 29, 2021

Phar releases are needed to be able to use prophecy in projects that are dependencies of prophecy.

As described in #30.

Because phpunit includes prophecy right now we cannot include prophecy in the phar right now. So we need to change that when phpunit 10 is released.
For now, the phar can be installed next to the phpunit.phar in tools/phpunit.d

The configuration below shows how

<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.1/phpunit.xsd"
         extensionsDirectory="./tools/phpunit.d">
        <testsuites>
        <testsuite name="Prophecy PhpUnit Test Suite">
            <directory suffix="Test.php">./test/</directory>
        </testsuite>
    </testsuites>
</phpunit>

The included github action automates the phar creation and adds it to the created release.

@jaapio jaapio force-pushed the phar-build branch 3 times, most recently from 714174a to aedc4d1 Compare January 29, 2021 13:49
@jaapio jaapio marked this pull request as ready for review January 29, 2021 14:14
.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
composer.json Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
Copy link
Member

Choose a reason for hiding this comment

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

what if we tag a prerelease tag instead of a stable one ?

Copy link
Author

Choose a reason for hiding this comment

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

I think we need to discuss how to handle those, I didn't find any pre-releases in this package.
Rethinking this, we need to release every time prophecy itself is released.
This would mean that we need to connect the projects more tightly. Of course this can be automated some in some way. But before we spend to much time on this I would like to know your opinion about is.

Copy link
Member

Choose a reason for hiding this comment

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

if the releasing of the phar needs to depend on releasing both prophecy and prophecy-phpunit, it should not be managed in the releases of the prophecy-phpunit repository itself, as that would mess things up. We should either have separate phars for each package or a separate repo managing the combined phar

Copy link
Author

@jaapio jaapio Feb 1, 2021

Choose a reason for hiding this comment

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

For example, when you would release a bugfix for prophecy people using prophecy-phpunit would need to get that patch. Seen the amount of code in this repo I don't expect too many changes. With composer this problem doesn't exist, when shipping a phar this problem does exist since all dependencies are included. I don't think phpunit can load multiple phars for a single plugin. We could investigate that. It would mean that we would deliver a prophecy phar which includes a manifest file and a prophecy-phpunit for the integration of the packages.

But maybe you are right, and a separate repo is better since it would have it's own releases.

Since this is kind of an edge case I don't want to take too much of your time. So maybe it is better to create a separate project first. And move it under the phpspec flag later if we are going to share maintenance.
That was also the mean reason for me to open an issue first before creating this PR.

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<phar xmlns="https://phar.io/xml/manifest/1.0">
<contains name="prophecy/prophecy-phpunit" version="1.0" type="extension">
Copy link
Member

Choose a reason for hiding this comment

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

hardcoding the version as 1.0 here looks wrong to me

Copy link
Author

Choose a reason for hiding this comment

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

The version here should be equal to the version of the package. When we have a release strategy for the phar releases I can have a look at how to implement this properly.

Copy link
Member

Choose a reason for hiding this comment

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

well, isn't this PR precisely about implementing that strategy ?

composer.json Show resolved Hide resolved
.github/workflows/release.yml Outdated Show resolved Hide resolved
@jaapio jaapio force-pushed the phar-build branch 3 times, most recently from b3b946c to 326da3a Compare January 29, 2021 19:12
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpab" version="^1.26.0" installed="1.26.0" location="./tools/phpab" copy="true"/>
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't tools be added in .gitignore ?

Phar releases are needed to be able to use prophecy in projects
that are dependencies of prophecy.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants