Merge pull request #10 from richan-fongdasen/laravel-11 #78
Workflow file for this run
This file contains 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: Build | |
on: | |
push: | |
paths-ignore: ["*.md"] | |
pull_request: | |
paths-ignore: ["*.md"] | |
branches: [main] | |
jobs: | |
analysis: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [8.3] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv | |
coverage: none | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache composer dependencies | |
uses: actions/cache@v4 | |
env: | |
cache-name: laravel-gcr-worker-analysis | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
php-${{ matrix.php }}-build-${{ env.cache-name }}- | |
- name: Install composer dependencies | |
run: composer install --no-interaction --prefer-dist | |
- name: Run static analysis | |
run: composer analyse | |
test: | |
name: Test (PHP ${{ matrix.php }}) | |
needs: [analysis] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [8.0, 8.1, 8.2] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv | |
coverage: none | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache composer dependencies | |
uses: actions/cache@v4 | |
env: | |
cache-name: laravel-gcr-worker-test | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
php-${{ matrix.php }}-build-${{ env.cache-name }}- | |
- name: Install composer dependencies | |
run: composer install --no-interaction --prefer-dist | |
- name: Run PHPUnit tests | |
run: vendor/bin/phpunit | |
test-coverage: | |
name: Test (PHP ${{ matrix.php }}) | |
needs: [analysis] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [8.3] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache composer dependencies | |
uses: actions/cache@v4 | |
env: | |
cache-name: laravel-gcr-worker-test | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }} | |
restore-keys: | | |
php-${{ matrix.php }}-build-${{ env.cache-name }}- | |
- name: Install composer dependencies | |
run: composer install --no-interaction --prefer-dist | |
- name: Run PHPUnit tests and generate code coverage | |
run: vendor/bin/phpunit --coverage-clover=clover.xml | |
- name: Upload code coverage results | |
run: bash <(curl -s https://codecov.io/bash) |