Skip to content

Commit

Permalink
Update github actions workflow config
Browse files Browse the repository at this point in the history
  • Loading branch information
richan-fongdasen committed Feb 26, 2023
1 parent 07d831f commit 21bf286
Showing 1 changed file with 29 additions and 80 deletions.
109 changes: 29 additions & 80 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ on:
paths-ignore: ['*.md']
pull_request:
paths-ignore: ['*.md']
branches: [master]
branches: [ master, main ]

jobs:
analysis:
runs-on: ubuntu-latest
strategy:
matrix:
php: [8.0, 8.1]
php: [8.2]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -33,68 +33,29 @@ jobs:
php-${{ matrix.php }}-build-
php-${{ matrix.php }}-
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run phpstan analysis
run: composer phpstan-analysis
- name: Run phpmd analysis
run: composer phpmd-analysis
- name: Run phpcpd analysis
run: vendor/bin/phpcpd --min-lines=3 --min-tokens=36 src/
laravel8:
needs: [analysis]
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.4, 8.0, 8.1]
steps:
- uses: actions/checkout@v1
- 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, soap, intl, gd, exif, iconv
coverage: none
- name: Force update laravel version
run: composer require "laravel/framework:^8.0" "orchestra/testbench:^6.0" --no-update
- name: Remove some dev dependencies
run: composer remove "ekino/phpstan-banned-code" "nunomaduro/larastan" "phpmd/phpmd" "phpstan/phpstan-deprecation-rules" "sebastian/phpcpd" --dev --no-update
- name: Cache composer dependencies
uses: actions/cache@v2
env:
cache-name: laravel-gcr-worker-laravel8
with:
path: ~/.composer
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
php-${{ matrix.php }}-build-${{ env.cache-name }}-
php-${{ matrix.php }}-build-
php-${{ matrix.php }}-
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run the test suite
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit
laravel9:
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.1 ]
php: [ 7.4, 8.0, 8.1 ]
steps:
- uses: actions/checkout@v1
- name: Setup PHP
- name: Checkout repository
uses: actions/checkout@v2
- 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, soap, intl, gd, exif, iconv
coverage: none
- name: Force update laravel version
run: composer require "laravel/framework:^9.0" "orchestra/testbench:^7.0" --no-update
- name: Remove some dev dependencies
run: composer remove "ekino/phpstan-banned-code" "nunomaduro/larastan" "phpmd/phpmd" "phpstan/phpstan-deprecation-rules" "sebastian/phpcpd" --dev --no-update
- name: Cache composer dependencies
uses: actions/cache@v2
env:
cache-name: laravel-gcr-worker-laravel9
cache-name: laravel-gcr-worker-test
with:
path: ~/.composer
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
Expand All @@ -103,40 +64,29 @@ jobs:
php-${{ matrix.php }}-build-
php-${{ matrix.php }}-
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run the test suite
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit
laravel9-cov:
run: composer install --no-interaction --prefer-dist
- name: Run PHPUnit tests and generate code coverage
run: |
vendor/bin/phpunit
test-coverage:
name: Test (PHP ${{ matrix.php }})
needs: [ analysis ]
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.0 , 8.1]
php: [ 8.2 ]
steps:
- uses: actions/checkout@v1
- name: Cache composer dependencies
uses: actions/cache@v2
env:
cache-name: cache-gcr-worker-laravel-latest
with:
path: ~/.composer
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup PHP
- name: Checkout repository
uses: actions/checkout@v2
- 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, soap, intl, gd, exif, iconv
coverage: none
- name: Force update laravel version
run: composer require "laravel/framework:^9.0" "orchestra/testbench:^7.0" --no-update
- name: Cache composer dependencies
uses: actions/cache@v2
env:
cache-name: laravel-gcr-worker-laravel9cov
cache-name: laravel-gcr-worker-test
with:
path: ~/.composer
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
Expand All @@ -145,10 +95,9 @@ jobs:
php-${{ matrix.php }}-build-
php-${{ matrix.php }}-
- name: Install composer dependencies
run: composer install --prefer-dist
- name: Run the Coverage test suite
run: phpdbg -qrr -dmemory_limit=3G vendor/bin/phpunit --coverage-clover=clover.xml
- name: Upload test coverage report to codecov.io
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
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)

0 comments on commit 21bf286

Please sign in to comment.