Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BRAIN-43 - Implemented integration workflow #143

Draft
wants to merge 7 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
KERNEL_CLASS='Swag\Braintree\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999

###> braintree/gateway ###
BRAINTREE_TEST_MERCHANT_ACCOUNT_ID='your_merchant_account_id'
BRAINTREE_TEST_ENVIRONMENT='sandbox'
BRAINTREE_TEST_MERCHANT_ID='your_merchant_id'
BRAINTREE_TEST_PUBLIC_KEY='your_public_key'
BRAINTREE_TEST_PRIVATE_KEY='your_private_key'
###< braintree/gateway ###
27 changes: 14 additions & 13 deletions .github/workflows/app-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@ on:
workflow_dispatch:

jobs:
zip:
uses: shopware/github-actions/.github/workflows/build-zip.yml@main
with:
extensionName: SwagBraintreeApp

release:
uses: shopware/github-actions/.github/workflows/store-release.yml@main
with:
extensionName: SwagBraintreeApp
publishOnly: true
secrets:
accountUser: ${{ secrets.SHOPWARE_ACCOUNT_USER }}
accountPassword: ${{ secrets.SHOPWARE_ACCOUNT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-php
- name: Generate manifest.xml
run: composer setup:manifest -- -f --env=prod
- uses: shopware/github-actions/store-release@main
with:
extensionName: SwagBraintreeApp
publishOnly: 'true'
skipCheckout: 'true'
accountUser: ${{ secrets.SHOPWARE_ACCOUNT_USER }}
accountPassword: ${{ secrets.SHOPWARE_ACCOUNT_PASSWORD }}
ghToken: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/app-zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: App Zip
on:
workflow_dispatch:
pull_request:
paths:
- 'Resources/**/*'
- 'templates/manifest.xml.twig'
- '.shopware-extension.yml'
- .github/workflows/app-zip.yml

jobs:
zip:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-php
- name: Generate manifest.xml
run: composer setup:manifest -- -f --env=prod
- uses: shopware/github-actions/build-zip@main
with:
extensionName: SwagBraintreeApp
skipCheckout: 'true'
70 changes: 67 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,87 @@ jobs:
- name: Run PHPStan
run: composer phpstan

phpunit:
phpunit-unit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-php
- name: Run PHPUnit
run: composer phpunit -- --coverage-clover=coverage.xml
run: composer phpunit:unit -- --coverage-clover=coverage.xml
- name: Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml

phpunit-integration:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.5
env:
MARIADB_ROOT_PASSWORD: swagbraintree
MYSQL_DATABASE: swagbraintree_test
ports: ['3306:3306']
env:
DATABASE_URL: mysql://root:[email protected]:3306/swagbraintree
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-php
- name: Setup database
run: composer setup:test
- name: Run PHPUnit
run: composer phpunit:integration -- --coverage-clover=coverage.xml
- name: Codecov
uses: codecov/codecov-action@v5
with:
files: ./coverage.xml

phpunit-application:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.5
env:
MARIADB_ROOT_PASSWORD: swagbraintree
MYSQL_DATABASE: swagbraintree_test
ports: [ '3306:3306' ]
env:
DATABASE_URL: mysql://root:[email protected]:3306/swagbraintree
BRAINTREE_TEST_ENVIRONMENT: sandbox
BRAINTREE_TEST_MERCHANT_ID: ${{ secrets.BRAINTREE_TEST_MERCHANT_ID }}
BRAINTREE_TEST_MERCHANT_ACCOUNT_ID: ${{ secrets.BRAINTREE_TEST_MERCHANT_ACCOUNT_ID }}
BRAINTREE_TEST_PUBLIC_KEY: ${{ secrets.BRAINTREE_TEST_PUBLIC_KEY }}
BRAINTREE_TEST_PRIVATE_KEY: ${{ secrets.BRAINTREE_TEST_PRIVATE_KEY }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-php
- name: Setup database
run: composer setup:test
- name: Run PHPUnit
continue-on-error: true
run: composer phpunit:application -- --coverage-clover=coverage.xml
- name: Codecov
if: steps.phpunit-application.outcome == 'success' && steps.phpunit-application.conclusion == 'success'
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml

infection:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:10.5
env:
MARIADB_ROOT_PASSWORD: swagbraintree
MYSQL_DATABASE: swagbraintree_test
ports: ['3306:3306']
env:
DATABASE_URL: mysql://root:[email protected]:3306/swagbraintree
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-php
- name: Setup database
run: composer setup:test
- name: Run Infection
run: composer infection -- --min-msi=95
env:
Expand All @@ -87,4 +151,4 @@ jobs:
run: bin/console doctrine:migrations:migrate --no-interaction

- name: Validate doctrine schema
run: bin/console doctrine:schema:validate --verbose
run: bin/console doctrine:schema:validate --verbose
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ public/build
###< vite ###

Resources/app/storefront/dist
manifest.xml
19 changes: 16 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"ext-simplexml": "*",
"braintree/braintree_php": "^6.19",
"doctrine/doctrine-bundle": "^2.10",
"doctrine/doctrine-migrations-bundle": "^3.2",
Expand Down Expand Up @@ -47,7 +49,8 @@
"autoload-dev": {
"psr-4": {
"Swag\\Braintree\\Tests\\Unit\\": "tests/unit/",
"Swag\\Braintree\\Tests\\Integration\\": "tests/integration/"
"Swag\\Braintree\\Tests\\Integration\\": "tests/integration/",
"Swag\\Braintree\\Tests\\Application\\": "tests/application/"
}
},
"replace": {
Expand Down Expand Up @@ -80,12 +83,21 @@
"setup": [
"bin/console doctrine:schema:drop --force --full-database",
"bin/console doctrine:migrations:migrate -n",
"@setup:url"
"@setup:url",
"@setup:manifest"
],
"setup:url": [
"bin/console setup:url",
"npm run dev"
]
],
"setup:manifest": "bin/console manifest:generate",
"setup:test": [
"bin/console doctrine:schema:drop --env=test --force --full-database",
"bin/console doctrine:migrations:migrate --env=test -n"
],
"phpunit:unit": "@phpunit --testsuite=SwagBraintreeUnitTest",
"phpunit:integration": "@phpunit --testsuite=SwagBraintreeIntegrationTest",
"phpunit:application": "@phpunit --testsuite=SwagBraintreeApplicationTest"
},
"conflict": {
"symfony/symfony": "*"
Expand All @@ -97,6 +109,7 @@
}
},
"require-dev": {
"dama/doctrine-test-bundle": "^8.2",
"friendsofphp/php-cs-fixer": "^3.63",
"infection/infection": "^0.29.6",
"kubawerlos/php-cs-fixer-custom-fixers": "^3.16",
Expand Down
Loading
Loading