Skip to content

Commit

Permalink
PO-489 - Add Github actions
Browse files Browse the repository at this point in the history
TEMP - Allow every job
  • Loading branch information
mkraeml committed Nov 28, 2024
1 parent 491c268 commit 7538b42
Show file tree
Hide file tree
Showing 6 changed files with 317 additions and 1 deletion.
100 changes: 100 additions & 0 deletions .github/actions/setup-paypal/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-action.json

name: Setup SwagPayPal
description: "Setup steps for SwagPayPal"
author: "shopware AG"
branding:
color: "blue"
icon: "download"

inputs:
install-admin:
default: "false"
required: false
description: "Should we install the Administration of shopware"
install-commercial:
default: "false"
required: false
description: "Should we install SwagCommercial"
install-storefront:
default: "false"
required: false
description: "Should we install the Storefront of shopware"
mysql-version:
default: "builtin"
required: false
description: "Which MySQL version should be used"
php-version:
default: "8.2"
required: false
description: "Which PHP version should be used"
shopware-version:
default: "6.5.x"
required: false
description: "Which version/branch of shopware should be used"

runs:
using: composite
steps:
- uses: octo-sts/action@main
id: octo-sts
with:
scope: shopware
identity: ${{ github.event.repository.name }}
- name: Prepare dependency list
id: dependency-list
shell: bash
run: |
DEPS='[
{
"name":"SwagCmsExtensions",
"repo": "https://github.com/shopware/SwagCmsExtensions.git",
"branch": "6.5.x",
"token": "${{ steps.octo-sts.outputs.token }}"
}
]'
REPOS='{
"${{ github.event.repository.name }}": {
"type": "path",
"url": "custom/plugins/${{ github.event.repository.name }}",
"symlink": true
},
"SwagCmsExtensions": {
"type": "path",
"url": "custom/plugins/SwagCmsExtensions",
"symlink": true
}
}'
if [[ "${{ inputs.install-commercial }}" == "true" ]]; then
DEPS=$(jq -s 'add' <(echo $DEPS) <(echo '[
{
"name":"SwagCommercial",
"repo": "https://github.com/shopware/SwagCommercial.git",
"branch": "${{ inputs.shopware-version }}",
"token": "${{ steps.octo-sts.outputs.token }}"
}]'))
REPOS=$(jq -s 'add' <(echo $REPOS) <(echo '{
"SwagCommercial": {
"type": "path",
"url": "custom/plugins/SwagCommercial",
"symlink": true
}
}'))
fi
echo "deps=$(echo $DEPS | jq -c .)" >> "$GITHUB_OUTPUT"
echo "repos=$(echo $REPOS | jq -c .)" >> "$GITHUB_OUTPUT"
- uses: shopware/github-actions/setup-extension@main
with:
extensionName: ${{ github.event.repository.name }}
mysqlVersion: ${{ inputs.mysql-version }}
shopwareVersion: ${{ inputs.shopware-version }}
phpVersion: ${{ inputs.php-version }}
node-version: 18.x
npm-version: 9
install: true
install-admin: ${{ inputs.install-admin }}
install-storefront: ${{ inputs.install-storefront }}
dependencies: ${{ steps.dependency-list.outputs.deps }}
extraRepositories: ${{ steps.dependency-list.outputs.repos }}
43 changes: 43 additions & 0 deletions .github/workflows/admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Admin
on:
push:
branches:
- 6.5.x
pull_request:
# paths:
## - src/Resources/app/administration/**/*
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- name: Checkout SwagPayPal
uses: actions/checkout@v4
with:
path: custom/plugins/${{ github.event.repository.name }}
- name: Setup SwagPayPal
uses: ./custom/plugins/SwagPayPal/.github/actions/setup-paypal
with:
install-commercial: true
install-admin: true
- name: Prepare ESLint
run: |
bin/console bundle:dump
composer admin:generate-entity-schema-types
- name: Run ESLint
env:
ADMIN_PATH: ${{ github.workspace }}/src/Administration/Resources/app/administration
working-directory: custom/plugins/${{ github.event.repository.name }}
run: |
composer run init:admin
composer run lint:admin:ci
jest:
uses: shopware/github-actions/.github/workflows/admin-jest.yml@main
with:
extensionName: ${{ github.event.repository.name }}
uploadCoverage: false
58 changes: 58 additions & 0 deletions .github/workflows/intergration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Integration
on:
push:
branches:
- 6.5.x
pull_request:
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
build_zip:
name: Build and validate zip
uses: shopware/github-actions/.github/workflows/build-zip.yml@main
with:
extensionName: ${{ github.event.repository.name }}

phpunit:
runs-on: ubuntu-latest
strategy:
matrix:
MYSQL_IMAGE: ["mysql:8.0", "mariadb:10.3", "mariadb:10.5"]
PLATFORM_BRANCH: ["v6.5.5.1", "6.5.x"]
PHP_VERSION: ["8.1", "8.2"]
WITH_COMMERCIAL: [true, false]
env:
REDIS_URL: redis://localhost:6379
services:
redis:
image: redis:alpine
ports:
- "6379:6379"
steps:
- name: Checkout SwagPayPal
uses: actions/checkout@v4
with:
path: custom/plugins/${{ github.event.repository.name }}
- name: Setup SwagPayPal
uses: ./custom/plugins/SwagPayPal/.github/actions/setup-paypal
with:
install-commercial: ${{ matrix.WITH_COMMERCIAL }}
install-admin: true
install-storefront: true
mysql-version: ${{ matrix.MYSQL_IMAGE }}
php-version: ${{ matrix.PHP_VERSION }}
shopware-version: ${{ matrix.PLATFORM_BRANCH }}
- name: Run PHPUnit
working-directory: custom/plugins/${{ github.event.repository.name }}
run: |
composer dump-autoload --dev
php -d pcov.enabled=1 -d pcov.directory=$PWD/src -d pcov.exclude='~(vendor|tests|node_modules)~' \
${GITHUB_WORKSPACE}/vendor/bin/phpunit \
--configuration phpunit.xml.dist \
--log-junit ${GITHUB_WORKSPACE}/phpunit.junit.xml \
--coverage-cobertura ${GITHUB_WORKSPACE}/cobertura.xml \
--coverage-text
81 changes: 81 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: PHP checks

on:
push:
branches:
- 6.5.x
pull_request:
# paths:
# - bin/*.php
# - src/**/*.php
# - tests/**/*.php
# - rector.php
# - composer.json
workflow_dispatch:
workflow_call:

permissions:
contents: read
id-token: write

jobs:
phpstan:
runs-on: ubuntu-latest
strategy:
matrix:
PLATFORM_BRANCH: ["v6.5.5.1", "6.5.x"]
fail-fast: false
steps:
- name: Checkout SwagPayPal
uses: actions/checkout@v4
with:
path: custom/plugins/${{ github.event.repository.name }}
- name: Setup SwagPayPal
uses: ./custom/plugins/SwagPayPal/.github/actions/setup-paypal
with:
install-commercial: true
install-admin: true
install-storefront: true
shopware-version: ${{ matrix.PLATFORM_BRANCH }}
- name: Prepare phpstan
working-directory: custom/plugins/${{ github.event.repository.name }}
run: |
composer dump-autoload --dev -d "${GITHUB_WORKSPACE}/custom/plugins/SwagCmsExtensions"
composer dump-autoload --dev -d "${GITHUB_WORKSPACE}/custom/plugins/SwagCommercial"
sed -i 's|reportUnmatchedIgnoredErrors: true|reportUnmatchedIgnoredErrors: false|' ./phpstan.neon.dist
if [[ "${{ matrix.PLATFORM_BRANCH }}" == "v6.6.0.0" ]]; then
sed -i '/type_perfect/d' ./phpstan.neon.dist
sed -i '/narrow_return: true/d' ./phpstan.neon.dist
sed -i '/no_mixed: true/d' ./phpstan.neon.dist
sed -i '/null_over_false: true/d' ./phpstan.neon.dist
fi
- run: |
symfony composer -d custom/plugins/${{ github.event.repository.name }} run phpstan
validate-openapi-typescript:
runs-on: ubuntu-latest
steps:
- name: Setup Extension
uses: shopware/github-actions/setup-extension@main
env:
runner: ${{ runner.environment }}
with:
extensionName: ${{ github.event.repository.name }}
install: true
install-admin: true
install-storefront: true
extraRepositories: |
{
"${{ github.event.repository.name }}": {
"type": "path",
"url": "custom/plugins/${{ github.event.repository.name }}",
"symlink": true
}
}
- working-directory: custom/plugins/${{ github.event.repository.name }}
run: |
${GITHUB_WORKSPACE}/bin/console bundle:dump
composer init:admin
composer openapi:generate
git update-index --refresh || printf ''
git diff-index "${{ github.sha }}" --quiet -- src/Resources/app/administration/src/types/openapi.d.ts || (echo "Please run 'composer openapi:generate' to update openapi.d.ts" && exit 1)
34 changes: 34 additions & 0 deletions .github/workflows/storefront.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Storefront
on:
push:
branches:
- 6.5.x
pull_request:
# paths:
# - src/Resources/app/storefront/**/*
workflow_dispatch:

permissions:
contents: read
id-token: write

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- name: Checkout SwagPayPal
uses: actions/checkout@v4
with:
path: custom/plugins/${{ github.event.repository.name }}
- name: Setup SwagPayPal
uses: ./custom/plugins/SwagPayPal/.github/actions/setup-paypal
with:
install-commercial: true
install-storefront: true
- name: Run ESLint
env:
STOREFRONT_PATH: ${{ github.workspace }}/src/Storefront/Resources/app/storefront
working-directory: custom/plugins/${{ github.event.repository.name }}
run: |
composer init:storefront
composer lint:storefront
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"ecs-fix": "../../../vendor/bin/ecs check --fix",
"init:admin": "npm ci --no-audit --prefer-offline --prefix src/Resources/app/administration",
"lint:admin": "npm run lint-fix --prefix src/Resources/app/administration",
"lint:admin:ci": "npm run lint-ci --prefix src/Resources/app/administration",
"lint:admin:ci": "npm run lint --prefix src/Resources/app/administration",
"init:storefront": "npm ci --no-audit --prefer-offline --prefix src/Resources/app/storefront",
"lint:storefront": [
"cd src/Resources/app/storefront && ../../../../../../../src/Storefront/Resources/app/storefront/node_modules/.bin/eslint --config ../../../../../../../src/Storefront/Resources/app/storefront/.eslintrc.js --fix ./src",
Expand Down

0 comments on commit 7538b42

Please sign in to comment.