feat: canvas readiness #174
Workflow file for this run
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: 'CI Pull Request' | |
| on: | |
| pull_request: | |
| jobs: | |
| install: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout DIVE | |
| uses: actions/checkout@main | |
| - name: Setup Node.js | |
| uses: actions/setup-node@main | |
| - name: Search for cached dependencies | |
| uses: actions/cache@main | |
| id: yarn-cache | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
| - name: Install DIVE dependencies (if cache not found) | |
| if: steps.yarn-cache.outputs.cache-hit != 'true' | |
| run: yarn | |
| eslint: | |
| runs-on: ubuntu-latest | |
| needs: install | |
| steps: | |
| - name: Checkout DIVE | |
| uses: actions/checkout@main | |
| - name: Search for cached dependencies | |
| uses: actions/cache@main | |
| id: yarn-cache | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
| - name: Install DIVE dependencies (if cache not found) | |
| if: steps.yarn-cache.outputs.cache-hit != 'true' | |
| run: yarn | |
| - name: Lint DIVE | |
| run: yarn lint | |
| unit: | |
| runs-on: ubuntu-latest | |
| needs: install | |
| steps: | |
| - name: Checkout DIVE | |
| uses: actions/checkout@main | |
| - name: Search for cached dependencies | |
| uses: actions/cache@main | |
| id: yarn-cache | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
| - name: Install DIVE dependencies (if cache not found) | |
| if: steps.yarn-cache.outputs.cache-hit != 'true' | |
| run: yarn | |
| - name: Unit-Test DIVE (coverage) | |
| run: yarn coverage | |
| - name: Upload coverage to Codecov (PR comparison) | |
| if: github.actor != 'dependabot[bot]' | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage/coverage-final.json | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true | |
| prettier-check: | |
| runs-on: ubuntu-latest | |
| needs: install | |
| steps: | |
| - name: Checkout DIVE | |
| uses: actions/checkout@main | |
| - name: Search for cached dependencies | |
| uses: actions/cache@main | |
| id: yarn-cache | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
| - name: Install DIVE dependencies (if cache not found) | |
| if: steps.yarn-cache.outputs.cache-hit != 'true' | |
| run: yarn | |
| - name: Prettier check DIVE | |
| run: yarn prettier:check | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: install | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Search for cached dependencies | |
| uses: actions/cache@main | |
| id: yarn-cache | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
| - name: Install dependencies (if cache not found) | |
| if: steps.yarn-cache.outputs.cache-hit != 'true' | |
| run: yarn | |
| - name: Build DIVE | |
| run: yarn build | |
| check-docs: | |
| runs-on: ubuntu-latest | |
| needs: install | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Search for cached dependencies | |
| uses: actions/cache@main | |
| id: yarn-cache | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
| - name: Install dependencies (if cache not found) | |
| if: steps.yarn-cache.outputs.cache-hit != 'true' | |
| run: yarn | |
| - name: Update docs | |
| run: yarn docs | |
| - name: Check for docs changes | |
| run: | | |
| echo "Checking for generated docs changes..." | |
| if [[ -n "$(git diff --name-only src/plugins/state/README.md)" ]]; then | |
| echo "Docs have changes:" | |
| git diff src/plugins/state/README.md | |
| echo "Please make sure to run 'yarn docs' and commit the changes." | |
| exit 1 | |
| fi | |
| echo "Docs are up to date." | |
| e2e: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: github.actor != 'dependabot[bot]' | |
| steps: | |
| - name: Trigger demo app pipeline and wait for result | |
| env: | |
| DEMO_APP_TOKEN: ${{ secrets.DEMO_APP_TOKEN }} | |
| DEMO_APP_REPO: 'shopware/dive-demo' | |
| PR_BRANCH: ${{ github.head_ref }} | |
| PR_SHA: ${{ github.event.pull_request.head.sha }} | |
| run: | | |
| set -e | |
| echo "Triggering demo app E2E tests for PR: $PR_BRANCH" | |
| # Step 1: Trigger the workflow via repository_dispatch | |
| RESPONSE=$(curl -X POST \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| -H "Authorization: token $DEMO_APP_TOKEN" \ | |
| https://api.github.com/repos/$DEMO_APP_REPO/dispatches \ | |
| -d '{ | |
| "event_type": "dive-pr-e2e", | |
| "client_payload": { | |
| "dive_ref": "'$PR_BRANCH'", | |
| "pr_number": "'${{ github.event.pull_request.number }}'", | |
| "dive_sha": "'$PR_SHA'" | |
| } | |
| }') | |
| echo "Workflow triggered. Waiting for completion..." | |
| # Step 2: Wait for workflow to appear in runs | |
| MAX_WAIT=600 # 10 minutes total | |
| WAIT_COUNT=0 | |
| RUN_ID="" | |
| while [ -z "$RUN_ID" ] && [ $WAIT_COUNT -lt $MAX_WAIT ]; do | |
| sleep 2 | |
| WAIT_COUNT=$((WAIT_COUNT + 2)) | |
| # Get the latest workflow run | |
| RUNS=$(curl -s -H "Authorization: token $DEMO_APP_TOKEN" \ | |
| "https://api.github.com/repos/$DEMO_APP_REPO/actions/runs?per_page=1" | jq -r '.workflow_runs[0]') | |
| RUN_ID=$(echo $RUNS | jq -r '.id // empty') | |
| if [ -n "$RUN_ID" ] && [ "$RUN_ID" != "null" ]; then | |
| LOGS_URL="https://github.com/$DEMO_APP_REPO/actions/runs/$RUN_ID" | |
| echo "Found workflow run: $RUN_ID" | |
| echo "View logs at: $LOGS_URL" | |
| echo "::notice::E2E Tests started: $LOGS_URL" | |
| fi | |
| done | |
| if [ -z "$RUN_ID" ] || [ "$RUN_ID" == "null" ]; then | |
| echo "Timeout waiting for workflow to start" | |
| exit 1 | |
| fi | |
| # Step 3: Poll for completion | |
| echo "Monitoring workflow run $RUN_ID..." | |
| STATUS="queued" | |
| while [ "$STATUS" != "completed" ]; do | |
| sleep 10 | |
| WORKFLOW_INFO=$(curl -s -H "Authorization: token $DEMO_APP_TOKEN" \ | |
| "https://api.github.com/repos/$DEMO_APP_REPO/actions/runs/$RUN_ID") | |
| STATUS=$(echo $WORKFLOW_INFO | jq -r '.status') | |
| CONCLUSION=$(echo $WORKFLOW_INFO | jq -r '.conclusion // "pending"') | |
| echo "Workflow status: $STATUS (conclusion: $CONCLUSION)" | |
| if [ "$STATUS" == "completed" ]; then | |
| # Get logs URL | |
| LOGS_URL=$(echo $WORKFLOW_INFO | jq -r '.html_url') | |
| echo "Workflow completed! View logs: $LOGS_URL" | |
| if [ "$CONCLUSION" != "success" ]; then | |
| echo "Demo app E2E tests failed!" | |
| exit 1 | |
| fi | |
| echo "Demo app E2E tests passed!" | |
| break | |
| fi | |
| # Timeout after 30 minutes | |
| WAIT_COUNT=$((WAIT_COUNT + 10)) | |
| if [ $WAIT_COUNT -ge 1800 ]; then | |
| echo "Workflow did not complete in time" | |
| exit 1 | |
| fi | |
| done | |
| publish-dry-run: | |
| runs-on: ubuntu-latest | |
| needs: [unit, eslint, build, prettier-check, check-docs] | |
| if: github.actor != 'dependabot[bot]' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Search for cached dependencies | |
| uses: actions/cache@main | |
| id: yarn-cache | |
| with: | |
| path: node_modules | |
| key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} | |
| - name: Install dependencies (if cache not found) | |
| if: steps.yarn-cache.outputs.cache-hit != 'true' | |
| run: yarn | |
| - name: Build DIVE | |
| run: yarn build | |
| - name: Publish DIVE to npm (dry-run) | |
| run: npm publish --dry-run --access public |