Feat: General Improvements on product readme files #1248
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: Cypress E2E Tests | |
on: | |
pull_request: | |
types: [opened, synchronize, ready_for_review] | |
workflow_dispatch: | |
# Cancels all previous workflow runs for pull requests that have not completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the branch name for pull requests | |
# or the commit hash for any other events. | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
detect_categories: | |
name: Detecting E2E Test Categories | |
runs-on: ubuntu-latest | |
outputs: | |
categories: ${{ steps.set_categories.outputs.categories }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js and install dependencies | |
uses: ./.github/setup-node | |
- name: List test categories | |
id: set_categories | |
run: | | |
categories=$(node .github/scripts/list-e2e-test-categories.js) | |
categories_json=$(echo $categories | jq -c '.') | |
echo "categories=$categories_json" >> $GITHUB_OUTPUT | |
- name: Print categories output | |
run: | | |
echo "Detected categories: ${{ steps.set_categories.outputs.categories }}" | |
cypress_e2e_tests: | |
name: Test | |
needs: detect_categories | |
runs-on: ubuntu-latest | |
if: ${{ github.repository == 'blockeraai/blockera' || github.event_name == 'pull_request' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
category: ${{ fromJson(needs.detect_categories.outputs.categories) }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup Node.js and install dependencies | |
uses: ./.github/setup-node | |
- name: Install Cypress | |
run: npx cypress install | |
- name: Install Composer Packages | |
run: composer install --no-dev -o --apcu-autoloader -a | |
- name: Create required environment files | |
run: | | |
case "${{ matrix.category }}" in | |
"woocommerce") | |
echo '{"plugins": [".", "https://downloads.wordpress.org/plugin/woocommerce.latest-stable.zip"], "config": {"BLOCKERA_TELEMETRY_OPT_IN_OFF": true}}' >> .wp-env.json | |
;; | |
"freemius") | |
echo '{"plugins": ["."]}' >> .wp-env.json | |
;; | |
"plugins") | |
echo '{"plugins": [".", "https://downloads.wordpress.org/plugin/icon-block.latest-stable.zip"], "config": {"BLOCKERA_TELEMETRY_OPT_IN_OFF": true}}' >> .wp-env.json | |
;; | |
*) | |
echo '{"plugins": [".", "https://downloads.wordpress.org/plugin/svg-support.latest-stable.zip"], "config": {"BLOCKERA_TELEMETRY_OPT_IN_OFF": true}}' >> .wp-env.json | |
;; | |
esac | |
cat .wp-env.json | |
touch .env | |
echo APP_MODE=production >> .env | |
echo DB=wp_tests >> .env | |
cat .env | |
- name: Start WordPress Environment | |
run: npm run env:start | |
- name: Build wp-env app | |
run: npm run build | |
- name: Debug Matrix Category | |
run: | | |
echo "Running category: ${{ matrix.category }}" | |
- name: Run Cypress E2E Tests | |
run: | | |
if [ "${{ matrix.category }}" != "general" ]; then | |
spec_pattern="packages/**/*.${{ matrix.category }}.e2e.cy.js" | |
else | |
spec_pattern=$(find packages -type f -name "*.e2e.cy.js" ! -name "*.*.e2e.cy.js" | tr '\n' ',') | |
spec_pattern="${spec_pattern%,}" # Remove trailing comma | |
fi | |
npm run test:e2e -- --spec "$spec_pattern" | |
- name: Stop WordPress Environment | |
run: npm run env:stop |