2.7 KB70 lines
Blame
1name: E2E (Applitools)
2
3on:
4 workflow_dispatch:
5 # Because we want to limit Applitools usage, so we only want to start this
6 # workflow on rare occasions/manually.
7 inputs:
8 parent_branch:
9 required: true
10 type: string
11 default: master
12 description: 'Parent branch to use for PRs'
13
14concurrency: ${{ github.workflow }}-${{ github.ref }}
15
16permissions:
17 contents: read
18
19env:
20 # on PRs from forks, this secret will always be empty, for security reasons
21 USE_APPLI: ${{ secrets.APPLITOOLS_API_KEY && 'true' || '' }}
22
23jobs:
24 e2e-applitools:
25 runs-on: ubuntu-latest
26 steps:
27 - if: ${{ ! env.USE_APPLI }}
28 name: Warn if not using Applitools
29 run: |
30 echo "::error,title=Not using Applitools::APPLITOOLS_API_KEY is empty, disabling Applitools for this run."
31
32 - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33
34 - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
35 # uses version from "packageManager" field in package.json
36
37 - name: Setup Node.js
38 uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
39 with:
40 node-version-file: '.node-version'
41
42 - if: ${{ env.USE_APPLI }}
43 name: Notify applitools of new batch
44 # Copied from docs https://applitools.com/docs/topics/integrations/github-integration-ci-setup.html
45 env:
46 # e.g. mermaid-js/mermaid/my-branch
47 APPLITOOLS_BRANCH: ${{ github.repository }}/${{ github.ref_name }}
48 APPLITOOLS_PARENT_BRANCH: ${{ github.event.inputs.parent_branch }}
49 APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
50 APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com'
51 uses: wei/curl@012398a392d02480afa2720780031f8621d5f94c
52 with:
53 args: -X POST "$APPLITOOLS_SERVER_URL/api/externals/github/push?apiKey=$APPLITOOLS_API_KEY&CommitSha=$GITHUB_SHA&BranchName=${APPLITOOLS_BRANCH}$&ParentBranchName=$APPLITOOLS_PARENT_BRANCH"
54
55 - name: Cypress run
56 uses: cypress-io/github-action@108b8684ae52e735ff7891524cbffbcd4be5b19f # v6.7.16
57 id: cypress
58 with:
59 start: pnpm run dev
60 wait-on: 'http://localhost:9000'
61 env:
62 # Mermaid applitools.config.js uses this to pick batch name.
63 APPLI_BRANCH: ${{ github.ref_name }}
64 APPLITOOLS_BATCH_ID: ${{ github.sha }}
65 # e.g. mermaid-js/mermaid/my-branch
66 APPLITOOLS_BRANCH: ${{ github.repository }}/${{ github.ref_name }}
67 APPLITOOLS_PARENT_BRANCH: ${{ github.event.inputs.parent_branch }}
68 APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
69 APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com'
70