Skip to content

Commit

Permalink
Create phar build flow
Browse files Browse the repository at this point in the history
Phar releases are needed to be able to use prophecy in projects
that are dependencies of prophecy.
  • Loading branch information
jaapio committed Jan 29, 2021
1 parent 08db3fb commit aedc4d1
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
on: push
name: Release workflow
jobs:
build-phar:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master

- name: Setup PHP
uses: shivammathur/setup-php@master
with:
php-version: 7.4
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1, phar.readonly=0
tools: pecl, 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-progress --prefer-dist --optimize-autoloader
- name: Install phive tools
run: phive install --trust-gpg-keys 2A8299CE842DD38C

- name: Create build dir
run: make phar

- name: Upload PHAR file
uses: actions/upload-artifact@v2.2.0
with:
name: prophecy-phpunit.phar
path: build/prophecy-phpunit.phar

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor
build
composer.lock
phpunit.xml
4 changes: 4 additions & 0 deletions .phive/phars.xml
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"/>
</phive>
7 changes: 5 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
"prefer-stable": true,
"require": {
"php": "^7.3 || ^8",
"phpspec/prophecy": "^1.3",
"phpunit/phpunit":"^9.1"
"phpspec/prophecy": "^1.3"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phar-io/manifest": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
11 changes: 11 additions & 0 deletions makefile
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
15 changes: 15 additions & 0 deletions manifest.xml
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">
<extension for="phpunit/phpunit" compatible="^9.1"/>
</contains>

<copyright>
<author name="Christophe Coevoet" email="stof@notk.org"/>
<license type="MIT" url="https://github.com/phpspec/prophecy-phpunit/blob/master/LICENSE"/>
</copyright>

<requires>
<php version="^7.3 || ^8.0"/>
</requires>
</phar>

0 comments on commit aedc4d1

Please sign in to comment.