Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
kiy0taka committed Aug 26, 2021
1 parent 2cdd9b2 commit 205241d
Showing 1 changed file with 13 additions and 182 deletions.
195 changes: 13 additions & 182 deletions .github/workflows/vaddy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: VAddy scan
name: Github Actions test
on:
push:
branches:
Expand All @@ -14,187 +14,18 @@ on:
- '!*.md'
jobs:
vaddy:
name: VAddy scan
name: Github Actions test
runs-on: ubuntu-18.04
services:
postgres:
image: postgres:11
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
strategy:
matrix:
include:
- group: 'front'
secret_prefix: 'FRONT'
- group: 'admin01'
secret_prefix: 'ADMIN01'
- group: 'admin02'
secret_prefix: 'ADMIN02'
steps:
- name: Checkout
uses: actions/checkout@master

- name: Setup PHP
uses: nanasess/setup-php@master
with:
php-version: '7.3'

- name: Get Composer Cache Directory
id: composer-cache
- name: Show Env
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: 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:[email protected]:5432/eccube_db
DATABASE_SERVER_VERSION: 11
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:[email protected]:5432/eccube_db
# DATABASE_SERVER_VERSION: 11
# 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:
# 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 --build-arg SKIP_INSTALL_SCRIPT_ON_DOCKER_BUILD=true .

- name: Container Run
env:
VADDY_VERIFICATION_CODE: ${{ secrets.VADDY_VERIFICATION_CODE }}
run: |
docker run -e APP_ENV=vaddy -e APP_DEBUG=0 -e DATABASE_URL="postgres://postgres:[email protected]:5432/eccube_db" -e DATABASE_SERVER_VERSION=11 --rm -d -p 8080:80 --name eccube ec-cube
docker cp ../eccube.tar.gz eccube:/tmp/
echo '<?php
namespace Eccube\Doctrine\EventSubscriber;
use Doctrine\Common\EventSubscriber;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Events;
class CancelDeletionEventSubscriber implements EventSubscriber
{
public function getSubscribedEvents()
{
return [Events::preRemove];
}
public function preRemove(LifecycleEventArgs $event)
{
$event->getEntityManager()->detach($event->getEntity());
}
}' > CancelDeletionEventSubscriber.php
docker cp CancelDeletionEventSubscriber.php eccube:/var/www/html/src/Eccube/Doctrine/EventSubscriber/CancelDeletionEventSubscriber.php
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 bash -c "cp -r app/config/eccube/packages/dev app/config/eccube/packages/vaddy; rm -f app/config/eccube/packages/vaddy/web_profiler.yaml"
docker exec -u www-data eccube bin/console eccube:install -n
docker exec -u www-data -e VADDY_VERIFICATION_CODE=hoge 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: setup-chromedriver
uses: nanasess/setup-chromedriver@master

- name: Prepare codeception
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
sudo echo "127.0.0.1 vaddy.example.com" | sudo tee -a /etc/hosts
echo "modules:
config:
WebDriver:
host: '127.0.0.1'
port: 9515
url: 'http://vaddy.example.com:8080'
browser: chrome
capabilities:
chromeOptions:
args: ["--disable-dev-shm-usage"]
prefs:
download.default_directory: '%PWD%/codeception/_support/_downloads'
MailCatcher:
url: 'mail'
port: 1080" > codeception/_envs/local.yml
- name: Install VAddy for Private Net CLI tool
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="vaddy.example.com"
export VADDY_VERIFICATION_CODE="${{ secrets.VADDY_VERIFICATION_CODE }}"
export VADDY_USER="${{ secrets.VADDY_USER }}"
export VADDY_YOUR_LOCAL_IP="127.0.0.1"
export VADDY_YOUR_LOCAL_PORT="8080"
export VADDY_CRAWL=""
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: VAddy private net connect
working-directory: /tmp/go-vaddy-master/privatenet
run: ./vaddy_privatenet.sh connect

- name: Vaddy crawl
env:
APP_ENV: 'codeception'
DATABASE_URL: postgres://postgres:[email protected]:5432/eccube_db
DATABASE_SERVER_VERSION: 11
BASE_URL: 'http://vaddy.example.com:8080'
VADDY_PROXY: ${{ secrets.VADDY_PROXY }}
VADDY_PROXY_PORT: ${{ secrets.VADDY_PROXY_PORT }}
VADDY_VERIFICATION_CODE: ${{ secrets.VADDY_VERIFICATION_CODE }}
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 EF05MypageCest || true
vendor/bin/codecept -vvv run acceptance --env chrome,local,vaddy VaddyCest:commit
- name: VAddy private net disconnect
if: ${{ always() }}
working-directory: /tmp/go-vaddy-master/privatenet
run: ./vaddy_privatenet.sh disconnect

- name: VAddy private net scan
working-directory: /tmp/go-vaddy-master/privatenet
run: ./vaddy_privatenet.sh scan

- name: VAddy private net logs
if: ${{ always() }}
working-directory: /tmp/go-vaddy-master/privatenet
run: cat vaddy/*.txt
echo "${{ matrix.group }} - ${{ secrets[format('{0}{1}', 'VADDY_VERIFICATION_CODE_', matrix.secret_prefix)] }}"

0 comments on commit 205241d

Please sign in to comment.