Add ensure-vendor helper #3
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: Test | |
| on: | |
| push: | |
| branches: [ "main", "develop" ] | |
| pull_request: | |
| branches: [ "main", "develop" ] | |
| permissions: | |
| contents: read | |
| jobs: | |
| phpunit: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| php-version: ["8.5"] | |
| steps: | |
| # Workspace development workflow: | |
| # this job reconstructs the local workspace layout expected by sibling path | |
| # repositories, so related packages are checked out side by side during development. | |
| # | |
| # Release workflow: | |
| # tagged release validation must also succeed from an isolated checkout with | |
| # `composer validate`, `composer test`, and `composer analyse`. | |
| - name: Checkout __PACKAGE_SLUG__ | |
| uses: actions/checkout@v4 | |
| with: | |
| path: __PACKAGE_SLUG__ | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.php-version }} | |
| extensions: bcmath, mbstring | |
| tools: composer:v2, phpunit | |
| coverage: none | |
| - name: Validate composer.json | |
| working-directory: __PACKAGE_SLUG__ | |
| run: composer validate --strict | |
| - name: Get Composer Cache Directory | |
| id: composer-cache | |
| working-directory: __PACKAGE_SLUG__ | |
| run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ matrix.php-version }}-${{ hashFiles('__PACKAGE_SLUG__/composer.json') }} | |
| restore-keys: ${{ runner.os }}-composer- | |
| - name: Install dependencies | |
| working-directory: __PACKAGE_SLUG__ | |
| run: | | |
| bash ./tools/ensure-vendor.sh | |
| if [ ! -f vendor/autoload.php ]; then | |
| composer update -W --prefer-dist --no-progress | |
| fi | |
| - name: Run test suite | |
| working-directory: __PACKAGE_SLUG__ | |
| run: composer test | |
| - name: Run static analysis | |
| working-directory: __PACKAGE_SLUG__ | |
| run: composer analyse |