Edit name from account (#210) #77
This file contains hidden or 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: Playwright | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - '*.x' | |
| pull_request: | |
| schedule: | |
| - cron: '0 0 * * *' | |
| workflow_dispatch: | |
| inputs: | |
| update_all_screenshots: | |
| description: 'Update all screenshots?' | |
| type: boolean | |
| env: | |
| PACKAGE: checkout-theme | |
| jobs: | |
| test: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./rapidez/rapidez | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - magento-version: 2.4.7-p7 | |
| magento-php-version: php83-fpm | |
| rapidez-php-version: 8.3 | |
| - magento-version: 2.4.8-p2 | |
| magento-php-version: php84-fpm | |
| rapidez-php-version: 8.4 | |
| screenshots: true | |
| services: | |
| magento: | |
| image: michielgerritsen/magento-project-community-edition:${{matrix.magento-php-version}}-magento${{matrix.magento-version}}-sample-data | |
| env: | |
| URL: http://localhost:1234/ | |
| FLAT_TABLES: true | |
| CUSTOM_ENTRYPOINT_COMMAND: "php bin/magento encryption:key:change -k 5AM3SD5SkwT8iwIxL6L1q8XQhzK3wk51; magerun2 config:store:set system/smtp/disable 1; magerun2 config:store:set checkout/options/enable_guest_checkout_login 1" | |
| ports: | |
| - 3307:3306 | |
| - 1234:80 | |
| elasticsearch: | |
| image: docker.elastic.co/elasticsearch/elasticsearch:8.18.2 | |
| ports: | |
| - 9200:9200 | |
| env: | |
| discovery.type: single-node | |
| ES_JAVA_OPTS: "-Xms512m -Xmx512m" | |
| http.cors.enabled: "true" | |
| http.cors.allow-credentials: "true" | |
| http.cors.allow-origin: "http://localhost:8000" | |
| http.cors.allow-headers: X-Requested-With, X-Auth-Token, Content-Type, Content-Length, Authorization, Access-Control-Allow-Headers, Accept | |
| xpack.security.enabled: "false" | |
| options: >- | |
| --health-cmd="curl http://localhost:9200/_cluster/health" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=10 | |
| name: P${{ matrix.rapidez-php-version }} - M${{matrix.magento-version}} on ${{matrix.magento-php-version}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| path: rapidez/${{ env.PACKAGE }} | |
| fetch-depth: 0 | |
| lfs: true | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: rapidez/rapidez | |
| path: rapidez/rapidez | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: ${{ matrix.rapidez-php-version }} | |
| extensions: mbstring, dom, fileinfo, mysql | |
| coverage: none | |
| - name: Copy testing .env | |
| run: cp ../$PACKAGE/tests/playwright/.env.testing .env | |
| - name: Use Rapidez package from source | |
| run: composer config repositories.$PACKAGE path ../$PACKAGE | |
| - name: Make the Magento version available as env variable | |
| run: echo "MAGENTO_VERSION=${{ matrix.magento-version }}" >> $GITHUB_ENV | |
| - name: Get commit hash and tag of the package | |
| working-directory: ./rapidez/${{ env.PACKAGE }} | |
| run: | | |
| echo "PACKAGE_HASH=$(git symbolic-ref --short HEAD 2>/dev/null || git rev-parse HEAD | sed 's|/|_|g')" >> $GITHUB_ENV | |
| echo "LATEST_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV | |
| - name: Composer require the local rapidez package | |
| run: composer require rapidez/$PACKAGE:"dev-${{ env.PACKAGE_HASH }} as ${{ env.LATEST_TAG }}" | |
| - name: Overwrite core views | |
| run: php artisan vendor:publish --provider="Rapidez\CheckoutTheme\ServiceProvider" --tag=core-overwrites | |
| - name: Publish Rapidez configs | |
| run: php artisan vendor:publish --provider="Rapidez\Core\RapidezServiceProvider" --tag="config" | |
| - name: Configure checkout theme steps | |
| run: sed -i "s/'login',//g" config/rapidez/frontend.php | |
| - name: Install Rapidez command | |
| run: php artisan rapidez:install --frontendonly | |
| - name: Publish payment icons | |
| run: php artisan vendor:publish --tag=payment-icons | |
| - name: Install Yarn dependencies | |
| run: npm install -g yarn && yarn | |
| - name: Install Playwright Browsers | |
| run: yarn playwright install --with-deps | |
| - name: Frontend Build | |
| run: yarn run prod | |
| - name: Install Playwright tests | |
| run: | | |
| cp -r vendor/rapidez/$PACKAGE/tests/playwright tests/playwright | |
| cp vendor/rapidez/$PACKAGE/playwright.config.js playwright.config.js | |
| - name: Wait for index to finish | |
| run: for i in {1..60}; do [[ $(mysql -h 127.0.0.1 -P 3307 -u magento -ppassword -ss -r -e "CALL sys.table_exists('magento', 'catalog_product_flat_1', @exists); SELECT @exists;") == *"BASE TABLE"* ]] && break || sleep 5; done | |
| - name: Rapidez index | |
| run: php artisan rapidez:index | |
| - name: Start the webserver | |
| run: php artisan serve & | |
| - name: Run Playwright tests | |
| run: yarn playwright test | |
| # Screenshots | |
| - name: Collect failed tests | |
| if: (failure() || inputs.update_all_screenshots) | |
| run: yarn playwright test --last-failed --list --reporter=dot --pass-with-no-tests > failed-tests.txt | |
| - name: Update screenshots | |
| if: failure() && matrix.screenshots == true && github.event_name != 'schedule' && !(github.event_name == 'push' && (github.ref_name == 'master' || endsWith(github.ref_name, '.x'))) | |
| run: | | |
| while read -r test_name; do | |
| yarn playwright test "$test_name" --update-snapshots --reporter=list | |
| done < <(awk -F ' › ' 'NF>1{print $2}' failed-tests.txt | xargs -n1 basename | sort -u) | |
| - name: Update all screenshots | |
| if: ${{ inputs.update_all_screenshots && matrix.screenshots == true }} | |
| run: yarn playwright test --update-snapshots --reporter=list | |
| - name: Move the screenshots | |
| if: (failure() || inputs.update_all_screenshots) && matrix.screenshots == true && github.event_name != 'schedule' && !(github.event_name == 'push' && (github.ref_name == 'master' || endsWith(github.ref_name, '.x'))) | |
| run: cp -r tests/playwright/. ../$PACKAGE/tests/playwright/ | |
| - name: Commit the screenshots | |
| if: (failure() || inputs.update_all_screenshots) && matrix.screenshots == true && github.event_name != 'schedule' && !(github.event_name == 'push' && (github.ref_name == 'master' || endsWith(github.ref_name, '.x'))) | |
| uses: stefanzweifel/git-auto-commit-action@v4 | |
| with: | |
| commit_message: "[CI] Update Snapshots" | |
| repository: rapidez/${{ env.PACKAGE }} | |
| # Artifact | |
| - name: Dump docker logs | |
| if: failure() | |
| uses: jwalton/gh-docker-logs@v2 | |
| with: | |
| dest: './docker-logs' | |
| - name: Dump magento logs | |
| if: failure() | |
| working-directory: ${{ github.workspace }} | |
| run: | | |
| mkdir -p magento/var | |
| docker cp ${{ job.services.magento.id }}:/data/var/log magento/var/log | |
| - name: Upload Artifact | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: artifact-P${{ matrix.rapidez-php-version }}-M${{matrix.magento-version}}-on-${{matrix.magento-php-version}} | |
| path: | | |
| rapidez/rapidez/blob-report | |
| rapidez/rapidez/storage/logs/laravel.log | |
| docker-logs | |
| magento/var/log | |
| report: | |
| if: failure() | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| env: | |
| HTML_REPORT_PATH: ${{ github.repository }}/${{ github.ref_name }}/${{ github.run_id }}/${{ github.run_attempt }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: rapidez/playwright-reports | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./reports | |
| merge-multiple: true | |
| - name: Generate HTML report | |
| run: npx playwright merge-reports --reporter html ./reports/rapidez/rapidez/blob-report | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-report | |
| path: playwright-report | |
| - name: Push the new files to github pages | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| personal_token: ${{ secrets.RAPIDEZ_ACTIONS_ACCOUNT_PAT }} | |
| external_repository: rapidez/playwright-reports | |
| publish_dir: ./playwright-report | |
| destination_dir: ${{ env.HTML_REPORT_PATH }} | |
| - name: URL in summary | |
| run: echo "### Test results - https://${{ github.repository_owner }}.github.io/playwright-reports/${{ env.HTML_REPORT_PATH }}/" >> $GITHUB_STEP_SUMMARY |