build-args を修正 #1066
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD for EC-CUBE | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
paths: | |
- '**' | |
- '!*.md' | |
pull_request: | |
paths: | |
- '**' | |
- '!*.md' | |
jobs: | |
run-on-linux: | |
name: Run on Linux | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-22.04 ] | |
php: [ '5.4', '5.5', '5.6', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2snapshot' ] | |
db: [ mysql, pgsql ] | |
include: | |
- db: mysql | |
dbport: '3306' | |
dbuser: 'root' | |
dbpass: 'password' | |
dbname: 'eccube_db' | |
- db: pgsql | |
dbport: '5432' | |
dbuser: 'postgres' | |
dbpass: 'password' | |
dbname: 'eccube_db' | |
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:15 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: postgres | |
POSTGRES_HOST_AUTH_METHOD: md5 | |
POSTGRES_INITDB_ARGS: --auth-host=md5 | |
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@v3 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
# see https://github.com/composer/composer/issues/10340 | |
- run: sudo composer selfupdate --2.2 | |
if: matrix.php < 7.2 | |
- name: composer install | |
run: composer install --no-interaction -o | |
- name: Setup PHP | |
uses: nanasess/setup-php@master | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Setup PHP5.6 | |
if: matrix.php == '5.6' | |
run: sudo apt-fast install -y php5.6-fpm | |
- name: php-fpm | |
env: | |
PHP_VERSION: ${{ matrix.php }} | |
run: | | |
if [ -f /lib/systemd/system/php${PHP_VERSION}-fpm.service ] | |
then | |
sudo systemctl enable php${PHP_VERSION}-fpm | |
fi | |
- name: Install symfony/cli | |
# server:ca:install でエラーは出るが利用可能 | |
continue-on-error: true | |
run: | | |
sudo apt-fast -y install libnss3-tools | |
wget https://get.symfony.com/cli/installer -O - | bash | |
sudo mv ~/.symfony/bin/symfony /usr/local/bin/symfony | |
symfony local:php:list | |
symfony server:ca:install | |
- name: Create ADMIN_DIR | |
run: | | |
sudo apt-fast install -y sharutils | |
echo "ADMIN_DIR=$(head -c 10 < /dev/random | uuencode -m - | tail -n 2 |head -n 1 | sed 's,[/+],_,g' | head -c10)/" >> $GITHUB_ENV | |
- name: Setup to EC-CUBE | |
env: | |
DB: ${{ matrix.db }} | |
USER: ${{ matrix.dbuser }} | |
DBUSER: ${{ matrix.dbuser }} | |
DBPASS: ${{ matrix.dbpass }} | |
DBNAME: ${{ matrix.dbname }} | |
DBPORT: ${{ matrix.dbport }} | |
HTTP_URL: https://127.0.0.1:8085/ | |
HTTPS_URL: https://127.0.0.1:8085/ | |
run: | | |
sudo apt-fast install -y mysql-client postgresql-client | |
./eccube_install.sh ${DB} | |
- name: setup-chromedriver | |
uses: nanasess/setup-chromedriver@master | |
- run: sleep 1 | |
- name: Run to PHPUnit | |
run: data/vendor/bin/phpunit --exclude-group classloader | |
- name: Run to PHPUnit classloader | |
run: data/vendor/bin/phpunit --group classloader | |
- name: Run to PHPUnit SessionFactory | |
run: data/vendor/bin/phpunit tests/class/SC_SessionFactoryTest.php | |
- name: Upload logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: linux-php${{ matrix.php }}-${{ matrix.db }}-logs | |
path: data/logs | |
run-on-windows: | |
name: Run on Windows | |
runs-on: ${{ matrix.operating-system }} | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ windows-2019 ] | |
php: [ 5.5, 5.6, 7.1, 7.2, 7.3, 7.4 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- uses: actions/cache@v3 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**\composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- run: echo "extension=gd" >> C:/tools/php/php.ini | |
shell: bash | |
# see https://github.com/composer/composer/issues/10340 | |
- run: composer selfupdate --2.2 | |
if: matrix.php < 7.2 | |
- name: composer install | |
run: composer install --no-interaction -o | |
- name: Setup to database | |
run: | | |
choco install -y mysql --version 5.7.18 | |
mysql --user=root -e "CREATE DATABASE eccube_db DEFAULT COLLATE=utf8_general_ci;" | |
mysql --user=root -e "GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;FLUSH PRIVILEGES;" | |
- name: Setup PHP | |
uses: nanasess/setup-php@master | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Setup to EC-CUBE | |
env: | |
DB: mysql | |
USER: root | |
DBUSER: root | |
DBPASS: password | |
DBNAME: eccube_db | |
DBPORT: 3306 | |
DBSERVER: 127.0.0.1 | |
HTTP_URL: http://127.0.0.1:8085/ | |
HTTPS_URL: http://127.0.0.1:8085/ | |
run: bash eccube_install.sh mysql | |
shell: bash | |
- run: sleep 1 | |
shell: bash | |
- name: Run to PHPUnit | |
run: data/vendor/bin/phpunit --exclude-group classloader | |
- name: Run to PHPUnit classloader | |
run: data/vendor/bin/phpunit --group classloader | |
- name: Run to PHPUnit SessionFactory | |
run: | | |
sed 's|http://|https://|g' -i.bak data/config/config.php | |
data/vendor/bin/phpunit tests/class/SC_SessionFactoryTest.php | |
- name: Upload logs | |
if: failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: windows-php${{ matrix.php }}-${{ matrix.db }}-logs | |
path: data\logs |