diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..c6bf943 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,46 @@ +name: PHP Composer + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + strategy: + matrix: + # The library supports PHP 7.1+, but PHPUnit 9.6 needs 7.3 or later + php-versions: ["7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: ${{ matrix.php-versions }} + # sockets lets the resolver read IPv6 entries from the hosts file + extensions: mbstring, dom, curl, sockets + coverage: pcov + + # Not --strict: the open-ended mf2/mf2 constraint is only a warning + - name: Validate composer.json + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v4 + with: + path: vendor + key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('composer.json') }} + restore-keys: | + ${{ runner.os }}-php-${{ matrix.php-versions }}- + + # There's no committed composer.lock, so resolve for each PHP version + - name: Install dependencies + run: composer update --prefer-dist --no-progress + + - name: Run test suite + run: composer run-script test