fix: add support for ${workspaceFolder} in --configuration argument #416
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: Tests | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| - '*.x' | |
| pull_request: | |
| jobs: | |
| test: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| php: ['7.4', '8.2', '8.4'] | |
| node: ['20'] | |
| name: ${{ matrix.os }} node-${{ matrix.node }} php-${{ matrix.php }} | |
| defaults: | |
| run: | |
| shell: bash | |
| env: | |
| extensions: curl, dom, libxml, mbstring, pcntl, pdo, pdo_sqlite, sqlite, xdebug, zip | |
| key: cache-v1 | |
| GITHUB_ACTIONS: true | |
| PHPUNIT_PROJECT: packages/phpunit/tests/fixtures/phpunit-stub | |
| PEST_PROJECT: packages/phpunit/tests/fixtures/pest-stub | |
| # Minimum PHP version per stub (used to skip incompatible installs) | |
| PHPUNIT_MIN_PHP: v9=7.3 v10=8.1 v11=8.2 v12=8.3 | |
| PEST_MIN_PHP: v2=8.2 v3=8.2 v4=8.3 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup cache environment | |
| id: extcache | |
| uses: shivammathur/cache-extensions@v1 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: ${{ env.extensions }} | |
| key: ${{ env.key }} | |
| - name: Cache extensions | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.extcache.outputs.dir }} | |
| key: ${{ steps.extcache.outputs.key }} | |
| restore-keys: ${{ steps.extcache.outputs.key }} | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php }} | |
| extensions: ${{ env.extensions }} | |
| tools: composer:v2 | |
| coverage: xdebug | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| cache: pnpm | |
| - name: Cache Composer dependencies (stubs) | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ${{ env.PHPUNIT_PROJECT }}/*/vendor | |
| ${{ env.PEST_PROJECT }}/*/vendor | |
| key: composer-stubs-${{ matrix.os }}-php${{ matrix.php }}-${{ hashFiles('packages/phpunit/tests/fixtures/**/composer.lock') }} | |
| restore-keys: | | |
| composer-stubs-${{ matrix.os }}-php${{ matrix.php }}- | |
| - name: Install Composer dependencies (PHPUnit stubs) | |
| run: | | |
| lookup="${{ env.PHPUNIT_MIN_PHP }}" | |
| for dir in $(ls -d ${{ env.PHPUNIT_PROJECT }}/v*/ | sort -V); do | |
| stub=$(basename "$dir") | |
| min=$(echo "$lookup" | tr ' ' '\n' | grep "^${stub}=" | cut -d= -f2) | |
| min=${min:-99} | |
| if php -r "exit(version_compare('${{ matrix.php }}','$min','>=') ? 0 : 1);"; then | |
| echo "::group::Installing $stub (PHP >= $min)" | |
| (cd "$dir" && composer install --prefer-dist --no-interaction --no-progress) || true | |
| echo "::endgroup::" | |
| else | |
| echo "Skipping $stub (requires PHP >= $min, have ${{ matrix.php }})" | |
| fi | |
| done | |
| - name: Install Composer dependencies (Pest stubs) | |
| run: | | |
| lookup="${{ env.PEST_MIN_PHP }}" | |
| for dir in $(ls -d ${{ env.PEST_PROJECT }}/v*/ | sort -V); do | |
| stub=$(basename "$dir") | |
| min=$(echo "$lookup" | tr ' ' '\n' | grep "^${stub}=" | cut -d= -f2) | |
| min=${min:-99} | |
| if php -r "exit(version_compare('${{ matrix.php }}','$min','>=') ? 0 : 1);"; then | |
| echo "::group::Installing $stub (PHP >= $min)" | |
| (cd "$dir" && composer install --prefer-dist --no-interaction --no-progress) || true | |
| echo "::endgroup::" | |
| else | |
| echo "Skipping $stub (requires PHP >= $min, have ${{ matrix.php }})" | |
| fi | |
| done | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Run the tests | |
| run: pnpm vitest --coverage | |
| - name: Send to codecov | |
| if: matrix.os == 'ubuntu-latest' && matrix.php == '8.4' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: coverage/coverage-final.json | |
| flags: unittests |