Skip to content

Commit

Permalink
Merge remote-tracking branch 'ofc/master' into seasoft-829
Browse files Browse the repository at this point in the history
  • Loading branch information
seasoftjapan committed Sep 8, 2024
2 parents a23d6b7 + fc5a36a commit c80bc7c
Show file tree
Hide file tree
Showing 207 changed files with 8,101 additions and 5,676 deletions.
75 changes: 75 additions & 0 deletions .github/actions/dockerbuild/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: 'Docker build action'
description: 'Builds a Docker image for PHP'
inputs:
php-version:
description: 'PHP version to build'
default: '7.4'
required: true
registry:
description: 'Docker registry to push to'
default: 'ghcr.io'
required: true
cache-to:
description: 'Add the Docker build layer to the cache'
default: ~
required: false

runs:
using: "composite"
steps:
- name: downcase REPO
shell: 'bash'
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}-php" >> ${GITHUB_ENV}
- if: ${{ inputs.php-version >= 7.4 }}
shell: 'bash'
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}
## 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: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ inputs.registry }}/${{ env.IMAGE_NAME }}
tags: |
# set latest tag for default branch
type=raw,value=${{ inputs.php-version }}-apache,prefix=,enable={{is_default_branch}}
type=ref,event=branch,prefix=${{ inputs.php-version }}-apache-
type=ref,event=tag,prefix=${{ inputs.php-version }}-apache-
type=ref,event=pr,prefix=${{ inputs.php-version }}-apache-pr-
type=match,prefix=${{ inputs.php-version }}-apache-,pattern=eccube-(.*),group=1
type=match,prefix=${{ inputs.php-version }}-apache-,pattern=eccube2-weekly-(.*),group=1
type=semver,pattern={{raw}}
type=sha,format=short
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- 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 }}
cache-from: type=gha,timeout=1m,scope=php-${{ inputs.php-version }}
cache-to: ${{ inputs.cache-to }}
build-args: |
PHP_VERSION_TAG=${{ inputs.php-version }}
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 }}
40 changes: 0 additions & 40 deletions .github/workflows/auto-merge.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ jobs:
mv data/config/config.php.bak data/config/config.php
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
files: ./coverage1.xml,./coverage2.xml,./coverage3.xml
# token: ${{ secrets.CODECOV_TOKEN }}
token: ${{ secrets.CODECOV_TOKEN }}
flags: tests
# yml: ./codecov.yml
fail_ci_if_error: true
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ jobs:
- name: Upload binaries to release of TGZ
if: env.DEPLOY == 1
uses: svenstaro/upload-release-action@2.7.0
uses: svenstaro/upload-release-action@2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.TAG_NAME }}.tar.gz
Expand All @@ -189,7 +189,7 @@ jobs:
overwrite: true
- name: Upload binaries to release of ZIP
if: env.DEPLOY == 1
uses: svenstaro/upload-release-action@2.7.0
uses: svenstaro/upload-release-action@2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.TAG_NAME }}.zip
Expand All @@ -198,7 +198,7 @@ jobs:
overwrite: true
- name: Upload binaries to release of TGZ md5 checksum
if: env.DEPLOY == 1
uses: svenstaro/upload-release-action@2.7.0
uses: svenstaro/upload-release-action@2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.TAG_NAME }}.tar.gz.checksum.md5
Expand All @@ -207,7 +207,7 @@ jobs:
overwrite: true
- name: Upload binaries to release of TGZ sha1 checksum
if: env.DEPLOY == 1
uses: svenstaro/upload-release-action@2.7.0
uses: svenstaro/upload-release-action@2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.TAG_NAME }}.tar.gz.checksum.sha1
Expand All @@ -216,7 +216,7 @@ jobs:
overwrite: true
- name: Upload binaries to release of TGZ sha256 checksum
if: env.DEPLOY == 1
uses: svenstaro/upload-release-action@2.7.0
uses: svenstaro/upload-release-action@2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.TAG_NAME }}.tar.gz.checksum.sha256
Expand All @@ -225,7 +225,7 @@ jobs:
overwrite: true
- name: Upload binaries to release of ZIP md5 checksum
if: env.DEPLOY == 1
uses: svenstaro/upload-release-action@2.7.0
uses: svenstaro/upload-release-action@2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.TAG_NAME }}.zip.checksum.md5
Expand All @@ -234,7 +234,7 @@ jobs:
overwrite: true
- name: Upload binaries to release of ZIP sha1 checksum
if: env.DEPLOY == 1
uses: svenstaro/upload-release-action@2.7.0
uses: svenstaro/upload-release-action@2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.TAG_NAME }}.zip.checksum.sha1
Expand All @@ -243,7 +243,7 @@ jobs:
overwrite: true
- name: Upload binaries to release of ZIP sha256 checksum
if: env.DEPLOY == 1
uses: svenstaro/upload-release-action@2.7.0
uses: svenstaro/upload-release-action@2.9.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ runner.workspace }}/${{ env.TAG_NAME }}.zip.checksum.sha256
Expand Down
147 changes: 147 additions & 0 deletions .github/workflows/dockerbuild-and-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Docker build and push
on:
push:
branches:
- "master"
paths:
- '**'
- '!*.md'
release:
types: [ published ]
env:
REGISTRY: ghcr.io

jobs:
dockerbuild:
name: dockerbuild
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
php: [ '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 >= 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@v4
## 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@v3
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@v6
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@v6
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@v4
with:
name: linux-php${{ matrix.php }}-evidence
path: 'test-results/'
- name: Upload logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: linux-php${{ matrix.php }}-logs
path: data/logs
Loading

0 comments on commit c80bc7c

Please sign in to comment.