Merge pull request #6272 from EC-CUBE/dependabot/composer/symfony/pol… #583
Workflow file for this run
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: Testing dockerbuild | |
on: | |
push: | |
paths: | |
- '**' | |
- '!*.md' | |
release: | |
types: [ published ] | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
dockerbuild: | |
name: dockerbuild | |
runs-on: ${{ matrix.operating-system }} | |
permissions: | |
contents: read | |
packages: write | |
strategy: | |
fail-fast: false | |
matrix: | |
operating-system: [ ubuntu-22.04 ] | |
php: [ '8.1', '8.2', '8.3' ] | |
db: [ pgsql ] | |
group: [ admin01 ] | |
include: | |
- db: pgsql | |
database_url: postgres://dbuser:secret@127.0.0.1:15432/eccubedb | |
database_server_version: 14 | |
- group: admin01 | |
app_env: 'codeception' | |
- php: '8.1' | |
tag: '8.1-apache' | |
- php: '8.2' | |
tag: '8.2-apache' | |
- php: '8.3' | |
tag: '8.3-apache' | |
steps: | |
- name: downcase REPO | |
run: | | |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}-php" >> ${GITHUB_ENV} | |
- name: Checkout | |
uses: actions/checkout@master | |
## 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 PHP | |
uses: nanasess/setup-php@master | |
with: | |
php-version: ${{ matrix.php }} | |
- name: Initialize Composer | |
uses: ./.github/actions/composer | |
- 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- | |
- 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: TAG=${{ matrix.tag }} | |
- name: Setup to EC-CUBE | |
env: | |
APP_ENV: ${{ matrix.app_env }} | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
REGISTRY: ${{ env.REGISTRY }} | |
IMAGE_NAME: ${{ env.IMAGE_NAME }} | |
TAG: ${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }} | |
run: | | |
docker compose -f docker-compose.yml -f docker-compose.pgsql.yml up -d --wait | |
sed -i 's!APP_ENV: "dev"!APP_ENV: "prod"!g' docker-compose.yml | |
sed -i 's!APP_DEBUG: 1!APP_DEBUG: 0!g' docker-compose.yml | |
docker compose -f docker-compose.yml -f docker-compose.pgsql.yml up -d --wait | |
- name: setup-chromedriver | |
uses: nanasess/setup-chromedriver@master | |
- name: Run chromedriver | |
run: | | |
export DISPLAY=:99 | |
chromedriver --url-base=/wd/hub & | |
echo ">>> Started chrome-driver" | |
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & | |
echo ">>> Started xvfb" | |
- name: Codeception | |
env: | |
APP_ENV: ${{ matrix.app_env }} | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
MAILER_URL: 'smtp://127.0.0.1:1025' | |
GROUP: ${{ matrix.group }} | |
SYMFONY_DEPRECATIONS_HELPER: weak | |
run: | | |
echo "APP_ENV=${APP_ENV}" > .env | |
sed -i "s|%GITHUB_WORKSPACE%|${GITHUB_WORKSPACE}|g" codeception/_envs/github_action_docker.yml | |
vendor/bin/codecept -vvv run acceptance --env chrome,github_action_docker -g ${GROUP} --html report.html | |
## 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: TAG=${{ matrix.tag }} | |
- name: Upload evidence | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codeception-${{ matrix.group }}-evidence | |
path: codeception/_output/ | |
- name: Upload logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: codeception-${{ matrix.group }}-logs | |
path: var/log/ |