Skip to content

Commit

Permalink
Move PHAR build into separate build-step
Browse files Browse the repository at this point in the history
This commit moves building the PHAR file out of the test-suite and moves
it into it's own step that requires all biulds to pass to be executed.
That makes it for one thing easier to make sure that all tests in all
versions of PHP work before creating the PHAR and it also allows to
easier optimize the build of the PHAR without interfering with tests.

The build-steps from the test-part were taken over into the build-phar
part and appropriately extended.

Also this makes sure that the PHAr is build based on the PHP7.2 version
so taht it can be ran in all supported PHP-Versions.
  • Loading branch information
heiglandreas committed Mar 16, 2024
1 parent 575b02a commit 9077627
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
defaults:
run:
shell: bash
name: Build and test
name: Test
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -75,7 +75,6 @@ jobs:
php-version: "${{ matrix.php }}"
ini-values: "phar.readonly=0,zend.exception_ignore_args=Off"
coverage: none
tools: box

- name: Install symfony/flex
if: matrix.symfony-version != ''
Expand Down Expand Up @@ -108,24 +107,6 @@ jobs:
if: matrix.php >= 8.0
run: ./bin/behat -fprogress --strict --tags=@php8

- name: Build the PHAR
if: matrix.publish-phar == true
run: |
composer install --no-dev -o &&
box build
- name: Test the PHAR
if: matrix.publish-phar == true
run: |
behat.phar --version
- uses: actions/upload-artifact@v3
name: Publish the PHAR
if: matrix.publish-phar == true
with:
name: behat.phar
path: behat.phar

static-analysis:
runs-on: ubuntu-latest
name: Static analysis
Expand All @@ -145,10 +126,42 @@ jobs:
- name: Run Psalm
run: ./vendor/bin/psalm --output-format=github

build-phar:
needs: tests
runs-on: ubuntu-latest
name: Build PHAR file
steps:
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.3"
ini-values: "phar.readonly=0,zend.exception_ignore_args=Off"
coverage: none
tools: box

- name: Build the PHAR
run: |
composer config platform.php ^7.2.34
composer update --no-dev -o
box build
- name: Test the PHAR
run: |
behat.phar --version
- uses: actions/upload-artifact@v3
name: Upload PHAR artifact
with:
name: behat.phar
path: behat.phar


publish-phar:
runs-on: ubuntu-latest
name: Publish the PHAR for release
needs: tests
needs: build-phar
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v3
Expand Down

0 comments on commit 9077627

Please sign in to comment.