merge github workflows #1
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: vite-bundle CI | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
defaults: | |
run: | |
working-directory: ./src/vite-bundle | |
jobs: | |
ci: | |
name: CI | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
# php-versions: [ '7.4', '8.0', '8.1', '8.2' ] | |
php-versions: [ '8.2' ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php-versions }} | |
- name: Lint PHP | |
run: find -L . -path ./vendor -prune -o -type f -name '*.php' -print0 | xargs -0 -n 1 -P $(nproc) php -l | |
- name: Get composer cache directory | |
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter | |
id: composer-cache | |
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT | |
- name: Cache composer | |
# https://github.com/shivammathur/setup-php/tree/v2/#cache-composer-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: composer install --no-interaction --no-ansi | |
- name: Validate coding standards | |
if: matrix.php-versions == 8.2 | |
run: php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --verbose --diff --dry-run --stop-on-violation --using-cache=no | |
- name: Static analysis | |
run: php vendor/bin/phpstan analyse --configuration=phpstan.neon --verbose | |
- name: Tests | |
if: matrix.php-versions == 8.2 | |
run: php bin/phpunit |