|
| 1 | +name: CI for RelatedProduct4 |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - '*' |
| 6 | + tags: |
| 7 | + - '*' |
| 8 | + paths: |
| 9 | + - '**' |
| 10 | + - '!*.md' |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - '*' |
| 14 | + paths: |
| 15 | + - '**' |
| 16 | + - '!*.md' |
| 17 | +jobs: |
| 18 | + run-on-linux: |
| 19 | + name: Run on Linux |
| 20 | + runs-on: ${{ matrix.operating-system }} |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + operating-system: [ ubuntu-18.04 ] |
| 25 | + php: [ '7.1', '7.2', '7.3', '7.4' ] |
| 26 | + db: [ mysql, pgsql ] |
| 27 | + eccube_version: [ '4.0.6-p1', '4.1' ] |
| 28 | + plugin_code: [ 'RelatedProduct4' ] |
| 29 | + include: |
| 30 | + - eccube_version: '4.0.6-p1' |
| 31 | + composer: 'v1' |
| 32 | + - eccube_version: '4.1' |
| 33 | + composer: 'v2' |
| 34 | + - db: mysql |
| 35 | + dbport: '3306' |
| 36 | + dbuser: 'root' |
| 37 | + dbpass: 'root' |
| 38 | + dbname: 'myapp_test' |
| 39 | + dbversion: 5.7 |
| 40 | + - db: pgsql |
| 41 | + dbport: '5432' |
| 42 | + dbuser: 'postgres' |
| 43 | + dbpass: 'password' |
| 44 | + dbname: 'myapp_test' |
| 45 | + dbversion: 9.5 |
| 46 | + services: |
| 47 | + mysql: |
| 48 | + image: mysql:5.7 |
| 49 | + env: |
| 50 | + MYSQL_ROOT_PASSWORD: root |
| 51 | + MYSQL_DATABASE: ${{ matrix.dbname }} |
| 52 | + ports: |
| 53 | + - 3306:3306 |
| 54 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 55 | + postgres: |
| 56 | + image: postgres:9.5 |
| 57 | + env: |
| 58 | + POSTGRES_USER: postgres |
| 59 | + POSTGRES_PASSWORD: password |
| 60 | + POSTGRES_DB: ${{ matrix.dbname }} |
| 61 | + ports: |
| 62 | + - 5432:5432 |
| 63 | + # needed because the postgres container does not provide a healthcheck |
| 64 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 65 | + mailcatcher: |
| 66 | + image: schickling/mailcatcher |
| 67 | + ports: |
| 68 | + - 1080:1080 |
| 69 | + - 1025:1025 |
| 70 | + steps: |
| 71 | + - run: sudo apt-get purge -y hhvm |
| 72 | + - name: Checkout |
| 73 | + uses: actions/checkout@v2 |
| 74 | + |
| 75 | + - name: Setup PHP |
| 76 | + uses: nanasess/setup-php@master |
| 77 | + with: |
| 78 | + php-version: ${{ matrix.php }} |
| 79 | + |
| 80 | + - name: Archive Plugin |
| 81 | + env: |
| 82 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 83 | + run: | |
| 84 | + tar cvzf ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz ./* |
| 85 | + - name: Checkout EC-CUBE |
| 86 | + uses: actions/checkout@v2 |
| 87 | + with: |
| 88 | + repository: 'EC-CUBE/ec-cube' |
| 89 | + ref: ${{ matrix.eccube_version }} |
| 90 | + path: 'ec-cube' |
| 91 | + |
| 92 | + - name: Get Composer Cache Directory |
| 93 | + id: composer-cache |
| 94 | + run: | |
| 95 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 96 | +
|
| 97 | + - uses: actions/cache@v1 |
| 98 | + with: |
| 99 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 100 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 101 | + restore-keys: | |
| 102 | + ${{ runner.os }}-composer- |
| 103 | +
|
| 104 | + - if: matrix.composer == 'v1' |
| 105 | + run: sudo composer selfupdate --1 |
| 106 | + |
| 107 | + - name: Install to composer |
| 108 | + working-directory: 'ec-cube' |
| 109 | + run: composer install --no-interaction -o --apcu-autoloader |
| 110 | + |
| 111 | + - if: matrix.composer == 'v1' |
| 112 | + working-directory: 'ec-cube' |
| 113 | + run: composer require kiy0taka/eccube4-test-fixer "dev-main@dev" |
| 114 | + |
| 115 | + - name: Setup EC-CUBE |
| 116 | + env: |
| 117 | + DB: ${{ matrix.db }} |
| 118 | + USER: ${{ matrix.dbuser }} |
| 119 | + DBUSER: ${{ matrix.dbuser }} |
| 120 | + DBPASS: ${{ matrix.dbpass }} |
| 121 | + DBNAME: ${{ matrix.dbname }} |
| 122 | + DBPORT: ${{ matrix.dbport }} |
| 123 | + DBSERVER: 127.0.0.1 |
| 124 | + DBVERSION: ${{ matrix.dbversion }} |
| 125 | + ROOT_URLPATH: /ec-cube/html |
| 126 | + working-directory: 'ec-cube' |
| 127 | + run: | |
| 128 | + export PGPASSWORD=${DBPASS} |
| 129 | + echo "APP_ENV=prod" > .env |
| 130 | + echo "APP_DEBUG=0" >> .env |
| 131 | + echo "DATABASE_URL=${DB}://${DBUSER}:${DBPASS}@${DBSERVER}/${DBNAME}" >> .env |
| 132 | + echo "DATABASE_SERVER_VERSION=${DBVERSION}" >> .env |
| 133 | + echo "MAILER_URL=smtp://127.0.0.1:1025" >> .env |
| 134 | + echo "HTTP_SITEURL=https://localhost" >> .env |
| 135 | + echo "USE_SELFSIGNED_SSL_CERTIFICATE=1" >> .env |
| 136 | + cat .env |
| 137 | + bin/console doctrine:schema:create |
| 138 | + bin/console eccube:fixtures:load |
| 139 | +
|
| 140 | + - name: Setup Plugin |
| 141 | + env: |
| 142 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 143 | + working-directory: 'ec-cube' |
| 144 | + run: | |
| 145 | + bin/console eccube:plugin:install --code=${PLUGIN_CODE} --path=${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz |
| 146 | + bin/console eccube:plugin:enable --code=${PLUGIN_CODE} |
| 147 | + rm codeception/_support/*Tester.php |
| 148 | +
|
| 149 | + - name: Run PHPUnit |
| 150 | + if: matrix.composer == 'v2' |
| 151 | + env: |
| 152 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 153 | + working-directory: 'ec-cube' |
| 154 | + run: bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests |
| 155 | + |
| 156 | + - name: Run PHPUnit |
| 157 | + if: matrix.composer == 'v1' |
| 158 | + env: |
| 159 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 160 | + working-directory: 'ec-cube' |
| 161 | + run: | |
| 162 | + find app/Plugin/${PLUGIN_CODE}/Tests -name "*Test.php" | while read TESTCASE |
| 163 | + do |
| 164 | + ./vendor/bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist --include-path vendor/kiy0taka/eccube4-test-fixer/src --loader 'Eccube\PHPUnit\Loader\Eccube4CompatTestSuiteLoader' ${TESTCASE} |
| 165 | + done |
| 166 | +
|
| 167 | + - name: Disable Plugin |
| 168 | + working-directory: 'ec-cube' |
| 169 | + env: |
| 170 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 171 | + run: bin/console eccube:plugin:disable --code=${PLUGIN_CODE} |
| 172 | + |
| 173 | + - name: Uninstall Plugin |
| 174 | + env: |
| 175 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 176 | + working-directory: 'ec-cube' |
| 177 | + run: bin/console eccube:plugin:uninstall --code=${PLUGIN_CODE} |
0 commit comments