Skip to content

Response code can possibly be 202 #948

Response code can possibly be 202

Response code can possibly be 202 #948

Workflow file for this run

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: 'extensions/amazonpay'
SONARCLOUD_ORGANIZATION: 'oxid-esales'
SONARCLOUD_PROJECT_KEY: 'OXID-eSales_amazon-pay-module'
jobs:
install_shop_with_module:
strategy:
matrix:
php: [ '8.0' ]
mysql: [ '5.7' ]
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-7.0.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
- name: Start containers
run: |
make up
sleep 2
- name: Checkout current module
uses: actions/checkout@v4
with:
path: source/test-module
- name: Install module
run: |
git clone https://github.com/OXID-eSales/amazon-pay-module.git --branch=${{ github.ref_name }} source/extensions/amazonpay
docker compose exec -T \
php composer config repositories.oxid-esales/amazon-pay-module \
--json '{"type":"path", "url":"./extensions/amazonpay", "options": {"symlink": true}}'
docker compose exec -T php composer require oxid-esales/amazon-pay-module:dev-${{ github.ref_name }} --no-update
- 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: Install dependencies and reset shop
run: |
docker-compose exec -T php composer require vlucas/phpdotenv:^v5.6.0 --no-update --no-interaction --dev
- name: Install Testing Library
run: |
docker compose exec -T php composer require oxid-esales/tests-deprecated-ce:dev-b-7.0.x --with-all-dependencies --no-update
- name: Install Apex Theme
run: |
docker-compose exec -T php composer require oxid-esales/apex-theme:dev-b-7.0.x --with-all-dependencies --no-update
docker compose exec -T php composer require oxid-esales/oxideshop-demodata-ce:dev-b-7.0.x --no-update
docker-compose exec -T php composer update --no-interaction
- name: Copy config file
run: |
cp source/vendor/oxid-esales/testing-library/test_config.yml.dist source/test_config.yml
perl -pi\
-e 's#partial_module_paths: null#partial_module_paths: {{ $env.MODULE_PATH }}#g;' \
-e 's#activate_all_modules: false#activate_all_modules: true#g;' \
-e 's#run_tests_for_shop: true#run_tests_for_shop: false#g;' \
-e 's#additional_test_paths: '\''vendor/oxid-esales/oxideshop-ee/Tests,vendor/oxid-esales/oxideshop-pe/Tests'\''#additional_test_paths: /var/www/vendor/oxid-solution-catalysts/amazon-pay-module/tests#g;'\
source/test_config.yml
cp source/extensions/amazonpay/tests/.env.example source/extensions/amazonpay/tests/.env
- name: Setup Shop and demodata
run: |
docker-compose exec -T php bin/oe-console oe:setup:shop \
--db-host mysql \
--db-port 3306 \
--db-name example \
--db-user root \
--db-password root \
--shop-url http://localhost.local \
--shop-directory /var/www/source \
--compile-directory /var/www/source/tmp
- name: Install Apex Theme
run: |
docker-compose exec -T php bin/oe-console oe:theme:activate apex
- name: Activate Amazon Pay Module
run: |
docker compose exec -T php bin/oe-console oe:module:activate osc_amazonpay
docker compose exec -T php bin/oe-console oe:cache:clear
- 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: [ '8.0' ]
mysql: [ '5.7' ]
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 XDEBUG_MODE=coverage \
php vendor/bin/phpunit \
-c /var/www/vendor/oxid-esales/amazon-pay-module/tests/phpunit.xml \
--testsuite=Integration \
--bootstrap=/var/www/source/bootstrap.php \
/var/www/vendor/oxid-esales/amazon-pay-module/tests | tee integration_PHP${{ matrix.php }}_MYSQL${{ matrix.mysql }}_phpunit_log.txt 2>&1 || true
if grep -q -Ei 'fail|\\.\\=\\=|Warning|Notice|Deprecated|Fatal|Error' integration_PHP${{ matrix.php }}_MYSQL${{ matrix.mysql }}_phpunit_log.txt; then
exit 1;
fi
- name: Ensure that tests have been run
run: if [ ! -s integration_PHP${{ matrix.php }}_MYSQL${{ matrix.mysql }}_phpunit_log.txt ]; then echo "PHPUnit log file is empty! Seems like no tests have been run!" && exit 1; fi
- name: Stop containers
if: always()
run: |
docker-compose down
sleep 2
- name: Upload log artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: ModuleIntegrationTestsLog-${{ inputs.php }}-${{ inputs.mysql }}-${{ inputs.template_engine }}
if-no-files-found: error
retention-days: 7
path: |
source/integration.cov
source/source/log/oxideshop.log
data/php/logs/error_log.txt
integration_PHP${{ matrix.php }}_MYSQL${{ matrix.mysql }}_phpunit_log.txt
codeception_tests:
strategy:
fail-fast: false
matrix:
php: [ '8.0' ]
mysql: [ '5.7' ]
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 SELENIUM_SERVER_HOST=selenium \
-e BROWSER_NAME=chrome \
-e THEME_ID=apex \
-e MODULE_IDS=0 \
php vendor/bin/codecept run acceptance \
-c /var/www/extensions/amazonpay/tests/codeception.yml \
--bootstrap tests/bootstrap.php \
-g amazonpay || true
if grep -q -Ei 'fail|\\.\\=\\=|Warning|Notice|Deprecated|Fatal|Error' codecept_PHP${{ matrix.php }}_MYSQL${{ matrix.mysql }}_log.txt; then
exit 1;
fi
- name: Ensure that tests have been run
run: if [ ! -s codecept_PHP${{ matrix.php }}_MYSQL${{ matrix.mysql }}_log.txt ]; then echo "PHPUnit log file is empty! Seems like no tests have been run!" && exit 1; fi
- name: Stop containers
if: always()
run: |
docker-compose down
sleep 2
- name: Upload log artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: ModuleIntegrationTestsLog-${{ inputs.php }}-${{ inputs.mysql }}-${{ inputs.template_engine }}
if-no-files-found: error
retention-days: 7
path: |
source/integration.cov
source/source/log/oxideshop.log
data/php/logs/error_log.txt
codecept_PHP${{ matrix.php }}_MYSQL${{ matrix.mysql }}_log.txt
styles:
strategy:
matrix:
php: [ '8.0' ]
runs-on: ubuntu-latest
steps:
- name: Checkout current module
uses: actions/checkout@v4
with:
path: ${{ env.MODULE_PATH }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug
extensions: gd, zip
- name: Install module dependencies
id: dependencies
working-directory: ${{ env.MODULE_PATH }}
run: composer install
- name: Run phpcs
id: phpcs
if: always()
working-directory: ${{ env.MODULE_PATH }}
run: composer phpcs
- name: Run phpmd
id: phpmd
if: always()
working-directory: ${{ env.MODULE_PATH }}
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