-
Notifications
You must be signed in to change notification settings - Fork 59
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
Updated PHAR release script #522
base: 7.1.x
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 |
---|---|---|
|
@@ -4,61 +4,47 @@ name: "Release PHAR" | |
|
||
on: | ||
release: | ||
types: | ||
- published | ||
types: [published] | ||
|
||
jobs: | ||
release-phar: | ||
name: "Release PHAR" | ||
build: | ||
name: "Building and upload PHAR artifact" | ||
|
||
runs-on: ${{ matrix.operating-system }} | ||
|
||
strategy: | ||
matrix: | ||
dependencies: | ||
- "locked" | ||
php-version: | ||
- "7.4" | ||
operating-system: | ||
- "ubuntu-latest" | ||
runs-on: "ubuntu-latest" | ||
|
||
steps: | ||
- name: "Checkout" | ||
uses: "actions/checkout@v3" | ||
uses: "actions/checkout@v2" | ||
|
||
- name: "Install PHP" | ||
uses: "shivammathur/setup-php@v2" | ||
with: | ||
coverage: "pcov" | ||
php-version: "${{ matrix.php-version }}" | ||
ini-values: memory_limit=-1 | ||
|
||
- name: "Cache dependencies" | ||
uses: "actions/cache@v3" | ||
with: | ||
path: | | ||
~/.composer/cache | ||
vendor | ||
key: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
restore-keys: "php-${{ matrix.php-version }}-${{ matrix.dependencies }}" | ||
|
||
- name: "Install lowest dependencies" | ||
if: ${{ matrix.dependencies == 'lowest' }} | ||
run: "composer update --prefer-lowest --no-interaction --no-progress --no-suggest" | ||
coverage: "none" | ||
php-version: "8.0" | ||
ini-values: memory_limit=-1, phar.readonly=0 | ||
|
||
- name: "Install highest dependencies" | ||
if: ${{ matrix.dependencies == 'highest' }} | ||
run: "composer update --no-interaction --no-progress --no-suggest" | ||
- name: "Import GPG Key" | ||
run: echo "$PRIVATE_KEY" | gpg --import | ||
env: | ||
PRIVATE_KEY: ${{ secrets.SIGNING_SECRET_KEY }} | ||
|
||
- name: "Install locked dependencies" | ||
if: ${{ matrix.dependencies == 'locked' }} | ||
- name: "Install dependencies for build environment" | ||
run: "composer install --no-interaction --no-progress --no-suggest" | ||
|
||
- name: "build-phar.sh" | ||
run: "build-phar.sh" | ||
- name: "Build and sign phar file via phing" | ||
run: "vendor/bin/phing phar-build phar-sign" | ||
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. I was able to run 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. Need to do a release 😬 |
||
|
||
- name: "Upload PHAR" | ||
uses: fnkr/github-action-ghr@v1 | ||
env: | ||
GHR_PATH: dist/ | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: "Upload phar file artifact" | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: composer-require-checker.phar | ||
path: | | ||
build/composer-require-checker.phar | ||
build/composer-require-checker.phar.asc | ||
- name: Upload PHAR to release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: build/composer-require-checker.phar* | ||
file_glob: true | ||
tag: ${{ github.ref }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,5 @@ phpstan.neon | |
phpunit.xml | ||
phpcs.xml | ||
.phpunit.result.cache | ||
/bin/clistub.php | ||
/build/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- ============================================================== --> | ||
<!-- Phing Build instructions --> | ||
<!-- http://www.phing.info/ --> | ||
<!-- http://www.phing.info/get/phing-latest.phar --> | ||
<!-- php -d phar.readonly=Off phing-latest.phar phar-build-release --> | ||
<!-- ============================================================== --> | ||
<project name="roave-backward-compatibility-check" default="phar-build"> | ||
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. Why the fresh hell do we need phing, and why does it still exist? 😱 |
||
<property name="build-dir" value="build"/> | ||
<property name="phar-dir" value="build/phar"/> | ||
|
||
<!-- ============================================ --> | ||
<!-- Target: phar-prepare-dependencies --> | ||
<!-- ============================================ --> | ||
<target name="phar-prepare-dependencies"> | ||
<!--install dependencies without development requirements--> | ||
<exec command="composer install --no-dev -o" passthru="true" checkreturn="true"/> | ||
</target> | ||
|
||
<!-- ============================================ --> | ||
<!-- Target: phar-build --> | ||
<!-- ============================================ --> | ||
<target name="phar-build" depends="phar-prepare-dependencies"> | ||
<!--create the package--> | ||
<mkdir dir="${build-dir}" /> | ||
<php expression="file_put_contents('bin/clistub.php', '#!/usr/bin/env php' . chr(10) . Phar::createDefaultStub('bin/roave-backward-compatibility-check.php'))"/> | ||
<pharpackage basedir="./" | ||
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. We really shouldn't drag in phing for just this 😬 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. This is just based off the suggested approach in maglnet/ComposerRequireChecker - which uses Phing's PHAR packager to make this heh 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. Yup - I think we just need to extract this specific step to be done via bash, and then we are good 🤔 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. Seems like it isn't too much Voodoo: https://github.com/phingofficial/phing/blob/d98239f270e86c6a886eb93893d5ddd17c9d71bd/src/Phing/Task/System/PharPackageTask.php Only dependency becomes ext-phar in require-dev 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. Sorry for bothering: any update on this? Thanks! 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. Hmm, yeah, looking at https://github.com/maglnet/ComposerRequireChecker/blob/fb2a69aa2b7307541233536f179275e99451b339/.github/workflows/phar-creation.yml#L32, there's no real way around it. We could have a I can extract it from here later, if it becomes a problem: would really rather not have phing in my big list of problems, but it is what it is :D 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. Not sure if @theseer might be working a tool: https://phpc.social/@theseer/109296480712703364 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. Let's just go with what works now and unblocks @sebastianbergmann, and then we suffer later in trying to extract it from our pipeline again :P 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. OK, I'll take a look at this again and refresh myself, haven't looked at it for a while and probably needs a rebase etc 😁 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.
This is work in progress and in early design phase on my side. |
||
destfile="${build-dir}/${phing.project.name}.phar" | ||
stub="bin/clistub.php" | ||
compression="gzip"> | ||
<fileset dir="./"> | ||
<include name="src/**/*.php"/> | ||
<include name="bin/*"/> | ||
<include name="vendor/**"/> | ||
<include name="LICENSE"/> | ||
<include name="composer.json"/> | ||
<include name="composer.lock"/> | ||
</fileset> | ||
|
||
</pharpackage> | ||
</target> | ||
|
||
<target name="phar-sign"> | ||
<delete file="${build-dir}/${phing.project.name}.phar.asc"/> | ||
<exec executable="gpg" checkreturn="true" passthru="true"> | ||
<arg value="--batch" /> | ||
<arg value="--local-user" /> | ||
<arg value="[email protected]" /> | ||
<arg value="--detach-sign" /> | ||
<arg value="--output" /> | ||
<arg path="${build-dir}/${phing.project.name}.phar.asc" /> | ||
<arg path="${build-dir}/${phing.project.name}.phar" /> | ||
</exec> | ||
|
||
<exec executable="gpg" checkreturn="true" passthru="true"> | ||
<arg value="--verify" /> | ||
<arg path="${build-dir}/${phing.project.name}.phar.asc" /> | ||
<arg path="${build-dir}/${phing.project.name}.phar" /> | ||
</exec> | ||
</target> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
], | ||
"require-dev": { | ||
"doctrine/coding-standard": "^9.0.0", | ||
"phing/phing": "^2.17", | ||
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. Nopenopenope 🤣 |
||
"php-standard-library/psalm-plugin": "^1.1.5", | ||
"phpunit/phpunit": "^9.5.20", | ||
"psalm/plugin-phpunit": "^0.16.1", | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
To be reverted