Skip to content

Commit

Permalink
cache php extensions
Browse files Browse the repository at this point in the history
optimize build times by caching php extensions, particularly for 8.4/nightly which otherwise builds extensions from source each time
  • Loading branch information
brettmc committed Jan 13, 2024
1 parent 3928b13 commit 42d2b66
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,39 @@ jobs:
- php-version: 8.4
experimental: true
composer_args: "--ignore-platform-reqs"
env:
extensions: ast, grpc, protobuf

steps:
- name: Set cache key
id: key
run: |
echo "key=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- uses: actions/checkout@v3

- name: Setup cache environment
id: extcache
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}

- name: Cache extensions
uses: actions/cache@v3
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-version }}
coverage: xdebug
tools: php-cs-fixer
extensions: "ast, grpc, protobuf"
extensions: ${{ env.extensions }}

- name: Validate composer.json
run: composer validate
Expand All @@ -55,24 +77,30 @@ jobs:
run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --stop-on-violation --using-cache=no -vvv

- name: Check Dependencies
continue-on-error: ${{ matrix.experimental }}
run: vendor/bin/deptrac --formatter=github-actions --report-uncovered

- name: Run Phan
continue-on-error: ${{ matrix.experimental }}
env:
XDEBUG_MODE: off
PHAN_DISABLE_XDEBUG_WARN: 1
run: vendor/bin/phan

- name: Run Psalm
continue-on-error: ${{ matrix.experimental }}
run: vendor/bin/psalm --output-format=github

- name: Run Phpstan
continue-on-error: ${{ matrix.experimental }}
run: vendor/bin/phpstan analyse --error-format=github

- name: Run PHPUnit (unit tests)
continue-on-error: ${{ matrix.experimental }}
run: php -dzend.assertions=1 vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover --testsuite unit

- name: Run PHPUnit (integration tests)
continue-on-error: ${{ matrix.experimental }}
run: vendor/bin/phpunit --testsuite integration

- name: Code Coverage
Expand Down

0 comments on commit 42d2b66

Please sign in to comment.