Skip to content

GitHub actions

GitHub actions #16

Workflow file for this run

name: PHP
on:
pull_request:
paths:
- '**/*.php'
- .github/workflows/php.yml
push:
paths:
- '**/*.php'
branches:
- trunk
workflow_dispatch:
schedule:
- cron: '0 3 * * *'
env:
SHOPWARE_TOOL_CACHE_PHPSTAN: ${{ github.workspace }}/var/phpstan
jobs:
cs:
if: github.event_name != 'schedule'
uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main
# phpstan:
# uses: shopware/github-actions/.github/workflows/phpstan.yml@main
# with:
# extensionName: SwagPayPal
# shopwareVersion: trunk
phpstan:
runs-on: ubuntu-latest
steps:
- name: Setup Shopware
uses: FriendsOfShopware/setup-shopware@main
with:
shopware-version: ${{ inputs.shopwareVersion }}
php-version: 8.2
env: prod
install: 'true'
- name: Clone Extension
uses: actions/checkout@v4
with:
path: custom/plugins/SwagPayPal
- name: Clone SwagCmsExtensions
run: git clone "https://shopware:[email protected]/shopware/6/services/cms-extensions.git" custom/plugins/SwagCmsExtensions
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
- name: Install SwagCmsExtensions with Composer
run: composer require $(composer -d custom/plugins/SwagCmsExtensions config name)
- name: Install SwagPayPal with Composer
run: composer require $(composer -d custom/plugins/SwagPayPal config name)
- name: Create phpstan.neon
working-directory: custom/plugins/SwagPayPal
run: |
printf "parameters:\n tmpDir: ${{ env.SHOPWARE_TOOL_CACHE_PHPSTAN }}\nincludes:\n - phpstan.neon.dist" > phpstan.neon
- name: PHPStan cache
uses: actions/cache@v3
with:
path: ${{ env.SHOPWARE_TOOL_CACHE_PHPSTAN }}
key: ${{ runner.OS }}-${{ github.repository }}-phpstan-${{ github.sha }}
restore-keys: |
${{ runner.OS }}-${{ github.repository }}-phpstan-
- name: Refresh
run: bin/console plugin:refresh
- name: Install Extension
run: bin/console plugin:install --activate SwagCmsExtensions
- name: Install Extension
run: bin/console plugin:install --activate SwagPayPal
- name: Build PHPStan Bootstrap
run: php ${{ github.workspace }}/src/Core/DevOps/StaticAnalyze/phpstan-bootstrap.php
- name: Run PHPStan
working-directory: custom/plugins/SwagPayPal
run: ${{ github.workspace }}/vendor/bin/phpstan analyze --error-format=github --no-progress
phpunit:
runs-on: ubuntu-latest
steps:
- name: Setup Shopware
uses: FriendsOfShopware/setup-shopware@main
with:
shopware-version: trunk
php-version: 8.2
php-extensions: pcov
- name: Clone SwagCmsExtensions
run: git clone "https://shopware:[email protected]/shopware/6/services/cms-extensions.git" custom/plugins/SwagCmsExtensions
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
- name: Run PHPUnit
working-directory: custom/plugins/SwagPayPal
run: ${{ github.workspace }}/vendor/bin/phpunit --coverage-clover clover.xml