GitHub actions #15
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: 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:$GITLAB_TOKEN@gitlab.shopware.com/shopware/6/services/cms-extensions.git" custom/plugins/SwagCmsExtensions | |
env: | |
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }} | |
- 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:$GITLAB_TOKEN@gitlab.shopware.com/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 | |