mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
Merge branch 'develop' into fix/4212_actor_menus_sequence_diagram_popup
This commit is contained in:
commit
d74025bd80
71
.github/workflows/e2e.yml
vendored
71
.github/workflows/e2e.yml
vendored
@ -1,13 +1,25 @@
|
|||||||
|
# We use github cache to save snapshots between runs.
|
||||||
|
# For PRs and MergeQueues, the target commit is used, and for push events, github.event.previous is used.
|
||||||
|
# If a snapshot for a given Hash is not found, we checkout that commit, run the tests and cache the snapshots.
|
||||||
|
# These are then downloaded before running the E2E, providing the reference snapshots.
|
||||||
|
# If there are any errors, the diff image is uploaded to artifacts, and the user is notified.
|
||||||
|
|
||||||
name: E2E
|
name: E2E
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches-ignore:
|
||||||
|
- 'gh-readonly-queue/**'
|
||||||
pull_request:
|
pull_request:
|
||||||
merge_group:
|
merge_group:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
|
env:
|
||||||
|
# For PRs and MergeQueues, the target commit is used, and for push events, github.event.previous is used.
|
||||||
|
targetHash: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha || github.event.before }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cache:
|
cache:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -25,13 +37,14 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
save-always: true
|
save-always: true
|
||||||
path: ./cypress/snapshots
|
path: ./cypress/snapshots
|
||||||
key: ${{ runner.os }}-snapshots
|
key: ${{ runner.os }}-snapshots-${{ env.targetHash }}
|
||||||
|
|
||||||
|
# If a snapshot for a given Hash is not found, we checkout that commit, run the tests and cache the snapshots.
|
||||||
- name: Switch to base branch
|
- name: Switch to base branch
|
||||||
if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }}
|
if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }}
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event_name == 'merge_group' && github.event.merge_group.base.sha || 'develop' }}
|
ref: ${{ env.targetHash }}
|
||||||
|
|
||||||
- name: Cypress run
|
- name: Cypress run
|
||||||
uses: cypress-io/github-action@v4
|
uses: cypress-io/github-action@v4
|
||||||
@ -61,12 +74,13 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node-version }}
|
node-version: ${{ matrix.node-version }}
|
||||||
|
|
||||||
|
# These cached snapshots are downloaded, providing the reference snapshots.
|
||||||
- name: Cache snapshots
|
- name: Cache snapshots
|
||||||
id: cache-snapshot
|
id: cache-snapshot
|
||||||
uses: actions/cache/restore@v3
|
uses: actions/cache/restore@v3
|
||||||
with:
|
with:
|
||||||
path: ./cypress/snapshots
|
path: ./cypress/snapshots
|
||||||
key: ${{ runner.os }}-snapshots
|
key: ${{ runner.os }}-snapshots-${{ env.targetHash }}
|
||||||
|
|
||||||
# Install NPM dependencies, cache them correctly
|
# Install NPM dependencies, cache them correctly
|
||||||
# and run all Cypress tests
|
# and run all Cypress tests
|
||||||
@ -101,9 +115,54 @@ jobs:
|
|||||||
verbose: true
|
verbose: true
|
||||||
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
|
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
|
||||||
|
|
||||||
|
# We upload the artifacts into numbered archives to prevent overwriting
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
if: ${{ failure() && steps.cypress.conclusion == 'failure' }}
|
if: ${{ always() }}
|
||||||
|
with:
|
||||||
|
name: snapshots-${{ matrix.containers }}
|
||||||
|
retention-days: 1
|
||||||
|
path: ./cypress/snapshots
|
||||||
|
|
||||||
|
combineArtifacts:
|
||||||
|
needs: e2e
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ always() }}
|
||||||
|
steps:
|
||||||
|
# Download all snapshot artifacts and merge them into a single folder
|
||||||
|
- name: Download All Artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
path: snapshots
|
||||||
|
pattern: snapshots-*
|
||||||
|
merge-multiple: true
|
||||||
|
|
||||||
|
# For successful push events, we save the snapshots cache
|
||||||
|
- name: Save snapshots cache
|
||||||
|
id: cache-upload
|
||||||
|
if: ${{ github.event_name == 'push' && needs.e2e.result != 'failure' }}
|
||||||
|
uses: actions/cache/save@v3
|
||||||
|
with:
|
||||||
|
path: ./snapshots
|
||||||
|
key: ${{ runner.os }}-snapshots-${{ github.event.after }}
|
||||||
|
|
||||||
|
- name: Flatten images to a folder
|
||||||
|
if: ${{ needs.e2e.result == 'failure' }}
|
||||||
|
run: |
|
||||||
|
mkdir errors
|
||||||
|
cd snapshots
|
||||||
|
find . -mindepth 2 -type d -name "*__diff_output__*" -exec sh -c 'mv "$0"/*.png ../errors/' {} \;
|
||||||
|
|
||||||
|
- name: Upload Error snapshots
|
||||||
|
if: ${{ needs.e2e.result == 'failure' }}
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
id: upload-artifacts
|
||||||
with:
|
with:
|
||||||
name: error-snapshots
|
name: error-snapshots
|
||||||
path: cypress/snapshots/**/__diff_output__/*
|
retention-days: 10
|
||||||
|
path: errors/
|
||||||
|
|
||||||
|
- name: Notify Users
|
||||||
|
if: ${{ needs.e2e.result == 'failure' }}
|
||||||
|
run: |
|
||||||
|
echo "::error title=Visual tests failed::You can view images that failed by downloading the error-snapshots artifact: ${{ steps.upload-artifacts.outputs.artifact-url }}"
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.ts';
|
|
||||||
|
|
||||||
describe('Flowchart', () => {
|
|
||||||
it('34: testing the label width in percy', () => {
|
|
||||||
imgSnapshotTest(
|
|
||||||
`graph TD
|
|
||||||
A[Christmas]
|
|
||||||
`,
|
|
||||||
{ theme: 'forest', fontFamily: '"Noto Sans SC", sans-serif' }
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
Loading…
x
Reference in New Issue
Block a user