Skip to content

Merge pull request #1462 from ciaranmcnulty/bump-phpunit #330

Merge pull request #1462 from ciaranmcnulty/bump-phpunit

Merge pull request #1462 from ciaranmcnulty/bump-phpunit #330

Workflow file for this run

name: Build
on:
push:
branches: [main, next, master, 2.5, 3.4, 4.3, 5.1, 6.3]
pull_request:
release:
types: [created]
jobs:
tests:
runs-on: ubuntu-latest
name: Build and test
strategy:
fail-fast: false
matrix:
php: ["8.2", "8.3"]
operating-system: [ ubuntu-latest, macOS-latest, windows-latest ]
composer-flags: [""]
composer-extras: [""]
stability: ["stable"]
include:
- php: "8.2"
publish-phar: true
- php: "8.2"
composer-flags: --prefer-lowest
- php: "8.3"
operating-system: windows-latest
- php: "8.2"
- php: "8.3"
env:
COMPOSER_ROOT_VERSION: dev-master
steps:
- uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
ini-values: "phar.readonly=0"
- name: Install composer extras
if: matrix.composer-extras != ''
run: composer require ${{ matrix.composer-extras }} --no-update
- name: Update the minimum stability
if: matrix.stability == 'dev'
run: composer config minimum-stability ${{ matrix.stability }}
- name: Locate composer cache
id: composercache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
env:
cache-name: cache-composer
with:
path: ${{ steps.composercache.outputs.dir }}
key: ${{ hashFiles('composer.json') }}
- name: Install composer dependencies
run: composer update ${{ matrix.composer-flags }}
- name: Run static analysis (psalm)
if: matrix.composer-flags != '--prefer-lowest'
run: ./vendor/bin/psalm --php-version=${{ matrix.php }}
- name: Run tests (phpspec)
run: bin/phpspec run --format=dot
- name: Run tests (phpunit)
run: ./vendor/bin/phpunit
- name: Run tests (behat)
run: ./vendor/bin/behat --format=progress
- name: Build the PHAR
run: |
composer bin box require --dev humbug/box
./vendor/bin/box compile
./vendor/bin/behat --profile=phar
- uses: actions/upload-artifact@v1
name: Publish the PHAR
if: matrix.publish-phar
with:
name: phpspec.phar
path: phpspec.phar
publish-phar:
runs-on: ubuntu-latest
name: Publish the PHAR
needs: tests
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v1
with:
name: phpspec.phar
path: .
- name: Upload phpspec.phar
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: phpspec.phar
asset_name: phpspec.phar
asset_content_type: application/zip