Skip to content

Commit

Permalink
ci(e2e): configure applitools intergration
Browse files Browse the repository at this point in the history
Configure Cypress E2E tests to upload results to applitools,
if the APPLITOOLS_API_KEY GitHub Actions secret is available.

If this secret is unavailable, then Applitools is not used.
  • Loading branch information
aloisklink committed Sep 14, 2022
1 parent 20d22a6 commit dbbe95c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on: [push, pull_request]
permissions:
contents: read

env:
# on PRs from forks, this secret will always be empty, for security reasons
USE_APPLI: ${{ secrets.APPLITOOLS_API_KEY && 'true' || '' }}

jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -32,7 +36,26 @@ jobs:
- name: Run Build
run: yarn build

- if: ${{ env.USE_APPLI }}
name: Notify applitools of new batch
# Copied from docs https://applitools.com/docs/topics/integrations/github-integration-ci-setup.html
run: curl -L -d '' -X POST "$APPLITOOLS_SERVER_URL/api/externals/github/push?apiKey=$APPLITOOLS_API_KEY&CommitSha=$GITHUB_SHA&BranchName=${APPLITOOLS_BRANCH}$&ParentBranchName=$APPLITOOLS_PARENT_BRANCH"
env:
# e.g. mermaid-js/mermaid/my-branch
APPLITOOLS_BRANCH: ${{ github.repository }}/${{ github.ref_name }}
APPLITOOLS_PARENT_BRANCH: develop
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com'

- name: Run E2E Tests
run: yarn e2e
env:
CYPRESS_CACHE_FOLDER: .cache/Cypress
# Mermaid applitools.config.js uses this to pick batch name.
APPLI_BRANCH: ${{ github.ref_name }}
APPLITOOLS_BATCH_ID: ${{ github.sha }}
# e.g. mermaid-js/mermaid/my-branch
APPLITOOLS_BRANCH: ${{ github.repository }}/${{ github.ref_name }}
APPLITOOLS_PARENT_BRANCH: develop
APPLITOOLS_API_KEY: ${{ secrets.APPLITOOLS_API_KEY }}
APPLITOOLS_SERVER_URL: 'https://eyesapi.applitools.com'

0 comments on commit dbbe95c

Please sign in to comment.