diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c5b8740 --- /dev/null +++ b/.github/workflows/release.yml @@ -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 + + - 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 + diff --git a/.gitignore b/.gitignore index a79486f..2763146 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor +build composer.lock phpunit.xml diff --git a/.phive/phars.xml b/.phive/phars.xml new file mode 100644 index 0000000..a5cb741 --- /dev/null +++ b/.phive/phars.xml @@ -0,0 +1,4 @@ + + + + diff --git a/composer.json b/composer.json index 2c48d3b..a4c7e5c 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/makefile b/makefile new file mode 100644 index 0000000..c5318a4 --- /dev/null +++ b/makefile @@ -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 diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 0000000..2c5352d --- /dev/null +++ b/manifest.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + +