|
| 1 | +name: CI for SiteKit42 |
| 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.4', '8.0', '8.1' ] |
| 26 | + db: [ 'mysql', 'mysql8', 'pgsql' ] |
| 27 | + eccube_version: [ '4.2' ] |
| 28 | + plugin_code: [ 'SiteKit42' ] |
| 29 | + include: |
| 30 | + - db: mysql |
| 31 | + database_url: mysql://root:password@127.0.0.1:3306/eccube_db |
| 32 | + database_server_version: 5.7 |
| 33 | + database_charset: utf8mb4 |
| 34 | + - db: mysql8 |
| 35 | + database_url: mysql://root:password@127.0.0.1:3308/eccube_db |
| 36 | + database_server_version: 8 |
| 37 | + database_charset: utf8mb4 |
| 38 | + - db: pgsql |
| 39 | + database_url: postgres://postgres:password@127.0.0.1:5432/eccube_db |
| 40 | + database_server_version: 14 |
| 41 | + database_charset: utf8 |
| 42 | + services: |
| 43 | + mysql: |
| 44 | + image: mysql:5.7 |
| 45 | + env: |
| 46 | + MYSQL_ROOT_PASSWORD: password |
| 47 | + MYSQL_DATABASE: ${{ matrix.dbname }} |
| 48 | + ports: |
| 49 | + - 3306:3306 |
| 50 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 51 | + mysql8: |
| 52 | + image: mysql:8 |
| 53 | + env: |
| 54 | + MYSQL_ROOT_PASSWORD: password |
| 55 | + MYSQL_DATABASE: ${{ matrix.dbname }} |
| 56 | + ports: |
| 57 | + - 3308:3306 |
| 58 | + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 |
| 59 | + postgres: |
| 60 | + image: postgres:14 |
| 61 | + env: |
| 62 | + POSTGRES_USER: postgres |
| 63 | + POSTGRES_PASSWORD: password |
| 64 | + POSTGRES_DB: ${{ matrix.dbname }} |
| 65 | + ports: |
| 66 | + - 5432:5432 |
| 67 | + # needed because the postgres container does not provide a healthcheck |
| 68 | + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 |
| 69 | + mailcatcher: |
| 70 | + image: schickling/mailcatcher |
| 71 | + ports: |
| 72 | + - 1080:1080 |
| 73 | + - 1025:1025 |
| 74 | + steps: |
| 75 | + - run: sudo apt-get purge -y hhvm |
| 76 | + - name: Checkout |
| 77 | + uses: actions/checkout@v2 |
| 78 | + |
| 79 | + - name: Setup PHP |
| 80 | + uses: nanasess/setup-php@master |
| 81 | + with: |
| 82 | + php-version: ${{ matrix.php }} |
| 83 | + |
| 84 | + - name: Archive Plugin |
| 85 | + env: |
| 86 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 87 | + run: | |
| 88 | + tar cvzf ${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz ./* |
| 89 | + - name: Checkout EC-CUBE |
| 90 | + uses: actions/checkout@v2 |
| 91 | + with: |
| 92 | + repository: 'EC-CUBE/ec-cube' |
| 93 | + ref: ${{ matrix.eccube_version }} |
| 94 | + path: 'ec-cube' |
| 95 | + |
| 96 | + - name: Get Composer Cache Directory |
| 97 | + id: composer-cache |
| 98 | + run: | |
| 99 | + echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 100 | + - uses: actions/cache@v1 |
| 101 | + with: |
| 102 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 103 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 104 | + restore-keys: | |
| 105 | + ${{ runner.os }}-composer- |
| 106 | + - name: Install to composer |
| 107 | + working-directory: 'ec-cube' |
| 108 | + run: composer install --no-interaction -o --apcu-autoloader |
| 109 | + |
| 110 | + - name: Setup EC-CUBE |
| 111 | + env: |
| 112 | + APP_ENV: 'test' |
| 113 | + APP_DEBUG: 0 |
| 114 | + DATABASE_URL: ${{ matrix.database_url }} |
| 115 | + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} |
| 116 | + DATABASE_CHARSET: ${{ matrix.database_charset }} |
| 117 | + working-directory: 'ec-cube' |
| 118 | + run: | |
| 119 | + bin/console doctrine:database:create |
| 120 | + bin/console doctrine:schema:create |
| 121 | + bin/console eccube:fixtures:load |
| 122 | + - name: Setup Plugin |
| 123 | + env: |
| 124 | + APP_ENV: 'test' |
| 125 | + APP_DEBUG: 0 |
| 126 | + DATABASE_URL: ${{ matrix.database_url }} |
| 127 | + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} |
| 128 | + DATABASE_CHARSET: ${{ matrix.database_charset }} |
| 129 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 130 | + working-directory: 'ec-cube' |
| 131 | + run: | |
| 132 | + composer require google/apiclient:^2.4 |
| 133 | + bin/console eccube:plugin:install --code=${PLUGIN_CODE} --path=${GITHUB_WORKSPACE}/${PLUGIN_CODE}.tar.gz |
| 134 | + bin/console cache:clear --no-warmup |
| 135 | + bin/console eccube:plugin:enable --code=${PLUGIN_CODE} |
| 136 | + - name: Run PHPUnit |
| 137 | + env: |
| 138 | + APP_ENV: 'test' |
| 139 | + APP_DEBUG: 0 |
| 140 | + DATABASE_URL: ${{ matrix.database_url }} |
| 141 | + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} |
| 142 | + DATABASE_CHARSET: ${{ matrix.database_charset }} |
| 143 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 144 | + working-directory: 'ec-cube' |
| 145 | + run: | |
| 146 | + bin/console cache:clear --no-warmup |
| 147 | + bin/phpunit -c app/Plugin/${PLUGIN_CODE}/phpunit.xml.dist app/Plugin/${PLUGIN_CODE}/Tests |
| 148 | +
|
| 149 | + - name: Disable Plugin |
| 150 | + working-directory: 'ec-cube' |
| 151 | + env: |
| 152 | + APP_ENV: 'test' |
| 153 | + APP_DEBUG: 0 |
| 154 | + DATABASE_URL: ${{ matrix.database_url }} |
| 155 | + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} |
| 156 | + DATABASE_CHARSET: ${{ matrix.database_charset }} |
| 157 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 158 | + run: bin/console eccube:plugin:disable --code=${PLUGIN_CODE} |
| 159 | + |
| 160 | + - name: Uninstall Plugin |
| 161 | + env: |
| 162 | + APP_ENV: 'test' |
| 163 | + APP_DEBUG: 0 |
| 164 | + DATABASE_URL: ${{ matrix.database_url }} |
| 165 | + DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} |
| 166 | + DATABASE_CHARSET: ${{ matrix.database_charset }} |
| 167 | + PLUGIN_CODE: ${{ matrix.plugin_code }} |
| 168 | + working-directory: 'ec-cube' |
| 169 | + run: bin/console eccube:plugin:uninstall --code=${PLUGIN_CODE} |
0 commit comments