[shopsys] rename variable differentDeliveryAddress into isDeliveryAddressDifferentFromBilling #5964
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
on: | |
push: | |
branches: | |
- 'master' | |
- '[0-9]+.[0-9]+' | |
tags: | |
- '**' | |
pull_request: | |
branches: | |
- '**' | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
name: Docker build | |
jobs: | |
variables: | |
name: Prepare variables and artifacts | |
runs-on: ubuntu-22.04 | |
outputs: | |
DOCKER_PHP_FPM_REPOSITORY_TAG: ${{ steps.variables.outputs.DOCKER_PHP_FPM_REPOSITORY_TAG }} | |
DOCKER_STOREFRONT_REPOSITORY_TAG: ${{ steps.variables.outputs.DOCKER_STOREFRONT_REPOSITORY_TAG }} | |
DOCKER_STOREFRONT_CI_REPOSITORY_TAG: ${{ steps.variables.outputs.DOCKER_STOREFRONT_CI_REPOSITORY_TAG }} | |
DOCKER_STOREFRONT_CI_IMAGE_EXISTS: ${{ steps.variables.outputs.DOCKER_STOREFRONT_CI_IMAGE_EXISTS }} | |
DOCKER_ELASTICSEARCH_REPOSITORY_TAG: ${{ steps.variables.outputs.DOCKER_ELASTICSEARCH_REPOSITORY_TAG }} | |
DOCKER_ELASTICSEARCH_IMAGE_EXISTS: ${{ steps.variables.outputs.DOCKER_ELASTICSEARCH_IMAGE_EXISTS }} | |
BRANCH_NAME: ${{ steps.variables.outputs.BRANCH_NAME }} | |
BRANCH_NAME_ESCAPED: ${{ steps.variables.outputs.BRANCH_NAME_ESCAPED }} | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Extract variables to output | |
id: variables | |
env: | |
DOCKER_USERNAME: ${{ github.repository_owner }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
DOCKER_PHP_FPM_REPOSITORY_TAG=ghcr.io/${DOCKER_USERNAME}/php-fpm:github-action-${{ github.sha }} | |
DOCKER_STOREFRONT_IMAGE_TAG=github-action-${{ github.sha }} | |
DOCKER_STOREFRONT_REPOSITORY_TAG=ghcr.io/${DOCKER_USERNAME}/storefront:${DOCKER_STOREFRONT_IMAGE_TAG} | |
DOCKER_STOREFRONT_CI_IMAGE_TAG=github-action-`find project-base/storefront/docker -type f -exec stat -c "%a %n" {} \; -exec cat {} \; | md5sum | awk '{ print $1 }'`-ci | |
DOCKER_STOREFRONT_CI_REPOSITORY_TAG=ghcr.io/${DOCKER_USERNAME}/storefront:${DOCKER_STOREFRONT_CI_IMAGE_TAG} | |
DOCKER_STOREFRONT_CI_IMAGE_EXISTS=`. .github/check-image-exists.sh && checkImageExists ${DOCKER_USERNAME} storefront ${DOCKER_STOREFRONT_CI_IMAGE_TAG} ${GITHUB_TOKEN} > /dev/null ; echo $?` | |
DOCKER_ELASTICSEARCH_IMAGE_TAG=github-action-`find project-base/app/docker/elasticsearch -type f -exec stat -c "%a %n" {} \; -exec cat {} \; | md5sum | awk '{ print $1 }'` | |
DOCKER_ELASTICSEARCH_REPOSITORY_TAG=ghcr.io/${DOCKER_USERNAME}/elasticsearch:${DOCKER_ELASTICSEARCH_IMAGE_TAG} | |
DOCKER_ELASTICSEARCH_IMAGE_EXISTS=`. .github/check-image-exists.sh && checkImageExists ${DOCKER_USERNAME} elasticsearch ${DOCKER_ELASTICSEARCH_IMAGE_TAG} ${GITHUB_TOKEN} > /dev/null ; echo $?` | |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} | |
BRANCH_NAME="${BRANCH,,}" | |
BRANCH_NAME_ESCAPED="${BRANCH_NAME//./-}" | |
echo "BRANCH_NAME=${BRANCH_NAME}" >> $GITHUB_OUTPUT | |
echo "BRANCH_NAME_ESCAPED=${BRANCH_NAME_ESCAPED}" >> $GITHUB_OUTPUT | |
echo "DOCKER_PHP_FPM_REPOSITORY_TAG=${DOCKER_PHP_FPM_REPOSITORY_TAG}" >> $GITHUB_OUTPUT | |
echo "DOCKER_STOREFRONT_REPOSITORY_TAG=${DOCKER_STOREFRONT_REPOSITORY_TAG}" >> $GITHUB_OUTPUT | |
echo "DOCKER_STOREFRONT_CI_REPOSITORY_TAG=${DOCKER_STOREFRONT_CI_REPOSITORY_TAG}" >> $GITHUB_OUTPUT | |
echo "DOCKER_STOREFRONT_CI_IMAGE_EXISTS=${DOCKER_STOREFRONT_CI_IMAGE_EXISTS}" >> $GITHUB_OUTPUT | |
echo "DOCKER_ELASTICSEARCH_REPOSITORY_TAG=${DOCKER_ELASTICSEARCH_REPOSITORY_TAG}" >> $GITHUB_OUTPUT | |
echo "DOCKER_ELASTICSEARCH_IMAGE_EXISTS=${DOCKER_ELASTICSEARCH_IMAGE_EXISTS}" >> $GITHUB_OUTPUT | |
- name: Prepare docker-compose.yml file from docker-compose.github-actions.yml.dist | |
run: | | |
sh .github/prepare-docker-compose-file.sh \ | |
"./docker/conf/docker-compose.github-actions.yml.dist" \ | |
"./docker-compose.yml" \ | |
"${{ steps.variables.outputs.DOCKER_PHP_FPM_REPOSITORY_TAG }}" \ | |
"${{ steps.variables.outputs.DOCKER_STOREFRONT_CI_REPOSITORY_TAG }}" \ | |
"${{ steps.variables.outputs.DOCKER_ELASTICSEARCH_REPOSITORY_TAG }}" | |
- name: Prepare docker-compose.review.yml file from docker-compose.github-actions.review.yml.dist | |
run: | | |
sh .github/prepare-docker-compose-file.sh \ | |
"./docker/conf/docker-compose.github-actions.review.yml.dist" \ | |
"./docker-compose.review.yml" \ | |
"${{ steps.variables.outputs.DOCKER_PHP_FPM_REPOSITORY_TAG }}" \ | |
"${{ steps.variables.outputs.DOCKER_STOREFRONT_REPOSITORY_TAG }}" \ | |
"${{ steps.variables.outputs.DOCKER_ELASTICSEARCH_REPOSITORY_TAG }}" | |
- name: Prepare docker-compose.review.simplified.yml file from docker-compose.github-actions.review.simplified.yml.dist | |
run: | | |
sh .github/prepare-docker-compose-file.sh \ | |
"./docker/conf/docker-compose.github-actions.review.simplified.yml.dist" \ | |
"./docker-compose.review.simplified.yml" \ | |
"${{ steps.variables.outputs.DOCKER_PHP_FPM_REPOSITORY_TAG }}" \ | |
"${{ steps.variables.outputs.DOCKER_STOREFRONT_REPOSITORY_TAG }}" | |
- name: Set TRAEFIK_HOSTS ENV variables | |
run: | | |
HOST=${{ steps.variables.outputs.BRANCH_NAME_ESCAPED }}.${{ vars.REVIEW_STAGE_URL }} | |
echo "TRAEFIK_HOSTS=\`$HOST\`, \`cz.$HOST\`" >> $GITHUB_ENV | |
- name: Replace variables in docker-compose.review.yml | |
run: | | |
sed -i "s#BRANCH_NAME#${{ steps.variables.outputs.BRANCH_NAME_ESCAPED }}#g" ./docker-compose.review.yml | |
sed -i "s#TRAEFIK_HOSTS#${TRAEFIK_HOSTS}#" ./docker-compose.review.yml | |
- name: Replace variables in docker-compose.review.simplified.yml | |
run: | | |
sed -i "s#BRANCH_NAME#${{ steps.variables.outputs.BRANCH_NAME_ESCAPED }}#g" ./docker-compose.review.simplified.yml | |
sed -i "s#TRAEFIK_HOSTS#${TRAEFIK_HOSTS}#" ./docker-compose.review.simplified.yml | |
- name: Prepare docker-compose.cypress.yml file from docker-compose.github-actions.cypress.yml.dist | |
run: | | |
sh .github/prepare-docker-compose-file.sh \ | |
"./docker/conf/docker-compose.github-actions.cypress.yml.dist" \ | |
"./docker-compose.cypress.yml" \ | |
"${{ steps.variables.outputs.DOCKER_PHP_FPM_REPOSITORY_TAG }}" \ | |
"${{ steps.variables.outputs.DOCKER_STOREFRONT_REPOSITORY_TAG }}" \ | |
"${{ steps.variables.outputs.DOCKER_ELASTICSEARCH_REPOSITORY_TAG }}" | |
- name: Upload docker-compose.yml to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker-compose | |
path: ./docker-compose.yml | |
- name: Upload docker-compose.review.yml to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker-compose-review | |
path: ./docker-compose.review.yml | |
- name: Upload docker-compose.review.simplified.yml to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker-compose-review-simplified | |
path: ./docker-compose.review.simplified.yml | |
- name: Upload docker-compose.cypress.yml to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docker-compose-cypress | |
path: ./docker-compose.cypress.yml | |
- name: Upload set-urls-for-review.sh to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: set-urls-for-review | |
path: ./.github/set-urls-for-review.sh | |
- name: Upload rabbitmq-vhost.sh to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: rabbitmq-vhost-sh | |
path: ./.github/rabbitmq-vhost.sh | |
build-php-fpm-image: | |
if: | | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
name: Build PHP-FPM image | |
runs-on: ubuntu-22.04 | |
needs: variables | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build custom base image if requested | |
if: "contains(github.event.pull_request.labels.*.name, 'Use PHP Dockerfile instead of built image')" | |
run: | | |
TAG=`grep -m1 -E '^FROM [^ ]+' project-base/app/docker/php-fpm/Dockerfile | awk '{print $2}' | cut -d ':' -f 1,2` | |
docker build --tag ${TAG} --no-cache --compress -f ./packages/php-image/Dockerfile ./packages/php-image | |
- name: Create branch specific PHP-FPM image with project files | |
run: | | |
.github/build-php-fpm-image.sh "${{ needs.variables.outputs.DOCKER_PHP_FPM_REPOSITORY_TAG }}" ci | |
docker image push "${{ needs.variables.outputs.DOCKER_PHP_FPM_REPOSITORY_TAG }}" | |
build-storefront-image: | |
if: | | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
name: Build storefront image | |
runs-on: ubuntu-22.04 | |
needs: variables | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Storefront image and push it to GitHub Container Registry | |
run: | | |
.github/build-storefront-image.sh ${{ needs.variables.outputs.DOCKER_STOREFRONT_REPOSITORY_TAG }} | |
docker image push ${{ needs.variables.outputs.DOCKER_STOREFRONT_REPOSITORY_TAG }} | |
build-storefront-ci-image: | |
if: | | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
needs.variables.outputs.DOCKER_STOREFRONT_CI_IMAGE_EXISTS == 0 | |
name: Build storefront CI image | |
runs-on: ubuntu-22.04 | |
needs: variables | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Storefront CI image and push it to GitHub Container Registry | |
run: | | |
.github/build-storefront-ci-image.sh ${{ needs.variables.outputs.DOCKER_STOREFRONT_CI_REPOSITORY_TAG }} | |
docker image push ${{ needs.variables.outputs.DOCKER_STOREFRONT_CI_REPOSITORY_TAG }} | |
build-elasticsearch-image: | |
if: | | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
needs.variables.outputs.DOCKER_ELASTICSEARCH_IMAGE_EXISTS == 0 | |
name: Build Elasticsearch image | |
runs-on: ubuntu-22.04 | |
needs: variables | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Elasticsearch image and push it to GitHub Container Registry | |
run: | | |
.github/build-elasticsearch-image.sh ${{ needs.variables.outputs.DOCKER_ELASTICSEARCH_REPOSITORY_TAG }} | |
docker image push ${{ needs.variables.outputs.DOCKER_ELASTICSEARCH_REPOSITORY_TAG }} | |
standards: | |
name: Check standards | |
needs: build-php-fpm-image | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-php-fpm-image.result == 'success' || needs.build-php-fpm-image.result == 'skipped') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Download docker-compose.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose | |
- name: Build application | |
run: docker compose up -d php-fpm | |
- name: Check standards | |
run: | | |
docker compose exec -T php-fpm touch ./project-base/app/DEVELOPMENT | |
docker compose exec -T php-fpm php phing -D production.confirm.action=y composer-dev standards | |
- name: Check GraphQl schema | |
run: docker compose exec -T php-fpm project-base/app/check-schema.sh | |
standards-storefront: | |
name: Check Storefront standards | |
needs: [build-php-fpm-image, build-storefront-ci-image] | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-php-fpm-image.result == 'success' || needs.build-php-fpm-image.result == 'skipped') && | |
(needs.build-storefront-ci-image.result == 'success' || needs.build-storefront-ci-image.result == 'skipped') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download docker-compose.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose | |
- name: Build application | |
run: docker compose up -d --wait storefront php-fpm | |
- name: Move schema.graphql to Storefront container | |
run: docker compose cp ./project-base/app/schema.graphql storefront:/home/node/app/schema.graphql | |
- name: Check no NEXT_PUBLIC_ variables are used | |
run: | | |
docker compose exec --user root storefront apk add grep | |
docker compose exec storefront sh check-next-public-variable.sh | |
- name: Check graphql schema files are up to date | |
run: | | |
docker compose exec php-fpm php phing frontend-api-generate-graphql-schema | |
docker compose cp php-fpm:/var/www/html/project-base/app/schema.graphql /tmp/schema.graphql | |
docker compose cp /tmp/schema.graphql storefront:/home/node/app/schema.graphql | |
docker compose exec storefront sh check-code-gen.sh | |
- name: Check standards | |
run: docker compose exec storefront pnpm run check | |
- name: Storefront container logs | |
if: ${{ failure() }} | |
run: docker compose logs storefront | |
- name: PHP-FPM container logs | |
if: ${{ failure() }} | |
run: docker compose logs php-fpm | |
- name: Nginx container logs | |
if: ${{ failure() }} | |
run: docker compose logs webserver | |
unit-test-storefront: | |
name: Run unit tests of Storefront | |
needs: [build-storefront-ci-image] | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-storefront-ci-image.result == 'success' || needs.build-storefront-ci-image.result == 'skipped') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download docker-compose.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose | |
- name: Build application | |
run: docker compose up -d --wait storefront | |
- name: Run unit tests | |
run: docker compose exec storefront pnpm test--no-watch | |
- name: Storefront container logs | |
if: ${{ failure() }} | |
run: docker compose logs storefront | |
tests-unit-functional-smoke: | |
name: Run unit, functional and smoke tests | |
needs: [build-php-fpm-image, build-storefront-image, build-elasticsearch-image] | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-php-fpm-image.result == 'success' || needs.build-php-fpm-image.result == 'skipped') && | |
(needs.build-storefront-image.result == 'success' || needs.build-storefront-image.result == 'skipped') && | |
(needs.build-elasticsearch-image.result == 'success' || needs.build-elasticsearch-image.result == 'skipped') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download docker-compose.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose | |
- name: Build application | |
run: | | |
docker compose pull --parallel postgres webserver elasticsearch redis php-fpm storefront | |
docker compose up -d postgres webserver elasticsearch redis php-fpm storefront | |
docker compose exec -T php-fpm php phing -D production.confirm.action=y -D change.environment=dev environment-change test-dirs-create db-create test-db-create db-demo elasticsearch-index-recreate elasticsearch-export error-pages-generate | |
- name: Run tests | |
run: docker compose exec -T php-fpm php phing -D production.confirm.action=y tests | |
- name: PHP-FPM container logs | |
if: ${{ failure() }} | |
run: docker compose logs php-fpm | |
- name: Storefront container logs | |
if: ${{ failure() }} | |
run: docker compose logs storefront | |
- name: Nginx container logs | |
if: ${{ failure() }} | |
run: docker compose logs webserver | |
tests-acceptance: | |
name: Run acceptance tests | |
needs: [build-php-fpm-image, build-elasticsearch-image] | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-php-fpm-image.result == 'success' || needs.build-php-fpm-image.result == 'skipped') && | |
(needs.build-elasticsearch-image.result == 'success' || needs.build-elasticsearch-image.result == 'skipped') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download docker-compose.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose | |
- name: Build application | |
run: | | |
docker compose pull --parallel webserver postgres elasticsearch redis php-fpm storefront selenium-server | |
docker compose up -d | |
docker compose exec -T php-fpm php phing -D production.confirm.action=y -D change.environment=dev environment-change dirs-create test-dirs-create db-create test-db-create db-demo error-pages-generate test-db-demo test-elasticsearch-index-recreate test-elasticsearch-export tests-acceptance-build | |
- name: Run acceptance tests | |
run: docker compose exec -T php-fpm php phing -D production.confirm.action=y tests-acceptance | |
- name: PHP-FPM container logs | |
if: ${{ failure() }} | |
run: docker compose logs php-fpm | |
- name: Copy Codeception logs from container | |
if: ${{ failure() }} | |
run: docker cp shopsys-framework-php-fpm:/var/www/html/project-base/app/var/log ./project-base/app/var/log | |
- name: Upload Codeception logs to artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: acceptance-logs | |
path: ./project-base/app/var/log/ | |
tests-storefront-acceptance: | |
name: Run Cypress tests | |
needs: [build-php-fpm-image, build-storefront-image, build-elasticsearch-image] | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-php-fpm-image.result == 'success' || needs.build-php-fpm-image.result == 'skipped') && | |
(needs.build-storefront-image.result == 'success' || needs.build-storefront-image.result == 'skipped') && | |
(needs.build-elasticsearch-image.result == 'success' || needs.build-elasticsearch-image.result == 'skipped') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download docker-compose.cypress.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose-cypress | |
- name: Build application | |
run: | | |
mv docker-compose.cypress.yml docker-compose.yml | |
docker compose up -d --wait | |
docker compose exec php-fpm php phing -D production.confirm.action=y db-create frontend-api-generate-new-keys build-demo-dev-quick error-pages-generate elasticsearch-index-recreate elasticsearch-export | |
- name: Run Cypress tests | |
run: docker compose run cypress | |
- name: Upload Cypress videos to artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-videos | |
path: ./videos | |
- name: Upload Cypress screenshots to artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-screenshots | |
path: ./screenshots | |
- name: Upload Cypress snapshot diffs to artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-snapshot-diffs | |
path: ./snapshotDiffs | |
- name: PHP-FPM container logs | |
if: ${{ failure() }} | |
run: docker compose logs php-fpm | |
- name: Nginx container logs | |
if: ${{ failure() }} | |
run: docker compose logs webserver | |
- name: Storefront container logs | |
if: ${{ failure() }} | |
run: docker compose logs storefront | |
- name: Cypress container logs | |
if: ${{ failure() }} | |
run: docker compose logs cypress | |
translations-dump-check: | |
name: Check all translations are dumped | |
needs: build-php-fpm-image | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-php-fpm-image.result == 'success' || needs.build-php-fpm-image.result == 'skipped') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download docker-compose.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose | |
- name: Build application | |
run: docker compose up -d php-fpm storefront | |
- name: Check translations are dumped | |
run: | | |
docker compose exec -T php-fpm composer install --optimize-autoloader --no-interaction | |
docker compose exec -T php-fpm php phing translations-dump | |
docker compose cp php-fpm:/var/www/html/ . | |
cp -a ./html/. ./ | |
rm -rf ./html | |
docker compose exec -T storefront npm run translate | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Not all translations are dumped"; | |
git status | |
exit 1; | |
else | |
echo "All translations are dumped"; | |
exit 0; | |
fi | |
check-console-commands: | |
name: Check that all console commands that are not used during installation are passing | |
needs: build-php-fpm-image | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-php-fpm-image.result == 'success' || needs.build-php-fpm-image.result == 'skipped') | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Download docker-compose.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose | |
- name: Build application | |
run: | | |
docker compose up -d | |
docker compose exec -T php-fpm composer install --optimize-autoloader --no-interaction --dev | |
docker compose exec -T php-fpm php phing -D production.confirm.action=y db-create frontend-api-generate-new-keys build-demo-dev-quick error-pages-generate elasticsearch-index-recreate elasticsearch-export | |
- name: Check all commands are passing | |
run: | | |
docker compose exec -T php-fpm php phing -D production.confirm.action=y cron-list cron-run-all-serially cron-watch maintenance-on maintenance-off elasticsearch-export-changed | |
docker compose exec -T php-fpm php bin/console shopsys:categories:recalculate | |
docker compose exec -T php-fpm php bin/console shopsys:cdn-domain-url:replace | |
docker compose exec -T php-fpm php bin/console shopsys:list:export-scopes | |
docker compose exec -T php-fpm php bin/console shopsys:dispatch:recalculations 1 | |
build-fork-docker-images: | |
if: | | |
github.event.pull_request.head.repo.full_name != 'shopsys/shopsys' && | |
github.ref_protected != true | |
name: Build application and run standards checks and tests | |
runs-on: ubuntu-22.04 | |
needs: variables | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Build Elasticsearch image | |
if: needs.variables.outputs.DOCKER_ELASTICSEARCH_IMAGE_EXISTS == 0 | |
run: .github/build-elasticsearch-image.sh ${{ needs.variables.outputs.DOCKER_ELASTICSEARCH_REPOSITORY_TAG }} | |
- name: Build Storefront image | |
if: needs.variables.outputs.DOCKER_STOREFRONT_IMAGE_EXISTS == 0 | |
run: .github/build-storefront-image.sh ${{ needs.variables.outputs.DOCKER_STOREFRONT_REPOSITORY_TAG }} | |
- name: Build Storefront CI image | |
if: needs.variables.outputs.DOCKER_STOREFRONT_CI_IMAGE_EXISTS == 0 | |
run: .github/build-storefront-ci-image.sh ${{ needs.variables.outputs.DOCKER_STOREFRONT_CI_REPOSITORY_TAG }} | |
- name: Build PHP-FPM image | |
run: .github/build-php-fpm-image.sh ${{ needs.variables.outputs.DOCKER_PHP_FPM_REPOSITORY_TAG }} base | |
- name: Download docker-compose.cypress.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose | |
- name: Build PHP-FPM part of application | |
run: | | |
docker compose up -d --force-recreate | |
docker cp ./ shopsys-framework-php-fpm:/var/www/html | |
docker compose exec -T --user root php-fpm chown -R www-data:www-data /var/www/html | |
docker compose exec -T php-fpm rm -rf /var/www/html/composer.lock /var/www/html/project-base/package-lock.json /var/www/html/project-base/migrations-lock.yml /var/www/html/project-base/storefront | |
docker compose exec -T php-fpm composer install --optimize-autoloader --no-interaction | |
docker compose exec -T php-fpm php phing -D production.confirm.action=y -D change.environment=dev environment-change dirs-create test-dirs-create assets npm build-version-generate db-create test-db-create db-demo elasticsearch-index-recreate elasticsearch-export error-pages-generate test-db-demo test-elasticsearch-index-recreate test-elasticsearch-export tests-acceptance-build | |
- name: Check standards | |
run: docker compose exec -T php-fpm php phing standards | |
- name: Run tests | |
run: docker compose exec -T php-fpm php phing tests | |
- name: Run acceptance tests | |
run: docker compose exec -T php-fpm php phing tests-acceptance | |
- name: Check translations are dumped | |
run: | | |
docker compose exec -T php-fpm php phing translations-dump | |
docker compose cp php-fpm:/var/www/html/ . | |
rm -rf ./html/.git | |
cp -a ./html/. ./ | |
rm -rf ./html | |
docker compose exec -T storefront npm run translate | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "Not all translations are dumped"; | |
git status | |
exit 1; | |
else | |
echo "All translations are dumped"; | |
exit 0; | |
fi | |
- name: Check all not previously used commands are passing | |
run: | | |
docker compose exec -T php-fpm php phing -D production.confirm.action=y frontend-api-enable cron-list cron-run-all-serially cron-watch maintenance-on maintenance-off elasticsearch-export-changed | |
docker compose exec -T php-fpm php bin/console shopsys:categories:recalculate | |
docker compose exec -T php-fpm php bin/console shopsys:cdn-domain-url:replace | |
docker compose exec -T php-fpm php bin/console shopsys:list:export-scopes | |
docker compose exec -T php-fpm php bin/console shopsys:dispatch:recalculations 1 | |
- name: PHP-FPM container logs | |
if: ${{ failure() }} | |
run: docker compose logs php-fpm | |
- name: Storefront container logs | |
if: ${{ failure() }} | |
run: docker compose logs storefront | |
- name: Copy Codeception logs from container | |
if: ${{ failure() }} | |
run: docker cp shopsys-framework-php-fpm:/var/www/html/project-base/app/var/log ./project-base/app/var/log | |
- name: Upload Codeception logs to artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: acceptance-logs | |
path: ./project-base/app/var/log/ | |
- name: Build Storefront part of application | |
run: | | |
docker compose cp ./project-base/app/schema.graphql storefront:/home/node/app/schema.graphql | |
docker compose exec storefront pnpm install --frozen-lockfile | |
- name: Check no NEXT_PUBLIC_ variables are used in Storefront | |
run: | | |
docker compose exec --user root storefront apk add grep | |
docker compose exec storefront sh check-next-public-variable.sh | |
- name: Check graphql schema files are up to date | |
run: | | |
docker compose exec php-fpm php phing frontend-api-generate-graphql-schema | |
docker compose cp php-fpm:/var/www/html/project-base/app/schema.graphql /tmp/schema.graphql | |
docker compose cp /tmp/schema.graphql storefront:/home/node/app/schema.graphql | |
docker compose exec storefront sh check-code-gen.sh | |
- name: Check Storefront standards | |
run: docker compose exec storefront pnpm run check | |
- name: Run storefront unit tests | |
run: docker compose exec storefront pnpm test--no-watch | |
- name: Storefront container logs | |
if: ${{ failure() }} | |
run: docker compose logs storefront | |
- name: PHP-FPM container logs | |
if: ${{ failure() }} | |
run: docker compose logs php-fpm | |
- name: Download docker-compose.cypress.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose-cypress | |
- name: Stop previous running application | |
run: docker compose down | |
- name: Build application | |
run: | | |
mv docker-compose.cypress.yml docker-compose.yml | |
docker compose up -d --wait | |
docker cp ./ shopsys-framework-php-fpm:/var/www/html | |
docker compose exec -T --user root php-fpm chown -R www-data:www-data /var/www/html | |
docker compose exec -T php-fpm rm -rf /var/www/html/composer.lock /var/www/html/project-base/package-lock.json /var/www/html/project-base/migrations-lock.yml | |
docker compose exec -T php-fpm composer install --optimize-autoloader --no-interaction | |
docker compose exec php-fpm php phing -D production.confirm.action=y db-create frontend-api-generate-new-keys build-demo-dev-quick error-pages-generate elasticsearch-index-recreate elasticsearch-export | |
- name: Run Cypress tests | |
run: docker compose run cypress | |
- name: Upload Cypress videos to artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-videos | |
path: ./videos | |
- name: Upload Cypress screenshots to artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-screenshots | |
path: ./screenshots | |
- name: Upload Cypress snapshot diffs to artifacts | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cypress-snapshot-diffs | |
path: ./snapshotDiffs | |
- name: PHP-FPM container logs | |
if: ${{ failure() }} | |
run: docker compose logs php-fpm | |
- name: Nginx container logs | |
if: ${{ failure() }} | |
run: docker compose logs webserver | |
- name: Storefront container logs | |
if: ${{ failure() }} | |
run: docker compose logs storefront | |
- name: Cypress container logs | |
if: ${{ failure() }} | |
run: docker compose logs cypress | |
review: | |
name: Review | |
needs: [variables, build-php-fpm-image, build-storefront-image, build-elasticsearch-image] | |
if: | | |
always() && !failure() && !cancelled() && | |
( | |
github.event.pull_request.head.repo.full_name == 'shopsys/shopsys' || | |
github.ref_protected == true | |
) && | |
(needs.build-php-fpm-image.result == 'success' || needs.build-php-fpm-image.result == 'skipped') && | |
(needs.build-storefront-image.result == 'success' || needs.build-storefront-image.result == 'skipped') && | |
(needs.build-elasticsearch-image.result == 'success' || needs.build-elasticsearch-image.result == 'skipped') | |
runs-on: [self-hosted, linux, review-stage] | |
timeout-minutes: 10 | |
env: | |
BRANCH_NAME: ${{ needs.variables.outputs.BRANCH_NAME }} | |
BRANCH_NAME_ESCAPED: ${{ needs.variables.outputs.BRANCH_NAME_ESCAPED }} | |
steps: | |
- name: Create branch directory | |
run: | | |
rm -rf ${BRANCH_NAME} | |
mkdir ${BRANCH_NAME} | |
- name: Set ENV variables required for review | |
run: | | |
HOST=${BRANCH_NAME_ESCAPED}.${{ vars.REVIEW_STAGE_URL }} | |
echo "HOSTS=${HOST}, cz.${HOST}" >> $GITHUB_ENV | |
- name: Download docker-compose.review.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose-review | |
- name: Download docker-compose.review.simplified.yml from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: docker-compose-review-simplified | |
- name: Download set-urls-for-review-sh from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: set-urls-for-review | |
path: ${{ needs.variables.outputs.BRANCH_NAME }} | |
- name: Download rabbitmq-vhost-sh from artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: rabbitmq-vhost-sh | |
path: ${{ needs.variables.outputs.BRANCH_NAME }} | |
- name: Move docker-compose.review.yml to branch folder | |
if: "contains(github.event.pull_request.labels.*.name, 'Use docker-compose defined services for review')" | |
run: | | |
mv docker-compose.review.yml ${BRANCH_NAME}/docker-compose.yml | |
- name: Move docker-compose.review.simplified.yml to branch folder | |
if: "!contains(github.event.pull_request.labels.*.name, 'Use docker-compose defined services for review')" | |
run: | | |
mv docker-compose.review.simplified.yml ${BRANCH_NAME}/docker-compose.yml | |
bash ./${BRANCH_NAME}/rabbitmq-vhost.sh create ${BRANCH_NAME_ESCAPED} | |
- name: Update docker-compose.yaml with secrets | |
run: | | |
sed -i "s#GOPAY_GOID#${{ secrets.GOPAY_GOID }}#" "${BRANCH_NAME}/docker-compose.yml" | |
sed -i "s#GOPAY_CLIENTID#${{ secrets.GOPAY_CLIENTID }}#" "${BRANCH_NAME}/docker-compose.yml" | |
sed -i "s#GOPAY_CLIENTSECRET#${{ secrets.GOPAY_CLIENTSECRET }}#" "${BRANCH_NAME}/docker-compose.yml" | |
sed -i "s#PACKETERY_API_KEY_VALUE#${{ secrets.PACKETERY_API_KEY }}#" "${BRANCH_NAME}/docker-compose.yml" | |
sed -i "s#PACKETERY_API_PASSWORD_VALUE#${{ secrets.PACKETERY_API_PASSWORD }}#" "${BRANCH_NAME}/docker-compose.yml" | |
- name: Start project | |
run: | | |
cd ${BRANCH_NAME} | |
chmod +x set-urls-for-review.sh | |
./set-urls-for-review.sh setDomainsToDockerCompose | |
docker compose down -v --remove-orphans || true | |
docker compose up -d --wait --force-recreate | |
./set-urls-for-review.sh setUrlsToDomainsUrls | |
docker compose exec -T php-fpm php phing -D production.confirm.action=y db-create frontend-api-generate-new-keys demo-data error-pages-generate warmup | |
docker compose exec -T php-consumer php phing -D production.confirm.action=y frontend-api-generate-new-keys | |
./set-urls-for-review.sh printDomains | |
- name: Add Review URL to Pull request description | |
uses: Jerome1337/comment-pull-request@v1.0.4 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
description-message: | | |
---- | |
:globe_with_meridians: Live Preview: | |
- https://${{ needs.variables.outputs.BRANCH_NAME_ESCAPED }}.${{ vars.REVIEW_STAGE_URL }} | |
- https://cz.${{ needs.variables.outputs.BRANCH_NAME_ESCAPED }}.${{ vars.REVIEW_STAGE_URL }} | |
delete-previous-comment: false | |
build-successful: | |
if: ${{ always() }} | |
name: Build successful | |
needs: [tests-acceptance, standards, tests-unit-functional-smoke, standards-storefront, translations-dump-check, review, build-fork-docker-images] | |
runs-on: ubuntu-22.04 | |
env: | |
BUILD_FORK_RESULT: ${{ needs.build-fork-docker-images.result }} | |
STANDARDS_RESULT: ${{ needs.standards.result }} | |
TESTS_RESULT: ${{ needs.tests-unit-functional-smoke.result }} | |
TESTS_ACCEPTANCE_RESULT: ${{ needs.tests-acceptance.result }} | |
STANDARDS_STOREFRONT_RESULT: ${{ needs.standards-storefront.result }} | |
TRANSLATIONS_DUMP_RESULT: ${{ needs.translations-dump-check.result }} | |
REVIEW_RESULT: ${{ needs.review.result }} | |
steps: | |
- name: GIT checkout branch - ${{ github.ref }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Build successful | |
run: | | |
EXIT_CODE=`. .github/get-build-exit-code.sh && getBuildExitCodeBasedOnJobResults ${BUILD_FORK_RESULT} ${STANDARDS_RESULT} ${TESTS_RESULT} ${TESTS_ACCEPTANCE_RESULT} ${STANDARDS_STOREFRONT_RESULT} ${TRANSLATIONS_DUMP_RESULT} ${REVIEW_RESULT} > /dev/null ; echo $?` | |
exit "${EXIT_CODE}" |