Skip to content

[framework] exclude main variant from selling when it has no selling … #857

[framework] exclude main variant from selling when it has no selling …

[framework] exclude main variant from selling when it has no selling … #857

on: [push]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
name: "Docker build"
jobs:
build-whole-application:
name: Build application and run standards checks and tests
runs-on: ubuntu-22.04
steps:
- name: Sleep for 15 seconds to ensure that split packages has been promoted to packagist.org
run: sleep 15s
shell: bash
- name: GIT checkout branch - ${{ github.ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Configure application
run: echo 1 | ./scripts/configure.sh
- name: Install composer dependencies
run: docker compose exec -T php-fpm composer install
- name: Build application
run: docker compose exec -T php-fpm php phing db-create test-db-create frontend-api-generate-new-keys build-demo-dev-quick error-pages-generate
- 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: 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/var/log ./app/var/log
- name: Upload Codeception logs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: acceptance-logs
path: ./app/var/log
- name: Build Storefront part of application
run: |
docker compose cp php-fpm:/var/www/html/schema.graphql schema.graphql
docker compose cp ./schema.graphql storefront:/home/node/app/schema.graphql
docker compose exec storefront pnpm install --frozen-lockfile
- 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: Switch storefront to production mode
run: |
docker compose down storefront
docker compose up -d --wait storefront-cypress
- 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: ./storefront/cypress/videos
- name: Upload Cypress screenshots to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: ./storefront/cypress/screenshots
- name: Upload Cypress snapshot diffs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-snapshot-diffs
path: ./storefront/cypress/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
build-whole-application-for-single-domain:
name: Build application and run standards checks and tests on single domain
runs-on: ubuntu-22.04
steps:
- name: Sleep for 15 seconds to ensure that split packages has been promoted to packagist.org
run: sleep 15s
shell: bash
- name: GIT checkout branch - ${{ github.ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Remove all but first domain from next.config.js
run: |
node ./.github/keep-only-first-domain.js
- name: Configure application
run: echo 1 | ./scripts/configure.sh
- name: Remove other domains than first one from configs
run: |
# delete all domain URLs except URLs for domain with ID 1 in app/config/domains.yaml and app/config/domains_urls.yaml
sed -i '/id: 2/{:a;Q}' app/config/domains_urls.yaml
sed -i '/id: 2/{:a;Q}' app/config/domains.yaml
# sed is removing all content from match to end of file, unfortunately it adds new line (\n) after the replacement
# more info: https://stackoverflow.com/questions/50559170/delete-last-line-break-using-sed
# when there is more than one last line left, the build will fail because of our coding standards
truncate -s -1 app/config/domains_urls.yaml
truncate -s -1 app/config/domains.yaml
- name: Install composer dependencies
run: docker compose exec -T php-fpm composer install
- name: Build application
run: docker compose exec -T php-fpm php phing db-create test-db-create frontend-api-generate-new-keys build-demo-dev-quick error-pages-generate
- 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: 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/var/log ./app/var/log
- name: Upload Codeception logs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: acceptance-logs
path: ./app/var/log
- name: Build Storefront part of application
run: |
docker compose cp php-fpm:/var/www/html/schema.graphql schema.graphql
docker compose cp ./schema.graphql storefront:/home/node/app/schema.graphql
docker compose exec storefront pnpm install --frozen-lockfile
- 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: Switch storefront to production mode
run: |
docker compose down storefront
docker compose up -d --wait storefront-cypress
- 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: ./storefront/cypress/videos
- name: Upload Cypress screenshots to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: ./storefront/cypress/screenshots
- name: Upload Cypress snapshot diffs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: cypress-snapshot-diffs
path: ./storefront/cypress/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