Skip to content
Snippets Groups Projects
Unverified Commit be065255 authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

Run Percy inside E2E main workflow (#23480)

* Add Percy to the main E2E workflow

* Ignore unit tests

* Delete Percy workflow

* Do not run Percy tests on Cypress changes only

* Check whether visual regression tests should run at all
parent 4c55a0e6
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ on:
- "docs/**"
- "**.md"
- ".circleci/**"
- "**unit.spec.js"
jobs:
......@@ -156,3 +157,61 @@ jobs:
./cypress
./logs/test.log
if-no-files-found: ignore
visual-regression-tests:
if: env.PERCY_TOKEN != null && ${{ github.ref == 'refs/heads/master' }}
runs-on: ubuntu-20.04
timeout-minutes: 45
needs: build
name: percy-screenshot-recording-${{ matrix.edition }}
env:
MB_EDITION: ${{ matrix.edition }}
ENTERPRISE_TOKEN: ${{ secrets.ENTERPRISE_TOKEN }}
strategy:
matrix:
java-version: [11]
edition: [ee]
services:
maildev:
image: maildev/maildev:1.1.0
ports:
- "80:80"
- "25:25"
credentials:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare JDK ${{ matrix.java-version }}
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: 'temurin'
- name: Prepare Cypress environment
uses: ./.github/actions/prepare-cypress
- uses: actions/download-artifact@v2
name: Retrieve uberjar artifact for ${{ matrix.edition }}
with:
name: metabase-${{ matrix.edition }}-uberjar
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Percy Test
run: |
CHANGED_SPECS=$(git diff --name-only origin/${{ github.base_ref }} origin/${{ github.head_ref }})
CYPRESS_SPECS=$(echo "$CHANGED_SPECS" | grep "metabase/scenarios")
if [ "$CHANGED_SPECS" == "" ]; then
echo "No files have been changed";
elif [ "$CHANGED_SPECS" == "$CYPRESS_SPECS" ]; then
echo "Not running Percy because the only changed files are Cypress E2E specs";
else
echo "Run Percy visual tests";
yarn run test-visual-run
fi
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
# Triggers Percy job on push to master and release branches to create baseline screenshots
name: Percy
on:
push:
branches:
- master
paths-ignore:
- "docs/**"
- "**.md"
- "**unit.spec.js"
- "frontend/test/**"
- "!frontend/test/metabase-visual/**"
jobs:
percy:
timeout-minutes: 45
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Prepare front-end environment
uses: ./.github/actions/prepare-frontend
- name: Prepare back-end environment
uses: ./.github/actions/prepare-backend
- name: Prepare cypress environment
uses: ./.github/actions/prepare-cypress
- run: ./bin/build
- name: Get the version info
run: |
jar xf target/uberjar/metabase.jar version.properties
mv version.properties resources/
- name: Run maildev
run: docker run -d -p 80:80 -p 25:25 maildev/maildev:1.1.0
- name: Percy Test
run: yarn run test-visual-run
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
if: env.PERCY_TOKEN != null
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment