From 1c531d6c05e9e53d07b7239489fb12067a7be913 Mon Sep 17 00:00:00 2001 From: daichi_otani Date: Tue, 12 Dec 2023 11:05:12 +0900 Subject: [PATCH] =?UTF-8?q?add:=E5=89=8A=E9=99=A4=E3=81=97=E3=81=9F?= =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=92=E5=BE=A9=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/coverage.yml | 236 +++++++++ .github/workflows/deny-test.yml | 126 +++++ .github/workflows/deploy.yml | 139 +++++ .github/workflows/dockerbuild.yml | 145 ++++++ .github/workflows/e2e-test-throttling.yml | 154 ++++++ .github/workflows/e2e-test.yml | 159 ++++++ .github/workflows/penetration-test.yml | 87 ++++ .github/workflows/phpstan.yml | 35 ++ .github/workflows/plugin-test.yml | 596 ++++++++++++++++++++++ .github/workflows/unit-test.yml | 122 +++++ .github/workflows/vaddy-1.yml | 498 ++++++++++++++++++ .github/workflows/vaddy-2.yml | 499 ++++++++++++++++++ 12 files changed, 2796 insertions(+) create mode 100644 .github/workflows/coverage.yml create mode 100644 .github/workflows/deny-test.yml create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/dockerbuild.yml create mode 100644 .github/workflows/e2e-test-throttling.yml create mode 100644 .github/workflows/e2e-test.yml create mode 100644 .github/workflows/penetration-test.yml create mode 100644 .github/workflows/phpstan.yml create mode 100644 .github/workflows/plugin-test.yml create mode 100644 .github/workflows/unit-test.yml create mode 100644 .github/workflows/vaddy-1.yml create mode 100644 .github/workflows/vaddy-2.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000000..ce5b14fc62f --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,236 @@ +name: Coverage +on: + push: + branches: + - '*' + tags: + - '*' + paths: + - '**' + - '!*.md' + pull_request: + paths: + - '**' + - '!*.md' +jobs: + phpunit: + name: PHPUnit + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + php: [ 8.1 ] + db: [ pgsql ] + include: + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Setup pcov + run: | + sudo apt-fast install -y php8.1-pcov + sudo phpenmod -s cli pcov + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: Setup EC-CUBE + env: + APP_ENV: 'test' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + run: | + bin/console doctrine:database:create + bin/console doctrine:schema:create + bin/console eccube:fixtures:load + + - name: PHPUnit + env: + APP_ENV: 'test' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_URL: 'smtp://127.0.0.1:1025' + continue-on-error: true + run: php -dpcov.enabled=1 vendor/bin/phpunit --exclude-group cache-clear,cache-clear-install,update-schema-doctrine --coverage-clover=coverage1.xml + - name: Upload report + if: success() + uses: actions/upload-artifact@v2 + with: + name: phpunit-reports + path: coverage1.xml + codeception: + name: Codeception + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + php: [ 8.1 ] + db: [ pgsql ] + group: [ admin01, admin02, admin03, front, installer ] + include: + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + - group: admin01 + app_env: 'codeception' + - group: admin02 + app_env: 'codeception' + - group: admin03 + app_env: 'codeception' + - group: front + app_env: 'codeception' + - group: installer + app_env: 'install' + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: Setup to EC-CUBE + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + run: | + echo "APP_ENV=${APP_ENV}" > .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Run chromedriver + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + + - name: Run package-api + run: | + if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi + docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2 + cp codeception/_data/plugins/*-1.0.0.tgz repos + + - name: Setup pcov + run: | + sudo apt-fast install -y php8.1-pcov + sudo phpenmod -s cli pcov + + - name: Setup codeception + run: | + composer config --no-plugins allow-plugins.codeception/c3 true + composer require --dev codeception/c3 "2.*" + sed -i "7a include __DIR__.'/c3.php';" index.php + + - name: Start PHP Development Server + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_URL: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + run: php -S 127.0.0.1:8000 & + + - name: Codeception + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_URL: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + GROUP: ${{ matrix.group }} + SYMFONY_DEPRECATIONS_HELPER: weak + continue-on-error: true + run: php -dpcov.enabled=1 vendor/bin/codecept -vvv run acceptance --env chrome,github_action -g ${GROUP} --skip-group excludeCoverage --coverage --coverage-xml + - name: Upload outputs + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.group }}-evidence + path: codeception/_output/ + - name: Upload report + if: success() + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.group }}-reports + path: codeception/_output/**/*.xml + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.group }}-logs + path: var/log/ + + upload: + name: Upload coverage reports + runs-on: ubuntu-latest + needs: [ phpunit, codeception ] + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + path: reports + - run: | + mv reports/codeception-admin01-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.admin01.coverage.xml + mv reports/codeception-admin02-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.admin02.coverage.xml + mv reports/codeception-admin03-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.admin03.coverage.xml + mv reports/codeception-front-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.front.coverage.xml + mv reports/codeception-installer-reports/acceptance\ \(chrome,\ github_action\).remote.coverage.xml reports/acceptance.installer.coverage.xml + - name: Upload unit test coverage + uses: codecov/codecov-action@v1 + with: + files: ./reports/phpunit-reports/coverage1.xml + flags: Unit + fail_ci_if_error: true + - name: Upload E2E coverage + uses: codecov/codecov-action@v1 + with: + files: ./reports/acceptance.admin01.coverage.xml,./reports/acceptance.admin02.coverage.xml,./reports/acceptance.admin03.coverage.xml,./reports/acceptance.front.coverage.xml,./reports/acceptance.installer.coverage.xml + flags: E2E + fail_ci_if_error: true diff --git a/.github/workflows/deny-test.yml b/.github/workflows/deny-test.yml new file mode 100644 index 00000000000..90a11bf6280 --- /dev/null +++ b/.github/workflows/deny-test.yml @@ -0,0 +1,126 @@ +name: Deny check for EC-CUBE +on: + push: + branches: + - '*' + tags: + - '*' + paths: + - '**' + - '!*.md' + pull_request: + paths: + - '**' + - '!*.md' +jobs: + deploy: + name: Deny check + runs-on: ubuntu-22.04 + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: '7.4' + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: Translate to templates + run: php bin/template_jp.php + + - name: Setup to EC-CUBE + env: + APP_ENV: 'prod' + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + rm -rf $GITHUB_WORKSPACE/app/Plugin/* + echo "APP_ENV=${APP_ENV}" > .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: Install Plugins + env: + APP_ENV: 'prod' + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + bin/console eccube:composer:require "ec-cube/recommend42" + bin/console eccube:composer:require "ec-cube/coupon42" + bin/console eccube:composer:require "ec-cube/mailmagazine42" + bin/console eccube:composer:require "ec-cube/salesreport42" + bin/console eccube:composer:require "ec-cube/relatedproduct42" + bin/console eccube:composer:require "ec-cube/securitychecker42" + bin/console eccube:composer:require "ec-cube/productreview42" + bin/console eccube:composer:require "ec-cube/api42" + bin/console eccube:composer:require "ec-cube/sitekit42" + + - name: Pre Install Plugins + env: + PGPASSWORD: 'password' + run: psql eccube_db -h 127.0.0.1 -U postgres -c "select id,name,code,0 as enabled,version,source,0 as initialized,'2021-08-13 00:00:00' as create_date,'2021-08-13 00:00:00' as update_date,discriminator_type from dtb_plugin;" -A -F, --pset footer > src/Eccube/Resource/doctrine/import_csv/ja/dtb_plugin.csv + + - name: Packaging + working-directory: ../ + run: ${{ github.event.repository.name }}/package.sh + + - name: Build Container + run: docker build -t ec-cube . + + - name: Container Run + run: | + docker run -e APP_ENV=prod -e APP_DEBUG=0 -e DATABASE_URL="sqlite:///var/eccube.db" -e DATABASE_SERVER_VERSION=3 --rm -d -p 8080:80 --name eccube ec-cube + echo -n $(docker inspect -f {{.State.Health.Status}} eccube) + until [ $(docker inspect -f {{.State.Health.Status}} eccube) != "starting" ]; do + echo -n . + sleep 10; + done; + docker inspect -f {{.State.Health.Status}} eccube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data eccube bash -c 'for code in Api42 Coupon42 MailMagazine42 ProductReview42 Recommend42 RelatedProduct42 SalesReport42 Securitychecker42 SiteKit42; do bin/console eccube:plugin:enable --code $code; done' + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Prepare test + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + composer install --no-scripts --no-interaction --optimize-autoloader + echo "modules: + enabled: + - REST: + depends: PhpBrowser + url: 'http://127.0.0.1:8080' + config: + WebDriver: + host: '127.0.0.1' + port: 9515 + url: 'http://127.0.0.1:8080'" > codeception/_envs/local.yml + + - name: Run tests + env: + APP_ENV: 'codeception' + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local CL01DenyCest diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000000..2037d58f320 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,139 @@ +name: Deploy for EC-CUBE +on: + release: + types: [ published ] +jobs: + deploy: + name: Deploy + runs-on: ubuntu-22.04 + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: '7.4' + + - name: Install to Composer + run: composer install --no-scripts --no-dev --no-interaction --optimize-autoloader + + - name: Translate to templates + run: php bin/template_jp.php + + - name: Setup to EC-CUBE + env: + APP_ENV: 'prod' + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + rm -rf $GITHUB_WORKSPACE/app/Plugin/* + echo "APP_ENV=${APP_ENV}" > .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: Install Plugins + env: + APP_ENV: 'prod' + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + bin/console eccube:composer:require "ec-cube/recommend42" + bin/console eccube:composer:require "ec-cube/coupon42" + bin/console eccube:composer:require "ec-cube/mailmagazine42" + bin/console eccube:composer:require "ec-cube/salesreport42" + bin/console eccube:composer:require "ec-cube/relatedproduct42" + bin/console eccube:composer:require "ec-cube/securitychecker42" + bin/console eccube:composer:require "ec-cube/productreview42" + bin/console eccube:composer:require "ec-cube/api42" + bin/console eccube:composer:require "ec-cube/sitekit42" + + - name: revert to config platform.php + run: composer config platform.php 7.4.0 + + - name: Pre Install Plugins + env: + PGPASSWORD: 'password' + run: psql eccube_db -h 127.0.0.1 -U postgres -c "select id,name,code,0 as enabled,version,source,0 as initialized,'2021-08-13 00:00:00' as create_date,'2021-08-13 00:00:00' as update_date,discriminator_type from dtb_plugin;" -A -F, --pset footer > src/Eccube/Resource/doctrine/import_csv/ja/dtb_plugin.csv + + - name: Packaging + working-directory: ../ + env: + TAG_NAME: ${{ github.event.release.tag_name }} + run: ${{ github.event.repository.name }}/package.sh + + - name: Upload binaries to release of TGZ + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/eccube-${{ github.event.release.tag_name }}.tar.gz + asset_name: eccube-${{ github.event.release.tag_name }}.tar.gz + tag: ${{ github.ref }} + overwrite: true + - name: Upload binaries to release of ZIP + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/eccube-${{ github.event.release.tag_name }}.zip + asset_name: eccube-${{ github.event.release.tag_name }}.zip + tag: ${{ github.ref }} + overwrite: true + - name: Upload binaries to release of TGZ md5 checksum + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/eccube-${{ github.event.release.tag_name }}.tar.gz.checksum.md5 + asset_name: eccube-${{ github.event.release.tag_name }}.tar.gz.checksum.md5 + tag: ${{ github.ref }} + overwrite: true + - name: Upload binaries to release of TGZ sha1 checksum + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/eccube-${{ github.event.release.tag_name }}.tar.gz.checksum.sha1 + asset_name: eccube-${{ github.event.release.tag_name }}.tar.gz.checksum.sha1 + tag: ${{ github.ref }} + overwrite: true + - name: Upload binaries to release of TGZ sha256 checksum + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/eccube-${{ github.event.release.tag_name }}.tar.gz.checksum.sha256 + asset_name: eccube-${{ github.event.release.tag_name }}.tar.gz.checksum.sha256 + tag: ${{ github.ref }} + overwrite: true + - name: Upload binaries to release of ZIP md5 checksum + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/eccube-${{ github.event.release.tag_name }}.zip.checksum.md5 + asset_name: eccube-${{ github.event.release.tag_name }}.zip.checksum.md5 + tag: ${{ github.ref }} + overwrite: true + - name: Upload binaries to release of ZIP sha1 checksum + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/eccube-${{ github.event.release.tag_name }}.zip.checksum.sha1 + asset_name: eccube-${{ github.event.release.tag_name }}.zip.checksum.sha1 + tag: ${{ github.ref }} + overwrite: true + - name: Upload binaries to release of ZIP sha256 checksum + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ runner.workspace }}/eccube-${{ github.event.release.tag_name }}.zip.checksum.sha256 + asset_name: eccube-${{ github.event.release.tag_name }}.zip.checksum.sha256 + tag: ${{ github.ref }} + overwrite: true diff --git a/.github/workflows/dockerbuild.yml b/.github/workflows/dockerbuild.yml new file mode 100644 index 00000000000..72bd6040e25 --- /dev/null +++ b/.github/workflows/dockerbuild.yml @@ -0,0 +1,145 @@ +name: Testing dockerbuild +on: + push: + paths: + - '**' + - '!*.md' + release: + types: [ published ] +env: + REGISTRY: ghcr.io + +jobs: + dockerbuild: + name: dockerbuild + runs-on: ${{ matrix.operating-system }} + permissions: + contents: read + packages: write + strategy: + fail-fast: false + matrix: + operating-system: [ ubuntu-22.04 ] + php: [ '7.4', '8.0', '8.1' ] + db: [ pgsql ] + group: [ admin01 ] + include: + - db: pgsql + database_url: postgres://dbuser:secret@127.0.0.1:15432/eccubedb + database_server_version: 14 + - group: admin01 + app_env: 'codeception' + - php: '7.4' + tag: '7.4-apache' + - php: '8.0' + tag: '8.0-apache' + - php: '8.1' + tag: '8.1-apache' + steps: + - name: downcase REPO + run: | + echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}-php" >> ${GITHUB_ENV} + - name: Checkout + uses: actions/checkout@master + ## Used when creating multi-platform images + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v2 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v2 + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + # set latest tag for default branch + type=raw,value=${{ matrix.php }}-apache,prefix=,enable={{is_default_branch}} + type=ref,event=branch,prefix=${{ matrix.php }}-apache- + type=ref,event=tag,prefix=${{ matrix.php }}-apache- + type=ref,event=pr,prefix=${{ matrix.php }}-apache-pr- + + - name: Build and export to Docker + uses: docker/build-push-action@v3 + with: + context: . + load: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: TAG=${{ matrix.tag }} + + - name: Setup to EC-CUBE + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + REGISTRY: ${{ env.REGISTRY }} + IMAGE_NAME: ${{ env.IMAGE_NAME }} + TAG: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} + run: | + docker compose -f docker-compose.yml -f docker-compose.pgsql.yml up -d --wait + sed -i 's!APP_ENV: "dev"!APP_ENV: "prod"!g' docker-compose.yml + docker compose -f docker-compose.yml -f docker-compose.pgsql.yml up -d --wait + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Run chromedriver + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + + - name: Codeception + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_URL: 'smtp://127.0.0.1:1025' + GROUP: ${{ matrix.group }} + SYMFONY_DEPRECATIONS_HELPER: weak + run: | + echo "APP_ENV=${APP_ENV}" > .env + vendor/bin/codecept -vvv run acceptance --env chrome,github_action_docker -g ${GROUP} + ## see https://docs.github.com/ja/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#publishing-a-package-using-an-action + + - name: Push Docker image + uses: docker/build-push-action@v3 + if: success() + with: + context: . + push: true + # platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: TAG=${{ matrix.tag }} + + - name: Upload evidence + if: failure() + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.group }}-evidence + path: codeception/_output/ + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.group }}-logs + path: var/log/ diff --git a/.github/workflows/e2e-test-throttling.yml b/.github/workflows/e2e-test-throttling.yml new file mode 100644 index 00000000000..6135c1a7f0b --- /dev/null +++ b/.github/workflows/e2e-test-throttling.yml @@ -0,0 +1,154 @@ +name: E2E test(Throttoling) for EC-CUBE +on: + push: + branches: + - '*' + tags: + - '*' + paths: + - '**' + - '!*.md' + pull_request: + paths: + - '**' + - '!*.md' +jobs: + codeception: + name: Codeception + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + php: [ 8.1 ] + db: [ pgsql ] + method: [ フロント画面ログイン_IP, フロント画面ログイン_会員, 管理画面ログイン_IP, 管理画面ログイン_会員, 会員登録, 問い合わせ, パスワード再発行, 注文確認_非会員購入, 注文確認_会員購入, 注文完了_非会員購入, 注文完了_会員購入, 会員情報編集, 配送先情報_追加, 配送先情報_編集, 配送先情報_削除, order_お届け先追加, order_お届け先変更, 新規会員登録_入力, 管理画面二段階認証 ] + include: + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + + steps: + - name: Checkout + uses: actions/checkout@master + + # ShoppingController::checkoutをテストするため、confirmの上限値を変更する + - name: Fix limiter limit + if: startsWith(matrix.method, '注文完了') + run: | + echo "eccube: + rate_limiter: + shopping_confirm_ip: + route: ~ + limit: 1024 + interval: '30 minutes' + shopping_confirm_customer: + route: ~ + limit: 1024 + interval: '30 minutes' + shopping_checkout_ip: + route: ~ + limit: 25 + interval: '30 minutes' + shopping_checkout_customer: + route: ~ + limit: 10 + interval: '30 minutes'" > app/config/eccube/packages/prod/eccube_rate_limiter.yaml + + # delivery deleteのテストするため、delivery addの上限値を変更する + - name: Fix limiter limi for delivery delete + if: startsWith(matrix.method, '配送先情報_削除') + run: | + echo "eccube: + rate_limiter: + mypage_delivery_new: + route: mypage_delivery_new + method: [ 'POST' ] + type: customer + limit: 1024 + interval: '30 minutes' + mypage_delivery_delete: + route: mypage_delivery_delete + method: [ 'DELETE' ] + type: customer + limit: 10 + interval: '30 minutes'" > app/config/eccube/packages/prod/eccube_rate_limiter.yaml + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: Setup to EC-CUBE + env: + APP_ENV: 'prod' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + run: | + echo "APP_ENV=${APP_ENV}" > .env + echo "TRUSTED_HOSTS=127.0.0.1,localhost" >> .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Run chromedriver + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + + - name: Start PHP Development Server + env: + APP_ENV: 'prod' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_DSN: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + run: php -S 127.0.0.1:8000 codeception/router.php & + + - name: Codeception + env: + APP_ENV: 'prod' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_DSN: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + METHOD: ${{ matrix.method }} + SYMFONY_DEPRECATIONS_HELPER: weak + run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action EF09ThrottlingCest::${METHOD} --html report.html + + - name: Upload evidence + if: failure() + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.method }}-evidence + path: codeception/_output/ + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.method }}-logs + path: var/log/ diff --git a/.github/workflows/e2e-test.yml b/.github/workflows/e2e-test.yml new file mode 100644 index 00000000000..d8bdd141a05 --- /dev/null +++ b/.github/workflows/e2e-test.yml @@ -0,0 +1,159 @@ +name: E2E test for EC-CUBE +on: + push: + branches: + - '*' + tags: + - '*' + paths: + - '**' + - '!*.md' + pull_request: + paths: + - '**' + - '!*.md' +jobs: + codeception: + name: Codeception + runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + php: [ 7.4 ] + db: [ pgsql ] + group: [ 'admin01', 'admin02', 'admin03', 'front', 'restrict-fileupload', 'installer' ] + include: + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + - group: 'admin01' + app_env: 'codeception' + - group: 'admin02' + app_env: 'codeception' + - group: 'admin03' + app_env: 'codeception' + - group: 'front' + app_env: 'codeception' + - group: 'restrict-fileupload' + app_env: 'codeception' + - group: 'installer' + app_env: 'install' + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: Setup to EC-CUBE + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + run: | + echo "APP_ENV=${APP_ENV}" > .env + echo "TRUSTED_HOSTS=127.0.0.1,localhost" >> .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Install fonts + run: sudo apt install fonts-ipafont fonts-ipaexfont + + - name: Run chromedriver + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + + - name: Run package-api + run: | + if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi + docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2 + cp codeception/_data/plugins/*-1.0.0.tgz repos + + - name: Start PHP Development Server + if: ${{ matrix.group != 'restrict-fileupload' }} + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_DSN: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + run: php -S 127.0.0.1:8000 codeception/router.php & + + - name: Start PHP Development Server + if: ${{ matrix.group == 'restrict-fileupload' }} + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_DSN: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + ECCUBE_RESTRICT_FILE_UPLOAD: '1' + run: php -S 127.0.0.1:8000 codeception/router.php & + + - name: Codeception + if: ${{ matrix.group != 'restrict-fileupload' }} + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_DSN: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + GROUP: ${{ matrix.group }} + SYMFONY_DEPRECATIONS_HELPER: weak + run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action -g ${GROUP} --skip-group restrict-file-upload --html report.html + + - name: Codeception with Restrict file upload + if: ${{ matrix.group == 'restrict-fileupload' }} + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + MAILER_DSN: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + GROUP: ${{ matrix.group }} + SYMFONY_DEPRECATIONS_HELPER: weak + ECCUBE_RESTRICT_FILE_UPLOAD: '1' + run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action -g ${GROUP} --html report.html + + - name: Upload evidence + if: failure() + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.group }}-evidence + path: codeception/_output/ + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: codeception-${{ matrix.group }}-logs + path: var/log/ diff --git a/.github/workflows/penetration-test.yml b/.github/workflows/penetration-test.yml new file mode 100644 index 00000000000..f5bd2b0cbd2 --- /dev/null +++ b/.github/workflows/penetration-test.yml @@ -0,0 +1,87 @@ +name: Penetration testing for EC-CUBE +on: + schedule: + - cron: '0 15 * * 1' + +jobs: + PenetrationTest: + name: Penetration testing + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ ubuntu-22.04 ] + group: + - 'test/front_login/contact.test.ts' + - 'test/front_guest/about.test.ts' + - 'test/front_guest/contact.test.ts' + - 'test/admin/content_layout.test.ts' + - 'test/admin/content_layout_delete.test.ts' + - 'test/admin/customer_new.test.ts' + - 'test/admin/customer.test.ts' + - 'test/admin/content_cache.test.ts' + - 'test/admin/customer_edit.test.ts' + - 'test/admin/product_class_name.test.ts' + - 'test/admin/order_mail.test.ts' + - 'test/admin/product.test.ts' + - 'test/admin/product_csv_template.test.ts' + - 'test/admin/content_block.test.ts' + - 'test/admin/content_page.test.ts' + - 'test/admin/product_category_export.test.ts' + - 'test/admin/change_password.test.ts' + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup to EC-CUBE + run: | + sudo chown -R 1001:1000 zap + sudo chmod -R g+w zap + docker-compose -f docker-compose.yml -f docker-compose.pgsql.yml -f docker-compose.dev.yml -f docker-compose.owaspzap.yml -f docker-compose.owaspzap.daemon.yml up -d + docker-compose -f docker-compose.yml -f docker-compose.pgsql.yml -f docker-compose.dev.yml -f docker-compose.owaspzap.yml -f docker-compose.owaspzap.daemon.yml exec -T ec-cube bin/console doctrine:schema:create --env=dev + docker-compose -f docker-compose.yml -f docker-compose.pgsql.yml -f docker-compose.dev.yml -f docker-compose.owaspzap.yml -f docker-compose.owaspzap.daemon.yml exec -T ec-cube bin/console eccube:fixtures:load --env=dev + docker-compose -f docker-compose.yml -f docker-compose.pgsql.yml -f docker-compose.dev.yml -f docker-compose.owaspzap.yml -f docker-compose.owaspzap.daemon.yml exec -T ec-cube bin/console eccube:fixtures:generate --products=5 --customers=1 --orders=5 + docker-compose -f docker-compose.yml -f docker-compose.pgsql.yml -f docker-compose.dev.yml -f docker-compose.owaspzap.yml -f docker-compose.owaspzap.daemon.yml exec -T ec-cube bin/console doctrine:query:sql "UPDATE dtb_customer SET email = 'zap_user@example.com' WHERE id = 1;" + sed -i 's!APP_ENV: "dev"!APP_ENV: "prod"!g' docker-compose.yml + docker-compose -f docker-compose.yml -f docker-compose.pgsql.yml -f docker-compose.dev.yml -f docker-compose.owaspzap.yml -f docker-compose.owaspzap.daemon.yml up -d ec-cube + + - name: yarn install + working-directory: zap/selenium/ci/TypeScript + run: | + yarn install + yarn run playwright install --with-deps chromium + yarn playwright install-deps chromium + - run: | + git config --global user.name "$(git --no-pager log --format=format:'%an' -n 1)" + git config --global user.email "$(git --no-pager log --format=format:'%ae' -n 1)" + - name: Apply patch to change_password + if: matrix.group == 'test/admin/change_password.test.ts' + working-directory: zap/selenium/ci/TypeScript + run: git am patches/0001-Member.patch + - name: Apply patch to delete_layout + if: matrix.group == 'test/admin/content_layout_delete.test.ts' + working-directory: zap/selenium/ci/TypeScript + run: git am patches/0001-DeleteLayout.patch + - name: Apply patch to new_customer + if: matrix.group == 'test/admin/customer_new.test.ts' + working-directory: zap/selenium/ci/TypeScript + run: git am patches/0002-NewCustomer.patch + - name: Penetration testing + working-directory: zap/selenium/ci/TypeScript + env: + GROUP: ${{ matrix.group }} + HTTP_PROXY: 127.0.0.1:8090 + HTTPS_PROXY: 127.0.0.1:8090 + CI: 1 + FORCE_COLOR: 1 + run: yarn playwright test ${GROUP} + - env: + GROUP: ${{ matrix.group }} + if: always() + run: echo "ARTIFACT_NAME=$(echo ${GROUP} | sed 's,/,-,g')" >> $GITHUB_ENV + - name: Upload evidence + if: always() + uses: actions/upload-artifact@v2 + with: + name: zap-${{ env.ARTIFACT_NAME }}-session + path: zap/sessions diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 00000000000..c388e72b937 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,35 @@ +name: PHPStan +on: + push: + branches: + - '*' + tags: + - '*' + paths: + - '**' + - '!*.md' + pull_request: + paths: + - '**' + - '!*.md' + +jobs: + phpstan: + name: PHPStan + + runs-on: ubuntu-latest + + steps: + - name: "Checkout" + uses: actions/checkout@v2 + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: '7.4' + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: PHPStan + run: vendor/bin/phpstan analyze src/ --error-format=github diff --git a/.github/workflows/plugin-test.yml b/.github/workflows/plugin-test.yml new file mode 100644 index 00000000000..d9410d4d73f --- /dev/null +++ b/.github/workflows/plugin-test.yml @@ -0,0 +1,596 @@ +name: Plugin test for EC-CUBE +on: + push: + branches: + - '*' + tags: + - '*' + paths: + - '**' + - '!*.md' + pull_request: + paths: + - '**' + - '!*.md' +jobs: + plugin-install: + name: Plugin install + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ ubuntu-22.04 ] + php: [ '7.4', '8.0', '8.1' ] + db: [ pgsql, mysql ] + method: + - test_install_enable_disable_remove_store + - test_install_enable_disable_remove_local + - test_install_enable_disable_enable_disable_remove_store + - test_install_enable_disable_enable_disable_remove_local + - test_install_remove_local + - test_install_remove_store + - test_bundle_install_enable_disable_remove_store + - test_bundle_install_update_enable_disable_remove_store + include: + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + database_charset: utf8 + - db: mysql + database_url: mysql://root:password@127.0.0.1:3306/eccube_db + database_server_version: 5 + database_charset: utf8mb4 + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: Setup to EC-CUBE + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + run: | + echo "APP_ENV=${APP_ENV}" > .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: Update baseinfo with pgsql + if: matrix.db == 'pgsql' + env: + PGPASSWORD: 'password' + run: | + sudo apt-fast install -y postgresql-client + psql eccube_db -h 127.0.0.1 -U postgres -c "update dtb_base_info set authentication_key='test';" + + - name: Update baseinfo with mysql + if: matrix.db == 'mysql' + run: mysql -h 127.0.0.1 -u root -ppassword eccube_db -e "update dtb_base_info set authentication_key='test';" + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Run chromedriver + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + + - name: Start PHP Development Server + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + run: php -S 127.0.0.1:8000 codeception/router.php & + + ## ${PWD}/repos does not exist so service cannot be started + - name: Run package-api + run: | + if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi + docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2 + + - name: Codeception + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.1:1025' + METHOD: ${{ matrix.method }} + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + NO_FIXTURES: 1 + run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action EA10PluginCest:${METHOD} + - name: Upload evidence + if: failure() + uses: actions/upload-artifact@v2 + with: + name: plugin-install-${{ matrix.method }}-evidence + path: codeception/_output/ + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: plugin-install-${{ matrix.method }}-logs + path: var/log/ + + plugin-update: + name: Plugin Update + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ ubuntu-22.04 ] + php: [ '7.4', '8.0', '8.1' ] + db: [ pgsql, mysql ] + method: + - test_install_update_remove_store + - test_install_update_remove_local + - test_install_enable_disable_update_enable_disable_remove_local + - test_install_enable_disable_update_enable_disable_remove_store + - test_install_enable_update_disable_remove_store + - test_install_enable_update_disable_remove_local + include: + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + database_charset: utf8 + - db: mysql + database_url: mysql://root:password@127.0.0.1:3306/eccube_db + database_server_version: 5 + database_charset: utf8mb4 + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Install to Composer + run: composer install --dev --no-interaction -o --apcu-autoloader + + - name: Setup to EC-CUBE + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + run: | + echo "APP_ENV=${APP_ENV}" > .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: Update baseinfo with pgsql + if: matrix.db == 'pgsql' + env: + PGPASSWORD: 'password' + run: | + sudo apt-fast install -y postgresql-client + psql eccube_db -h 127.0.0.1 -U postgres -c "update dtb_base_info set authentication_key='test';" + + - name: Update baseinfo with mysql + if: matrix.db == 'mysql' + run: mysql -h 127.0.0.1 -u root -ppassword eccube_db -e "update dtb_base_info set authentication_key='test';" + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Run chromedriver + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + + - name: Start PHP Development Server + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + run: php -S 127.0.0.1:8000 codeception/router.php & + + ## ${PWD}/repos does not exist so service cannot be started + - name: Run package-api + run: | + if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi + docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2 + + - name: Run to Codeception + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.1:1025' + METHOD: ${{ matrix.method }} + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + NO_FIXTURES: 1 + run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action EA10PluginCest:${METHOD} + - name: Upload evidence + if: failure() + uses: actions/upload-artifact@v2 + with: + name: plugin-update-${{ matrix.method }}-evidence + path: codeception/_output/ + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: plugin-update-${{ matrix.method }}-logs + path: var/log/ + + plugin-extend: + name: Plugin extend + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ ubuntu-22.04 ] + php: [ '7.4', '8.0', '8.1' ] + db: [ pgsql, mysql ] + method: + - test_extend_same_table_store + - test_extend_same_table_disabled_remove_store + - test_extend_same_table_local + - test_extend_same_table_disabled_remove_local + - test_extend_same_table_crossed_store + - test_extend_same_table_crossed_local + include: + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + database_charset: utf8 + - db: mysql + database_url: mysql://root:password@127.0.0.1:3306/eccube_db + database_server_version: 5 + database_charset: utf8mb4 + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Install to Composer + run: composer install --dev --no-interaction -o --apcu-autoloader + + - name: Setup to EC-CUBE + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + run: | + echo "APP_ENV=${APP_ENV}" > .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: Update baseinfo with pgsql + if: matrix.db == 'pgsql' + env: + PGPASSWORD: 'password' + run: | + sudo apt-fast install -y postgresql-client + psql eccube_db -h 127.0.0.1 -U postgres -c "update dtb_base_info set authentication_key='test';" + + - name: Update baseinfo with mysql + if: matrix.db == 'mysql' + run: mysql -h 127.0.0.1 -u root -ppassword eccube_db -e "update dtb_base_info set authentication_key='test';" + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Run chromedriver + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + + - name: Start PHP Development Server + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + run: php -S 127.0.0.1:8000 codeception/router.php & + + ## ${PWD}/repos does not exist so service cannot be started + - name: Run package-api + run: | + if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi + docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2 + + - name: Run to Codeception + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.1:1025' + METHOD: ${{ matrix.method }} + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + NO_FIXTURES: 1 + run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action EA10PluginCest:${METHOD} + - name: Upload evidence + if: failure() + uses: actions/upload-artifact@v2 + with: + name: plugin-extend-${{ matrix.method }}-evidence + path: codeception/_output/ + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: plugin-extend-${{ matrix.method }}-logs + path: var/log/ + + plugin-depend: + name: Plugin depend + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ ubuntu-22.04 ] + php: [ '7.4', '8.0', '8.1' ] + db: [ pgsql, mysql ] + method: + - test_dependency_each_install_plugin + - test_dependency_plugin_install + - test_dependency_plugin_update + - test_install_error + - install_enable_disable_enable_disable_remove_store + - test_enhance_plugin_entity + include: + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + database_charset: utf8 + - db: mysql + database_url: mysql://root:password@127.0.0.1:3306/eccube_db + database_server_version: 5 + database_charset: utf8mb4 + exclude: + - db: mysql + method: test_dependency_plugin_update + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "::set-output name=dir::$(composer config cache-files-dir)" + - uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Install to Composer + run: composer install --dev --no-interaction -o --apcu-autoloader + + - name: Setup to EC-CUBE + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + run: | + echo "APP_ENV=${APP_ENV}" > .env + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + + - name: Update baseinfo with pgsql + if: matrix.db == 'pgsql' + env: + PGPASSWORD: 'password' + run: | + sudo apt-fast install -y postgresql-client + psql eccube_db -h 127.0.0.1 -U postgres -c "update dtb_base_info set authentication_key='test';" + + - name: Update baseinfo with mysql + if: matrix.db == 'mysql' + run: mysql -h 127.0.0.1 -u root -ppassword eccube_db -e "update dtb_base_info set authentication_key='test';" + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: Run chromedriver + run: | + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + + - name: Start PHP Development Server + env: + APP_ENV: 'codeception' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.1:1025' + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + run: php -S 127.0.0.1:8000 codeception/router.php & + + ## ${PWD}/repos does not exist so service cannot be started + - name: Run package-api + run: | + if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi + docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2 + + - name: Run to Codeception + env: + APP_ENV: ${{ matrix.app_env }} + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.1:1025' + METHOD: ${{ matrix.method }} + ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080' + NO_FIXTURES: 1 + run: vendor/bin/codecept -vvv run acceptance --env chrome,github_action EA10PluginCest:${METHOD} + - name: Upload evidence + if: failure() + uses: actions/upload-artifact@v2 + with: + name: plugin-depend-${{ matrix.method }}-evidence + path: codeception/_output/ + - name: Upload logs + if: failure() + uses: actions/upload-artifact@v2 + with: + name: plugin-depend-${{ matrix.method }}-logs + path: var/log/ diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml new file mode 100644 index 00000000000..02076ffdae2 --- /dev/null +++ b/.github/workflows/unit-test.yml @@ -0,0 +1,122 @@ +name: Unit test for EC-CUBE +on: + push: + branches: + - '*' + tags: + - '*' + paths: + - '**' + - '!*.md' + pull_request: + paths: + - '**' + - '!*.md' +jobs: + phpunit: + name: PHPUnit + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ ubuntu-22.04 ] + php: [ '7.4', '8.0', '8.1' ] + db: [ mysql, pgsql, sqlite3 ] + include: + - db: mysql + database_url: mysql://root:password@127.0.0.1:3306/eccube_db + database_server_version: 5 + database_charset: utf8mb4 + - db: pgsql + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db + database_server_version: 14 + database_charset: utf8 + - db: sqlite3 + database_url: sqlite:///var/eccube.db + database_server_version: 3 + database_charset: utf8 + + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: password + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: ${{ matrix.php }} + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: Setup EC-CUBE + env: + APP_ENV: 'test' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + run: | + bin/console doctrine:database:create + bin/console doctrine:schema:create + bin/console eccube:fixtures:load + + - name: PHPUnit + env: + APP_ENV: 'test' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.11025' + run: vendor/bin/phpunit --exclude-group cache-clear,cache-clear-install,update-schema-doctrine,plugin-service + - name: PHPUnit + env: + APP_ENV: 'test' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.11025' + run: | + vendor/bin/phpunit --group cache-clear + vendor/bin/phpunit --group cache-clear-install + vendor/bin/phpunit --group update-schema-doctrine --exclude-group update-schema-doctrine-install + vendor/bin/phpunit --group update-schema-doctrine-install --filter=testInstallPluginWithNoProxy + vendor/bin/phpunit --group update-schema-doctrine-install --filter=testInstallPluginWithProxy + vendor/bin/phpunit --group update-schema-doctrine-install --filter=testEnablePluginWithNoProxy + vendor/bin/phpunit --group update-schema-doctrine-install --filter=testEnablePluginWithProxy + vendor/bin/phpunit --group update-schema-doctrine-install --filter=testDisablePluginWithNoProxy + vendor/bin/phpunit --group update-schema-doctrine-install --filter=testDisablePluginWithProxy + vendor/bin/phpunit --group update-schema-doctrine-install --filter=testCreateEntityAndTrait + ## XXX MySQL で Syntax error or access violation: 1305 SAVEPOINT DOCTRINE2_SAVEPOINT_3 does not exist が + ## 発生するため \DAMA\DoctrineTestBundle\PHPUnit\PHPUnitListener を削除する + ## see https://github.com/dmaicher/doctrine-test-bundle/issues/58#issuecomment-391081408 + - run: sed -e '/DoctrineTestBundle/d' phpunit.xml.dist > phpunit.xml + if: ${{ matrix.db == 'mysql' }} + - name: PHPUnit + env: + APP_ENV: 'test' + DATABASE_URL: ${{ matrix.database_url }} + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} + DATABASE_CHARSET: ${{ matrix.database_charset }} + MAILER_URL: 'smtp://127.0.0.11025' + run: | + rm -r app/Plugin/* + git checkout app/Plugin + rm -r var/cache + vendor/bin/phpunit --group plugin-service diff --git a/.github/workflows/vaddy-1.yml b/.github/workflows/vaddy-1.yml new file mode 100644 index 00000000000..87ed8c58d91 --- /dev/null +++ b/.github/workflows/vaddy-1.yml @@ -0,0 +1,498 @@ +name: VAddy +on: + schedule: + - cron: '0 15 * * 0' + +jobs: + vaddy: + name: VAddy + runs-on: ubuntu-22.04 + strategy: + matrix: + include: + - vaddy_project: 'ADMIN01' + command1: 'EA03ProductCest' + command2: 'EA05CustomerCest' + command3: 'EA08SysteminfoCest' + command4: 'EA09ShippingCest' + - vaddy_project: 'ADMIN02' + command1: 'EA04OrderCest' + - vaddy_project: 'FRONT' + command1: '-x admin -x plugin' + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: '7.4' + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: "VAddy: install" + working-directory: /tmp + run: | + wget -q https://github.com/vaddy/go-vaddy/archive/master.zip + unzip master.zip + echo 'export VADDY_AUTH_KEY="${{ secrets.VADDY_AUTH_KEY }}" + export VADDY_FQDN="${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}" + export VADDY_VERIFICATION_CODE="${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + export VADDY_USER="${{ secrets.VADDY_USER }}" + export VADDY_YOUR_LOCAL_IP="127.0.0.1" + export VADDY_YOUR_LOCAL_PORT="8080" + export VADDY_HTTPS_PROXY=""' > go-vaddy-master/privatenet/conf/vaddy.conf + mkdir -p ${HOME}/.ssh + echo 'Host *.vaddy.net + StrictHostKeyChecking no' >> ${HOME}/.ssh/config + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: "EC-CUBE: setup" + env: + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + php bin/template_jp.php + rm -rf app/Plugin/* + echo 'getEntityManager()->detach($event->getEntity()); + } + }' > CancelDeletionEventSubscriber.php + sed -i.bak -e 's_$fs->remove_// $fs->remove_' src/Eccube/Controller/Admin/Content/PageController.php + rm -f app/config/eccube/packages/dev/web_profiler.yaml + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + chmod -R 777 html + + - name: Install Plugins + env: + APP_ENV: 'prod' + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + bin/console eccube:composer:require "ec-cube/recommend4" + bin/console eccube:composer:require "ec-cube/coupon4" + bin/console eccube:composer:require "ec-cube/mailmagazine4" + bin/console eccube:composer:require "ec-cube/salesreport4" + bin/console eccube:composer:require "ec-cube/relatedproduct4" + bin/console eccube:composer:require "ec-cube/securitychecker4" + bin/console eccube:composer:require "ec-cube/productreview4" + bin/console eccube:composer:require "ec-cube/api" + bin/console eccube:composer:require "ec-cube/sitekit" + bin/console eccube:composer:require "ec-cube/gmc" + + - name: Pre Install Plugins + env: + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + PGPASSWORD: 'password' + run: | + psql eccube_db -h 127.0.0.1 -U postgres -c "select id,name,code,0 as enabled,version,source,0 as initialized,'2021-08-13 00:00:00' as create_date,'2021-08-13 00:00:00' as update_date,discriminator_type from dtb_plugin;" -A -F, --pset footer > src/Eccube/Resource/doctrine/import_csv/ja/dtb_plugin.csv + for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done + + - name: "EC-CUBE: package" + working-directory: ../ + run: ${{ github.event.repository.name }}/package.sh + + - name: "EC-CUBE: build" + run: docker build -t ec-cube --build-arg SKIP_INSTALL_SCRIPT_ON_DOCKER_BUILD=true . + - name: "Codeception: prepare" + run: | + echo "APP_ENV=codeception" > .env + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + composer install --no-scripts --no-interaction --optimize-autoloader + sudo echo "127.0.0.1 ${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}" | sudo tee -a /etc/hosts + echo "modules: + config: + WebDriver: + host: '127.0.0.1' + port: 9515 + url: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + browser: chrome + capabilities: + chromeOptions: + args: ["--headless", "--disable-gpu"] + prefs: + download.default_directory: '%PWD%/codeception/_support/_downloads' + MailCatcher: + url: 'mail' + port: 1080" > codeception/_envs/local.yml + + - name: "Scan 1" + run: echo 'Scan 1' + + - name: "EC-CUBE: run" + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command1 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command1 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ always() }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command1 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ always() }} + continue-on-error: true + run: docker rm -f -v eccube + + - name: "Scan 2" + if: ${{ matrix.command2 != '' }} + run: echo 'Scan 2' + + - name: "EC-CUBE: run" + if: ${{ matrix.command2 != '' }} + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + if: ${{ matrix.command2 != '' }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + if: ${{ matrix.command2 != '' && success() }} + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command2 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command2 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + if: ${{ matrix.command2 != '' && success() }} + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ matrix.command2 }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + if: ${{ matrix.command2 != '' && success() }} + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command2 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ matrix.command2 }} + continue-on-error: true + run: docker rm -f -v eccube + + - name: "Scan 3" + if: ${{ matrix.command3 != '' }} + run: echo 'Scan 3' + + - name: "EC-CUBE: run" + if: ${{ matrix.command3 != '' }} + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + if: ${{ matrix.command3 != '' }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + if: ${{ matrix.command3 != '' && success() }} + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command3 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command3 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + if: ${{ matrix.command3 != '' && success() }} + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ matrix.command3 }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + if: ${{ matrix.command3 != '' && success() }} + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command3 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ matrix.command3 }} + continue-on-error: true + run: docker rm -f -v eccube + + - name: "Scan 4" + if: ${{ matrix.command4 != '' }} + run: echo 'Scan 4' + + - name: "EC-CUBE: run" + if: ${{ matrix.command4 != '' }} + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + if: ${{ matrix.command4 != '' }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + if: ${{ matrix.command4 != '' && success() }} + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command4 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command4 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + if: ${{ matrix.command4 != '' && success() }} + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ matrix.command4 }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + if: ${{ matrix.command4 != '' && success() }} + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command4 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ matrix.command4 }} + continue-on-error: true + run: docker rm -f -v eccube + + - name: "Scan 5" + if: ${{ matrix.command5 != '' }} + run: echo 'Scan 5' + + - name: "EC-CUBE: run" + if: ${{ matrix.command5 != '' }} + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + if: ${{ matrix.command5 != '' }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + if: ${{ matrix.command5 != '' && success() }} + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command5 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command5 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + if: ${{ matrix.command5 != '' && success() }} + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ matrix.command5 }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + if: ${{ matrix.command5 != '' && success() }} + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command5 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ matrix.command5 }} + continue-on-error: true + run: docker rm -f -v eccube + +# - name: VAddy private net logs +# if: ${{ always() }} +# working-directory: /tmp/go-vaddy-master/privatenet +# run: cat vaddy/*.txt diff --git a/.github/workflows/vaddy-2.yml b/.github/workflows/vaddy-2.yml new file mode 100644 index 00000000000..e35da382088 --- /dev/null +++ b/.github/workflows/vaddy-2.yml @@ -0,0 +1,499 @@ +name: VAddy +on: + schedule: + - cron: '0 21 * * 0' + +jobs: + vaddy: + name: VAddy + runs-on: ubuntu-22.04 + strategy: + matrix: + include: + - vaddy_project: 'ADMIN01' + command1: 'EA06ContentsManagementCest' + - vaddy_project: 'ADMIN02' + command1: ' -x delivery -x basicsetting -x taxrule -x mailsetting -x csvsetting -x orderstatus -x pluginauth EA07BasicinfoCest' + command2: '-x paymentmethod -x basicsetting -x taxrule -x mailsetting -x csvsetting -x orderstatus -x pluginauth EA07BasicinfoCest' + command3: '-x paymentmethod -x delivery -x mailsetting -x csvsetting -x orderstatus EA07BasicinfoCest' + command4: '-x paymentmethod -x delivery -x basicsetting -x taxrule -x orderstatus -x pluginauth EA07BasicinfoCest' + command5: '-x paymentmethod -x delivery -x basicsetting -x taxrule -x mailsetting -x csvsetting -x pluginauth EA07BasicinfoCest' + - vaddy_project: 'FRONT' + command1: '-x admin -x front' + services: + postgres: + image: postgres:14 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + ports: + - 5432:5432 + # needed because the postgres container does not provide a healthcheck + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + mailcatcher: + image: schickling/mailcatcher + ports: + - 1080:1080 + - 1025:1025 + steps: + - name: Checkout + uses: actions/checkout@master + + - name: Setup PHP + uses: nanasess/setup-php@master + with: + php-version: '7.4' + + - name: setup-chromedriver + uses: nanasess/setup-chromedriver@master + + - name: "VAddy: install" + working-directory: /tmp + run: | + wget -q https://github.com/vaddy/go-vaddy/archive/master.zip + unzip master.zip + echo 'export VADDY_AUTH_KEY="${{ secrets.VADDY_AUTH_KEY }}" + export VADDY_FQDN="${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}" + export VADDY_VERIFICATION_CODE="${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + export VADDY_USER="${{ secrets.VADDY_USER }}" + export VADDY_YOUR_LOCAL_IP="127.0.0.1" + export VADDY_YOUR_LOCAL_PORT="8080" + export VADDY_HTTPS_PROXY=""' > go-vaddy-master/privatenet/conf/vaddy.conf + mkdir -p ${HOME}/.ssh + echo 'Host *.vaddy.net + StrictHostKeyChecking no' >> ${HOME}/.ssh/config + + - name: Initialize Composer + uses: ./.github/actions/composer + + - name: "EC-CUBE: setup" + env: + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + php bin/template_jp.php + rm -rf app/Plugin/* + echo 'getEntityManager()->detach($event->getEntity()); + } + }' > CancelDeletionEventSubscriber.php + sed -i.bak -e 's_$fs->remove_// $fs->remove_' src/Eccube/Controller/Admin/Content/PageController.php + rm -f app/config/eccube/packages/dev/web_profiler.yaml + bin/console doctrine:database:create --env=dev + bin/console doctrine:schema:create --env=dev + bin/console eccube:fixtures:load --env=dev + chmod -R 777 html + + - name: Install Plugins + env: + APP_ENV: 'prod' + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + run: | + bin/console eccube:composer:require "ec-cube/recommend4" + bin/console eccube:composer:require "ec-cube/coupon4" + bin/console eccube:composer:require "ec-cube/mailmagazine4" + bin/console eccube:composer:require "ec-cube/salesreport4" + bin/console eccube:composer:require "ec-cube/relatedproduct4" + bin/console eccube:composer:require "ec-cube/securitychecker4" + bin/console eccube:composer:require "ec-cube/productreview4" + bin/console eccube:composer:require "ec-cube/api" + bin/console eccube:composer:require "ec-cube/sitekit" + bin/console eccube:composer:require "ec-cube/gmc" + + - name: Pre Install Plugins + env: + DATABASE_URL: postgres://postgres:password@127.0.0.1:5432/eccube_db + DATABASE_SERVER_VERSION: 14 + PGPASSWORD: 'password' + run: | + psql eccube_db -h 127.0.0.1 -U postgres -c "select id,name,code,0 as enabled,version,source,0 as initialized,'2021-08-13 00:00:00' as create_date,'2021-08-13 00:00:00' as update_date,discriminator_type from dtb_plugin;" -A -F, --pset footer > src/Eccube/Resource/doctrine/import_csv/ja/dtb_plugin.csv + for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done + + - name: "EC-CUBE: package" + working-directory: ../ + run: ${{ github.event.repository.name }}/package.sh + + - name: "EC-CUBE: build" + run: docker build -t ec-cube --build-arg SKIP_INSTALL_SCRIPT_ON_DOCKER_BUILD=true . + - name: "Codeception: prepare" + run: | + echo "APP_ENV=codeception" > .env + export DISPLAY=:99 + chromedriver --url-base=/wd/hub & + echo ">>> Started chrome-driver" + sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & + echo ">>> Started xvfb" + composer install --no-scripts --no-interaction --optimize-autoloader + sudo echo "127.0.0.1 ${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}" | sudo tee -a /etc/hosts + echo "modules: + config: + WebDriver: + host: '127.0.0.1' + port: 9515 + url: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + browser: chrome + capabilities: + chromeOptions: + args: ["--headless", "--disable-gpu"] + prefs: + download.default_directory: '%PWD%/codeception/_support/_downloads' + MailCatcher: + url: 'mail' + port: 1080" > codeception/_envs/local.yml + + - name: "Scan 1" + run: echo 'Scan 1' + + - name: "EC-CUBE: run" + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command1 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command1 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ always() }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command1 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ always() }} + continue-on-error: true + run: docker rm -f -v eccube + + - name: "Scan 2" + if: ${{ matrix.command2 != '' }} + run: echo 'Scan 2' + + - name: "EC-CUBE: run" + if: ${{ matrix.command2 != '' }} + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + if: ${{ matrix.command2 != '' }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + if: ${{ matrix.command2 != '' && success() }} + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command2 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command2 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + if: ${{ matrix.command2 != '' && success() }} + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ matrix.command2 }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + if: ${{ matrix.command2 != '' && success() }} + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command2 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ matrix.command2 }} + continue-on-error: true + run: docker rm -f -v eccube + + - name: "Scan 3" + if: ${{ matrix.command3 != '' }} + run: echo 'Scan 3' + + - name: "EC-CUBE: run" + if: ${{ matrix.command3 != '' }} + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + if: ${{ matrix.command3 != '' }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + if: ${{ matrix.command3 != '' && success() }} + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command3 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command3 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + if: ${{ matrix.command3 != '' && success() }} + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ matrix.command3 }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + if: ${{ matrix.command3 != '' && success() }} + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command3 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ matrix.command3 }} + continue-on-error: true + run: docker rm -f -v eccube + + - name: "Scan 4" + if: ${{ matrix.command4 != '' }} + run: echo 'Scan 4' + + - name: "EC-CUBE: run" + if: ${{ matrix.command4 != '' }} + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + if: ${{ matrix.command4 != '' }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + if: ${{ matrix.command4 != '' && success() }} + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command4 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command4 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + if: ${{ matrix.command4 != '' && success() }} + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ matrix.command4 }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + if: ${{ matrix.command4 != '' && success() }} + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command4 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ matrix.command4 }} + continue-on-error: true + run: docker rm -f -v eccube + + - name: "Scan 5" + if: ${{ matrix.command5 != '' }} + run: echo 'Scan 5' + + - name: "EC-CUBE: run" + if: ${{ matrix.command5 != '' }} + run: | + docker run \ + -e APP_ENV=dev \ + -e APP_DEBUG=1 \ + -e DATABASE_URL="postgres://postgres:password@172.17.0.1:5432/eccube_db" \ + -e DATABASE_SERVER_VERSION=14 \ + -e MAILER_URL="smtp://172.17.0.1:1025" \ + -v ${PWD}/html:/tmp/html \ + --rm -d -p 8080:80 --name eccube ec-cube + docker cp ../eccube.tar.gz eccube:/tmp/ + docker exec -w /tmp eccube bash -c "rm -rf /var/www/html; tar xf /tmp/eccube.tar.gz -C /var/www; mv /var/www/ec-cube /var/www/html; chown -R www-data: /var/www/html" + docker exec eccube bash -c "rm -rf /var/www/html/html; ln -s /tmp/html /var/www/html/html;" + docker exec -u www-data eccube bin/console eccube:install -n + docker exec -u www-data -e VADDY_VERIFICATION_CODE=${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }} eccube bash -c 'echo ${VADDY_VERIFICATION_CODE} > vaddy-${VADDY_VERIFICATION_CODE}.html' + docker exec -u www-data eccube bash -c 'for code in Api Coupon4 GMC MailMagazine4 ProductReview4 Recommend4 RelatedProduct4 SalesReport4 Securitychecker4 SiteKit; do bin/console eccube:plugin:enable --code $code; done' + + - name: "VAddy: connect" + if: ${{ matrix.command5 != '' }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh connect + + - name: "VAddy: crawl" + if: ${{ matrix.command5 != '' && success() }} + env: + APP_ENV: "codeception" + DATABASE_URL: "postgres://postgres:password@127.0.0.1:5432/eccube_db" + DATABASE_SERVER_VERSION: "14" + MAILER_URL: "smtp://127.0.0.1:1025" + BASE_URL: "http://${{ secrets[format('{0}{1}', 'VADDY_FQDN_', matrix.vaddy_project)] }}:8080" + VADDY_PROXY: "${{ secrets.VADDY_PROXY }}" + VADDY_PROXY_PORT: "${{ secrets.VADDY_PROXY_PORT }}" + VADDY_VERIFICATION_CODE: "${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.vaddy_project)] }}" + VADDY_CRAWL: "${{ matrix.command5 }}" + run: | + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:begin + vendor/bin/codecept -vvv run -g vaddy acceptance --env chrome,local,vaddy --html report.html ${{ matrix.command5 }} || true + vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit + + - name: Upload report + if: ${{ matrix.command5 != '' && success() }} + uses: actions/upload-artifact@v2 + with: + name: crawl-reports + path: codeception/_output/**/* + + - name: "VAddy: disconnect" + if: ${{ matrix.command5 }} + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh disconnect + + - name: "VAddy: scan" + if: ${{ matrix.command5 != '' && success() }} + continue-on-error: true + env: + VADDY_CRAWL: "${{ matrix.command5 }}" + working-directory: /tmp/go-vaddy-master/privatenet + run: ./vaddy_privatenet.sh scan + + - name: "EC-CUBE: stop" + if: ${{ matrix.command5 }} + continue-on-error: true + run: docker rm -f -v eccube + +# - name: VAddy private net logs +# if: ${{ always() }} +# working-directory: /tmp/go-vaddy-master/privatenet +# run: cat vaddy/*.txt