PSAPC-239 AuthorizeWithCapture setting support modification, two step… #649
Workflow file for this run
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: Development | |
on: [ push, pull_request ] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PACKAGE_NAME: 'oxid-esales/amazon-pay-module' | |
MODULE_PATH: 'osc/amazonpay' | |
SONARCLOUD_ORGANIZATION: 'oxid-esales' | |
SONARCLOUD_PROJECT_KEY: 'OXID-eSales_amazon-pay-module' | |
jobs: | |
install_shop_with_module: | |
strategy: | |
matrix: | |
php: [ '7.0' ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone testing environment v4.0.0 | |
run: git clone https://github.com/OXID-eSales/docker-eshop-sdk.git . | |
- name: Clone the shop | |
run: git clone --depth 1 https://github.com/OXID-eSales/oxideshop_ce.git --branch b-6.1.x --single-branch source | |
- name: Cache current installation | |
uses: actions/cache@v3 | |
with: | |
path: | | |
./* | |
key: development-${{ matrix.php }}-${{ github.run_number }}-${{ github.run_attempt }} | |
- name: Prepare container configuration | |
run: | | |
make setup | |
make addbasicservices | |
make file=services/selenium-chrome.yml addservice | |
perl -pi\ | |
-e "s#PHP_VERSION=.*#PHP_VERSION='${{ matrix.php }}'#g;"\ | |
.env | |
perl -pi\ | |
-e 's#display_errors =.*#display_errors = false#g;'\ | |
-e 'print "xdebug.max_nesting_level=1000\nxdebug.mode=coverage\n\n"'\ | |
containers/php/custom.ini | |
perl -pi\ | |
-e 's#/var/www/#/var/www/source/#g;'\ | |
containers/httpd/project.conf | |
- name: Prepare shop configuration | |
run: | | |
cp source/source/config.inc.php.dist source/source/config.inc.php | |
sed -i "1s+^+SetEnvIf Authorization "\(.*\)" HTTP_AUTHORIZATION=\$1\n\n+" source/source/.htaccess | |
sed -i -e 's/<dbHost>/mysql/'\ | |
-e 's/<dbUser>/root/'\ | |
-e 's/<dbName>/example/'\ | |
-e 's/<dbPwd>/root/'\ | |
-e 's/<dbPort>/3306/'\ | |
-e 's/<sShopURL>/https:\/\/localhost.local\//'\ | |
-e 's/<sSSLShopURL>/https:\/\/localhost.local\//'\ | |
-e 's/<sShopDir>/\/var\/www\/source\//'\ | |
-e 's/<sCompileDir>/\/var\/www\/source\/tmp\//'\ | |
source/source/config.inc.php | |
- name: Start containers | |
run: | | |
make up | |
sleep 2 | |
- name: Downgrade composer1 to Version 1 | |
run: | | |
docker-compose exec -T php sudo php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" | |
docker-compose exec -T php sudo php composer-setup.php --install-dir=/usr/bin --filename=composer1 --1 | |
- name: Checkout current module | |
uses: actions/checkout@v4 | |
with: | |
path: source/test-module | |
- name: Install module | |
run: | | |
docker-compose exec -T \ | |
php composer1 config repositories.${{ env.PACKAGE_NAME }} \ | |
'{"type":"path", "url":"./test-module", "options": {"symlink": true}}' | |
docker-compose exec -T \ | |
php composer1 config repositories.${{ env.PACKAGE_NAME }} \ | |
'{"type":"path", "url":"./test-module", "options": {"symlink": true}}' | |
docker-compose exec -T \ | |
php composer1 require ${{ env.PACKAGE_NAME }}:* --no-interaction --no-update | |
- name: Install dependencies and reset shop | |
run: | | |
docker-compose exec -T php composer1 require vlucas/phpdotenv --no-update --no-interaction --dev | |
docker-compose exec -T php composer1 update --no-interaction | |
docker-compose exec -T php php vendor/bin/reset-shop | |
- name: Put module settings | |
continue-on-error: true | |
run: | | |
mkdir -p source/var/configuration/environment/ | |
echo "${{ secrets.MODULE_SETTINGS }}" > source/var/configuration/environment/1.yaml | |
- name: Show docker log | |
if: always() | |
run: | | |
docker-compose logs | |
- name: Create .env-file | |
continue-on-error: true | |
working-directory: source/test-module/tests | |
run: | | |
cat <<EOT > .env | |
${{ secrets.DOTENV }} | |
EOT | |
- name: Stop containers | |
if: always() | |
run: | | |
docker-compose down | |
sleep 2 | |
- name: Upload configuration artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Configs-${{ matrix.php }} | |
path: | | |
docker-compose.yml | |
source/composer.json | |
source/composer.lock | |
source/config.inc.php | |
data/php/logs/error_log.txt | |
source/test-module/tests/.env | |
unit_tests: | |
strategy: | |
fail-fast: false | |
matrix: | |
php: [ '7.0' ] | |
needs: [ install_shop_with_module ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Load current installation from cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
./* | |
key: development-${{ matrix.php }}-${{ github.run_number }}-${{ github.run_attempt }} | |
restore-keys: | | |
development-${{ matrix.php }}-${{ github.run_number }}-${{ github.run_attempt }} | |
- name: Start containers | |
run: | | |
make up | |
sleep 2 | |
- name: Run tests | |
run: | | |
docker-compose exec -T \ | |
-e PARTIAL_MODULE_PATHS=${{ env.MODULE_PATH }} \ | |
-e ACTIVATE_ALL_MODULES=1 \ | |
-e RUN_TESTS_FOR_SHOP=0 \ | |
-e RUN_TESTS_FOR_MODULES=0 \ | |
-e XDEBUG_MODE=coverage \ | |
-e ADDITIONAL_TEST_PATHS='/var/www/vendor/${{ env.PACKAGE_NAME }}/tests' \ | |
php php vendor/bin/runtests \ | |
--coverage-clover=/var/www/coverage.xml \ | |
--coverage-text \ | |
--log-junit=/var/www/phpunit.xml \ | |
AllTestsUnit | |
- name: Stop containers | |
if: always() | |
run: | | |
docker-compose down | |
sleep 2 | |
- name: Upload log artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: TestsLog-${{ matrix.php }} | |
path: | | |
source/coverage.xml | |
source/phpunit.xml | |
styles: | |
strategy: | |
matrix: | |
php: [ '7.0' ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current module | |
uses: actions/checkout@v4 | |
with: | |
path: source/test-module | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: xdebug | |
extensions: gd, zip | |
- name: Downgrade composer1 to Version 1 | |
run: | | |
composer self-update --1 | |
- name: Install module dependencies | |
id: dependencies | |
working-directory: source/test-module | |
run: composer install | |
- name: Run phpcs | |
id: phpcs | |
if: always() | |
working-directory: source/test-module | |
run: composer phpcs | |
- name: Run phpmd | |
id: phpmd | |
if: always() | |
working-directory: source/test-module | |
run: composer phpmd-report || composer phpmd | |
- name: Upload log artifact | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: StylesLog-${{ matrix.php }} | |
path: | | |
source/test-module/tests/reports/phpmd.report.json | |
sonarcloud: | |
needs: [ styles, unit_tests ] | |
if: always() | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout current module | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Download unit_tests artifacts | |
continue-on-error: true | |
uses: actions/download-artifact@v3 | |
with: | |
name: TestsLog-7.0 | |
path: ./tests/reports/ | |
- name: Download styles artifacts | |
continue-on-error: true | |
uses: actions/download-artifact@v3 | |
with: | |
name: StylesLog-7.0 | |
path: ./tests/reports/ | |
- name: Fix paths in unit logs | |
continue-on-error: true | |
run: | | |
sed -i 's+/var/www/test-module/++' tests/reports/coverage.xml | |
sed -i 's+/var/www/test-module/++' tests/reports/phpunit.xml | |
- name: Fix paths in styles logs | |
continue-on-error: true | |
run: | | |
sed -i 's+\/home\/runner\/work\/.*?\/.*?\/source\/test-module\/++' tests/phpmd.report.json | |
- name: SonarCloud Scan | |
uses: sonarsource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
with: | |
args: > | |
-Dsonar.organization=${{ env.SONARCLOUD_ORGANIZATION }} | |
-Dsonar.projectKey=${{ env.SONARCLOUD_PROJECT_KEY }} | |
-Dsonar.sources=src | |
-Dsonar.tests=tests | |
-Dsonar.sourceEncoding=UTF-8 | |
-Dsonar.php.coverage.reportPaths=tests/reports/coverage.xml | |
-Dsonar.php.phpmd.reportPaths=tests/reports/phpmd.report.json | |
-Dsonar.cpd.php.minimumTokens=25 | |
-Dsonar.cpd.php.minimumLines=5 |