-
Notifications
You must be signed in to change notification settings - Fork 39
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
on: | ||
push: | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
name: Release workflow | ||
jobs: | ||
build-phar: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: 7.3 | ||
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1, phar.readonly=0 | ||
tools: phive | ||
|
||
- name: Get composer cache directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
||
- name: Cache composer dependencies | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: composer- | ||
|
||
- name: Install Composer dependencies | ||
run: | | ||
composer install --no-dev --no-progress --prefer-dist --optimize-autoloader | ||
|
||
- name: Remove phpunit | ||
run: composer remove phpunit/phpunit | ||
|
||
- name: Install phive tools | ||
run: phive install --trust-gpg-keys 2A8299CE842DD38C | ||
|
||
- name: Build phar | ||
run: make phar | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload Release Asset | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./build/prophecy-phpunit.phar | ||
asset_name: prophecy-phpunit.phar | ||
asset_content_type: application/zip |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
vendor | ||
build | ||
composer.lock | ||
phpunit.xml | ||
.*.cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. shouldn't |
||
</phive> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
phar: | ||
mkdir build; | ||
cp -r src build/src; | ||
cp -r vendor build; | ||
rm -r build/vendor/phpspec; | ||
cp manifest.xml build/manifest.xml; | ||
cp LICENSE build/LICENSE | ||
php -dphar.readonly=0 ./tools/phpab --phar -o ./build/prophecy-phpunit.phar --all --hash SHA-1 ./build | ||
|
||
clean: | ||
rm -r build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hardcoding the version as 1.0 here looks wrong to me There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well, isn't this PR precisely about implementing that strategy ? |
||
<extension for="phpunit/phpunit" compatible="^9.1"/> | ||
</contains> | ||
|
||
<copyright> | ||
<author name="Christophe Coevoet" email="[email protected]"/> | ||
<license type="MIT" url="https://github.com/phpspec/prophecy-phpunit/blob/master/LICENSE"/> | ||
</copyright> | ||
|
||
<requires> | ||
<php version="^7.3 || ^8.0"/> | ||
</requires> | ||
</phar> |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 usingprophecy-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 aprophecy
phar which includes amanifest
file and aprophecy-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.