Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into use-smarty42
Browse files Browse the repository at this point in the history
  • Loading branch information
nanasess committed Dec 17, 2023
2 parents 0df2534 + c438132 commit 8603c1f
Show file tree
Hide file tree
Showing 36 changed files with 1,493 additions and 1,487 deletions.
187 changes: 187 additions & 0 deletions .github/workflows/dockerbuild.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
name: Testing dockerbuild
on:
push:
branches:
- "master"
paths:
- '**'
- '!*.md'
release:
types: [ published ]
env:
REGISTRY: ghcr.io

jobs:
dockerbuild:
name: dockerbuild
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]

steps:
- name: downcase REPO
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}-php" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 5.4 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql mbstring" >> ${GITHUB_ENV}
echo "APCU=apcu-4.0.11" >> ${GITHUB_ENV}
echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive/debian-security" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 5.5 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=" >> ${GITHUB_ENV}
echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive/debian-security" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 5.6 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=" >> ${GITHUB_ENV}
echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 7.0 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=apcu" >> ${GITHUB_ENV}
echo "FORCE_YES=" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
- if: ${{ matrix.php >= 7.1 && matrix.php <= 7.3 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=apcu" >> ${GITHUB_ENV}
echo "FORCE_YES=" >> ${GITHUB_ENV}
echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV}
- if: ${{ matrix.php >= 7.4 }}
run: |
echo "GD_OPTIONS=--with-freetype --with-jpeg" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=apcu" >> ${GITHUB_ENV}
echo "FORCE_YES=" >> ${GITHUB_ENV}
echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v3
## 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 environment
run: echo "COMPOSE_FILE=docker-compose.yml:docker-compose.pgsql.yml:docker-compose.owaspzap.yml:docker-compose.owaspzap.daemon.yml" >> $GITHUB_ENV

- 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@v5
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-
type=match,prefix=${{ matrix.php }}-apache-,pattern=eccube-(.*),group=1
type=match,prefix=${{ matrix.php }}-apache-,pattern=eccube2-weekly-(.*),group=1
- name: Build and export to Docker
uses: docker/build-push-action@v5
with:
context: .
load: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PHP_VERSION_TAG=${{ matrix.php }}
GD_OPTIONS=${{ env.GD_OPTIONS }}
EXT_INSTALL_ARGS=${{ env.EXT_INSTALL_ARGS }}
APCU=${{ env.APCU }}
FORCE_YES=${{ env.FORCE_YES }}
APT_REPO=${{ env.APT_REPO }}
APT_SECURITY_REPO=${{ env.APT_SECURITY_REPO }}
- name: Setup to EC-CUBE
env:
REGISTRY: ${{ env.REGISTRY }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}
TAG: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
HTTP_URL: https://127.0.0.1:8085/
HTTPS_URL: https://127.0.0.1:8085/
run: |
sudo chown -R 1001:1000 zap
sudo chmod -R g+w zap
docker-compose up -d
- run: sleep 1
- run: |
yarn install
yarn run playwright install --with-deps chromium
yarn playwright install-deps chromium
- name: Run to E2E testing
env:
GROUP: ${{ matrix.group }}
PATTERN: ${{ matrix.pattern }}
HTTPS_PROXY: 'localhost:8090'
HTTP_PROXY: 'localhost:8090'
CI: 1
FORCE_COLOR: 1
run: yarn test:e2e e2e-tests/test/front_guest

- run: git checkout composer.*
## 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@v5
if: success()
with:
context: .
push: true
# platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
PHP_VERSION_TAG=${{ matrix.php }}
GD_OPTIONS=${{ env.GD_OPTIONS }}
EXT_INSTALL_ARGS=${{ env.EXT_INSTALL_ARGS }}
APCU=${{ env.APCU }}
FORCE_YES=${{ env.FORCE_YES }}
APT_REPO=${{ env.APT_REPO }}
APT_SECURITY_REPO=${{ env.APT_SECURITY_REPO }}
- name: Upload evidence
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux-php${{ matrix.php }}-evidence
path: 'test-results/'
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux-php${{ matrix.php }}-logs
path: data/logs
76 changes: 61 additions & 15 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,12 @@ jobs:
run: cp -rp tests/class/fixtures/page_extends/* data/class_extends/page_extends

- name: Setup to EC-CUBE
env:
HTTP_URL: https://127.0.0.1:8085/
HTTPS_URL: https://127.0.0.1:8085/
run: |
sudo chown -R 1001:1000 zap
sudo chmod -R g+w zap
docker-compose up -d
docker build -t ec-cube2 --build-arg PHP_VERSION_TAG=7.4 .
docker tag ec-cube2 ghcr.io/ec-cube/ec-cube2-php:7.4-apache
TAG=7.4-apache docker-compose up -d
docker-compose exec -T ec-cube composer install
docker-compose exec -T ec-cube composer require ec-cube2/cli "dev-master@dev" --ignore-platform-req=php -W
docker-compose exec -T ec-cube composer update 'symfony/*' --ignore-platform-req=php -W
Expand Down Expand Up @@ -90,12 +89,7 @@ jobs:
fail-fast: false
matrix:
db: [ 'pgsql', 'mysql' ]
tag:
- '5.6-apache'
- '7.1-apache'
- '7.2-apache'
- '7.3-apache'
- '7.4-apache'
php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
include:
- db: mysql
dbport: '3306'
Expand All @@ -110,6 +104,56 @@ jobs:
dbname: 'eccube_db'
dbhost: 'postgres'
steps:
## TODO GitHub Container Registry が使えるようになったら workflow_run で書き直す
- if: ${{ matrix.php == 5.4 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql mbstring" >> ${GITHUB_ENV}
echo "APCU=apcu-4.0.11" >> ${GITHUB_ENV}
echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive/debian-security" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 5.5 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=" >> ${GITHUB_ENV}
echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive/debian-security" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 5.6 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=" >> ${GITHUB_ENV}
echo "FORCE_YES=--force-yes" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
- if: ${{ matrix.php == 7.0 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=apcu" >> ${GITHUB_ENV}
echo "FORCE_YES=" >> ${GITHUB_ENV}
echo "APT_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=cloudfront.debian.net/debian-archive" >> ${GITHUB_ENV}
- if: ${{ matrix.php >= 7.1 && matrix.php <= 7.3 }}
run: |
echo "GD_OPTIONS=--with-freetype-dir=/usr/include --with-jpeg-dir=/usr/include" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=apcu" >> ${GITHUB_ENV}
echo "FORCE_YES=" >> ${GITHUB_ENV}
echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV}
- if: ${{ matrix.php >= 7.4 }}
run: |
echo "GD_OPTIONS=--with-freetype --with-jpeg" >> ${GITHUB_ENV}
echo "EXT_INSTALL_ARGS=gd zip mysqli pgsql opcache" >> ${GITHUB_ENV}
echo "APCU=apcu" >> ${GITHUB_ENV}
echo "FORCE_YES=" >> ${GITHUB_ENV}
echo "APT_REPO=deb.debian.org" >> ${GITHUB_ENV}
echo "APT_SECURITY_REPO=security.debian.org" >> ${GITHUB_ENV}
- name: Checkout
uses: actions/checkout@v3

Expand All @@ -121,13 +165,15 @@ jobs:
env:
HTTP_URL: https://127.0.0.1:8085/
HTTPS_URL: https://127.0.0.1:8085/
TAG: ${{ matrix.tag }}
PHP_VERSION_TAG: ${{ matrix.php }}
run: |
sudo chown -R 1001:1000 zap
sudo chmod -R g+w zap
sh -c 'echo "<?php" >> data/config/config.php'
docker-compose build --build-arg TAG=${TAG} ec-cube
docker-compose up -d
docker build -t ec-cube2 --build-arg PHP_VERSION_TAG="${PHP_VERSION_TAG}" --build-arg GD_OPTIONS="${GD_OPTIONS}" --build-arg EXT_INSTALL_ARGS="${EXT_INSTALL_ARGS}" --build-arg APCU="${APCU}" --build-arg FORCE_YES="${FORCE_YES}" --build-arg APT_REPO="${APT_REPO}" --build-arg APT_SECURITY_REPO="${APT_SECURITY_REPO}" .
docker tag ec-cube2 ghcr.io/ec-cube/ec-cube2-php:${PHP_VERSION_TAG}-apache
TAG=${PHP_VERSION_TAG}-apache docker-compose up -d
- run: docker-compose exec -T ec-cube composer require smarty/smarty "^3.1"
if: matrix.php < 7.1

Expand Down Expand Up @@ -172,11 +218,11 @@ jobs:
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux-php${{ matrix.tag }}-${{ matrix.db }}-logs
name: linux-php${{ matrix.php }}-${{ matrix.db }}-logs
path: html/install/temp/install.log*
- name: Upload evidence
if: failure()
uses: actions/upload-artifact@v3
with:
name: linux-php${{ matrix.tag }}-${{ matrix.db }}-evidence
name: linux-php${{ matrix.php }}-${{ matrix.db }}-evidence
path: 'test-results/'
42 changes: 28 additions & 14 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ jobs:
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' ]
operating-system: [ ubuntu-20.04 ]
php: [ '5.4', '5.5', '5.6', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ]
db: [ mysql, pgsql ]
include:
- db: mysql
Expand Down Expand Up @@ -134,9 +134,12 @@ jobs:

- run: sleep 1
- name: Run to PHPUnit
run: data/vendor/bin/phpunit --exclude-group classloader
run: data/vendor/bin/phpunit --exclude-group classloader,mysql_prepare
- name: Run to PHPUnit classloader
run: data/vendor/bin/phpunit --group classloader
- name: Run to PHPUnit mysql_prepare
# XXX 連続してテストを実行すると、何故か MySQL の prepare statement に失敗するため個別に実行する
run: data/vendor/bin/phpunit --group mysql_prepare
- name: Run to PHPUnit SessionFactory
run: data/vendor/bin/phpunit tests/class/SC_SessionFactoryTest.php

Expand All @@ -153,7 +156,7 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ windows-2019 ]
operating-system: [ windows-2022 ]
php: [ 5.5, 5.6, 7.1, 7.2, 7.3, 7.4 ]
steps:
- name: Checkout
Expand Down Expand Up @@ -184,11 +187,21 @@ jobs:
if: matrix.php < 7.1
shell: bash

- name: Setup to database
- name: Start PostgreSQL on Windows
# see https://www.cybertec-postgresql.com/en/postgresql-github-actions-continuous-integration/
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;"
echo $env:PGBIN >> $Env:GITHUB_PATH
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
$env:PGPASSWORD = 'root'
(Get-Content $env:PGDATA\postgresql.conf) | foreach { $_ -replace "#password_encryption = scram-sha-256","password_encryption = md5" } | Set-Content $env:PGDATA\postgresql.conf
(Get-Content $env:PGDATA\pg_hba.conf) | foreach { $_ -replace "scram-sha-256","md5" } | Set-Content $env:PGDATA\pg_hba.conf
Restart-Service -InputObject $pgService -Force
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
& $env:PGBIN\createuser -U postgres -d -R eccube_db_user
& $env:PGBIN\psql -U postgres -c "ALTER role eccube_db_user with password 'root';" postgres
& $env:PGBIN\createdb --owner=eccube_db_user eccube_db
- name: Setup PHP
uses: nanasess/setup-php@master
Expand All @@ -197,16 +210,17 @@ jobs:

- name: Setup to EC-CUBE
env:
DB: mysql
USER: root
DBUSER: root
DBPASS: password
DB: pgsql
DBUSER: eccube_db_user
DBPASS: root
DBNAME: eccube_db
DBPORT: 3306
DBPORT: 5432
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
run: |
echo $PATH
bash eccube_install.sh pgsql
shell: bash
- run: sleep 1
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3
- name: Checking Security Vulnerabilities
uses: symfonycorp/security-checker-action@v4
uses: symfonycorp/security-checker-action@v5
Loading

0 comments on commit 8603c1f

Please sign in to comment.