Skip to content

wip

wip #253

on: [push]
name: "Docker build"
jobs:
build-whole-application:
name: Build application and run standards checks and tests
runs-on: 'ubuntu-20.04'
steps:
- 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: Ensure Symfony 4 version
run: docker-compose exec -T php-fpm composer update
- 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 ./var/log
- name: Upload Codeception logs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: acceptance-logs
path: ./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 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: Run Cypress tests
run: docker compose run cypress
- name: Upload Cypress videos to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: cypress-videos
path: ./videos
- name: Upload Cypress screenshots to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: cypress-screenshots
path: ./screenshots
- 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-20.04'
steps:
- 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: |
./.github/keep-only-first-domain.sh
cat ./next.config.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
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 stays more than one last line 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: Ensure Symfony 4 version
run: docker-compose exec -T php-fpm composer update
- 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 ./var/log
- name: Upload Codeception logs to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: acceptance-logs
path: ./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 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: Run Cypress tests
run: docker compose run cypress
- name: Upload Cypress videos to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: cypress-videos
path: ./videos
- name: Upload Cypress screenshots to artifacts
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: cypress-screenshots
path: ./screenshots
- 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