Skip to content

Commit aedc4d1

Browse files
committed
Create phar build flow
Phar releases are needed to be able to use prophecy in projects that are dependencies of prophecy.
1 parent 08db3fb commit aedc4d1

File tree

6 files changed

+78
-2
lines changed

6 files changed

+78
-2
lines changed

Diff for: .github/workflows/release.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on: push
2+
name: Release workflow
3+
jobs:
4+
build-phar:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@master
8+
9+
- name: Setup PHP
10+
uses: shivammathur/setup-php@master
11+
with:
12+
php-version: 7.4
13+
ini-values: memory_limit=2G, display_errors=On, error_reporting=-1, phar.readonly=0
14+
tools: pecl, phive
15+
16+
- name: Get composer cache directory
17+
id: composer-cache
18+
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
19+
20+
- name: Cache composer dependencies
21+
uses: actions/cache@v2
22+
with:
23+
path: ${{ steps.composer-cache.outputs.dir }}
24+
key: composer-${{ hashFiles('**/composer.lock') }}
25+
restore-keys: composer-
26+
27+
- name: Install Composer dependencies
28+
run: |
29+
composer install --no-progress --prefer-dist --optimize-autoloader
30+
31+
- name: Install phive tools
32+
run: phive install --trust-gpg-keys 2A8299CE842DD38C
33+
34+
- name: Create build dir
35+
run: make phar
36+
37+
- name: Upload PHAR file
38+
uses: actions/[email protected]
39+
with:
40+
name: prophecy-phpunit.phar
41+
path: build/prophecy-phpunit.phar
42+

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor
2+
build
23
composer.lock
34
phpunit.xml

Diff for: .phive/phars.xml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phive xmlns="https://phar.io/phive">
3+
<phar name="phpab" version="^1.26.0" installed="1.26.0" location="./tools/phpab" copy="true"/>
4+
</phive>

Diff for: composer.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
"prefer-stable": true,
1616
"require": {
1717
"php": "^7.3 || ^8",
18-
"phpspec/prophecy": "^1.3",
19-
"phpunit/phpunit":"^9.1"
18+
"phpspec/prophecy": "^1.3"
19+
},
20+
"require-dev": {
21+
"phpunit/phpunit": "^9.5",
22+
"phar-io/manifest": "^2.0"
2023
},
2124
"autoload": {
2225
"psr-4": {

Diff for: makefile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
phar:
2+
mkdir build;
3+
cp -r src build/src;
4+
cp -r vendor build;
5+
rm -r build/vendor/phpspec;
6+
cp manifest.xml build/manifest.xml;
7+
cp LICENSE build/LICENSE
8+
php -dphar.readonly=0 ./tools/phpab --phar -o ./build/prophecy-phpunit.phar --all --hash SHA-1 ./build
9+
10+
clean:
11+
rm -r build

Diff for: manifest.xml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<phar xmlns="https://phar.io/xml/manifest/1.0">
3+
<contains name="prophecy/prophecy-phpunit" version="1.0" type="extension">
4+
<extension for="phpunit/phpunit" compatible="^9.1"/>
5+
</contains>
6+
7+
<copyright>
8+
<author name="Christophe Coevoet" email="[email protected]"/>
9+
<license type="MIT" url="https://github.com/phpspec/prophecy-phpunit/blob/master/LICENSE"/>
10+
</copyright>
11+
12+
<requires>
13+
<php version="^7.3 || ^8.0"/>
14+
</requires>
15+
</phar>

0 commit comments

Comments
 (0)