diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index b7d0b9b..a802b84 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -21,5 +21,28 @@ jobs: with: php-version: '8.4' coverage: none + - name: Resolve composer cache directory + id: composer-cache + shell: bash + run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT" + + - name: Restore composer cache + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: composer-${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.json') }} + restore-keys: composer-${{ runner.os }}-${{ matrix.php }}- + + - name: Drop cached laranail archives + # laranail/* resolve through a single MOVING v0.1.0 tag, so composer's dist + # cache is keyed on a name whose contents change underneath it. A restored + # archive is then silently stale: the install reports success and unpacks + # whatever was cached the first time. Everything else is immutable per + # version and stays cached. + # POSIX command via bash: Windows runners default to PowerShell, where this + # would be a parse error rather than a no-op. + shell: bash + run: rm -rf "$(composer config cache-files-dir)/laranail" + - run: composer update --prefer-dist --no-interaction - run: vendor/bin/pint --test diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df269a8..554f251 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,31 +2,27 @@ name: Tests on: pull_request: + branches: [main] + paths-ignore: + - '**.md' + workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true -permissions: - contents: read - +# Calls the one shared definition in laranail/.github. Everything this file used +# to spell out -- the PHP matrix, the composer cache and its laranail eviction, +# prefer-lowest, fail-fast, timeouts -- lives there now, so a change to how this +# family tests is one edit instead of fifty. jobs: - test: - runs-on: ubuntu-latest - timeout-minutes: 15 - strategy: - fail-fast: false - matrix: - php: ['8.4', '8.5'] - stability: [prefer-lowest, prefer-stable] - - name: PHP ${{ matrix.php }} ยท ${{ matrix.stability }} - - steps: - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - - uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # v2 - with: - php-version: ${{ matrix.php }} - coverage: none - - run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction - - run: vendor/bin/pest --ci + pest: + uses: laranail/.github/.github/workflows/tests.yml@main + with: + # Pin nothing: resolve whatever composer.json allows. The shared workflow + # still defaults laravel-versions to ["13.*"], which runs + # `composer require illuminate/contracts` and REWRITES composer.json, so + # the suite would test a manifest this package does not ship. Remove this + # line only once that default is ["*"]. + laravel-versions: '["*"]' + test-command: 'vendor/bin/pest --ci --colors=never'