ci: force phpstan in PHP 8.1 mode #450
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Run tests | |
| permissions: | |
| contents: read | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| test-php: | |
| # TODO: add OS name to the name when there is multiple OS | |
| name: "tests/unit: PHP ${{ matrix.php-version }} (${{ matrix.composer-options }})" | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.experimental }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ["8.1", "8.2", "8.3", "8.4", "8.5"] | |
| os: [ubuntu-latest] | |
| experimental: [false] | |
| composer-options: ['', '--prefer-lowest'] | |
| include: | |
| - { php-version: 'nightly', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-reqs' } | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Use php ${{ matrix.php-version }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| coverage: pcov | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| run: composer update --no-interaction ${{ matrix.composer-options }} | |
| - name: Run php tests | |
| run: composer run phpunit | |
| - name: Send coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| test-phar: | |
| # TODO: add OS name to the name when there is multiple OS | |
| name: "tests/phar: PHP ${{ matrix.php-version }} CLI (${{ matrix.composer-options }})" | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ["8.1", "8.2", "8.3", "8.4", "8.5"] | |
| os: [ubuntu-latest] | |
| experimental: [false] | |
| composer-options: [''] | |
| include: | |
| # --prefer-lowest outputs have different error counts in the assertions | |
| - { php-version: '8.1', experimental: false, os: ubuntu-latest, composer-options: '--prefer-lowest' } | |
| - { php-version: '8.2', experimental: true, os: ubuntu-latest, composer-options: '--prefer-lowest' } | |
| - { php-version: '8.3', experimental: true, os: ubuntu-latest, composer-options: '--prefer-lowest' } | |
| - { php-version: '8.4', experimental: true, os: ubuntu-latest, composer-options: '--prefer-lowest' } | |
| - { php-version: '8.5', experimental: true, os: ubuntu-latest, composer-options: '--prefer-lowest' } | |
| - { php-version: 'nightly', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-reqs' } | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Use php ${{ matrix.php-version }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| - name: Cache module | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/shunit2_2.1.8-4_all.deb | |
| key: shunit2-cache | |
| - name: Setup shunit 2 | |
| run: | | |
| wget http://ftp.debian.org/debian/pool/main/s/shunit2/shunit2_2.1.8-4_all.deb -O ~/shunit2_2.1.8-4.deb | |
| sudo apt install -y ~/shunit2_2.1.8-4.deb | |
| - name: Run phar tests | |
| continue-on-error: ${{ matrix.experimental }} | |
| run: | | |
| COMPOSER_BIN="/bin/composer" COMPOSER_OPTIONS="${{ matrix.composer-options }}" ./tests/phar/tests.sh | |
| test-resume-from-parse: | |
| # TODO: add OS name to the name when there is multiple OS | |
| name: "tests/resume: PHP ${{ matrix.php-version }} (${{ matrix.composer-options }})" | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.experimental }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ["8.1", "8.2", "8.3", "8.4", "8.5"] | |
| os: [ubuntu-latest] | |
| experimental: [false] | |
| composer-options: ['', '--prefer-lowest'] | |
| include: | |
| - { php-version: 'nightly', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-reqs' } | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Use php ${{ matrix.php-version }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| run: composer update --no-interaction ${{ matrix.composer-options }} | |
| - name: Run resume from parse diff tests | |
| run: ./tests/resume-from-parse-test.sh | |
| test-composer-package-auto-test: | |
| # TODO: add OS name to the name when there is multiple OS | |
| name: "auto-package-tests: PHP ${{ matrix.php-version }} (${{ matrix.composer-options }})" | |
| runs-on: ${{ matrix.os }} | |
| continue-on-error: ${{ matrix.experimental }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ["8.1", "8.2", "8.3", "8.4", "8.5"] | |
| os: [ubuntu-latest] | |
| experimental: [false] | |
| composer-options: ['', '--prefer-lowest'] | |
| include: | |
| - { php-version: 'nightly', experimental: true, os: ubuntu-latest, composer-options: '--ignore-platform-reqs' } | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Use php ${{ matrix.php-version }} | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Restore cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| - name: Run composer package self tests | |
| env: | |
| COMPOSER_CLI_OPTIONS: ${{ matrix.composer-options }} | |
| run: ./tests/composer-package-auto-test.sh |