From 5c59505589a2ddec79be501811080eddd915e3e9 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Sat, 24 Aug 2024 14:51:23 +0530 Subject: [PATCH 1/4] chore: Skip running E2E on Push to most branches --- .github/workflows/e2e.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 2600b3fb8..fe420a7eb 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -2,8 +2,10 @@ name: E2E on: push: - branches-ignore: - - 'gh-readonly-queue/**' + branches: + - develop + - master + - release/** pull_request: merge_group: From 1a1f6687455efb5cb8cff884fafab202c61a5a9d Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Sat, 24 Aug 2024 15:04:14 +0530 Subject: [PATCH 2/4] chore: Add concurrency for actions --- .github/workflows/autofix.yml | 2 ++ .github/workflows/build-docs.yml | 2 ++ .github/workflows/e2e-applitools.yml | 2 ++ .github/workflows/e2e.yml | 2 ++ .github/workflows/lint.yml | 6 ++---- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index f26bf4ab8..1eef1eae2 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -7,6 +7,8 @@ on: permissions: contents: read +concurrency: ${{ github.workflow }}-${{ github.ref }} + jobs: autofix: runs-on: ubuntu-latest diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml index 0ce778957..ca422de52 100644 --- a/.github/workflows/build-docs.yml +++ b/.github/workflows/build-docs.yml @@ -8,6 +8,8 @@ on: pull_request: merge_group: +concurrency: ${{ github.workflow }}-${{ github.ref }} + permissions: contents: read diff --git a/.github/workflows/e2e-applitools.yml b/.github/workflows/e2e-applitools.yml index 5e5407a23..e75ad60d3 100644 --- a/.github/workflows/e2e-applitools.yml +++ b/.github/workflows/e2e-applitools.yml @@ -11,6 +11,8 @@ on: default: master description: 'Parent branch to use for PRs' +concurrency: ${{ github.workflow }}-${{ github.ref }} + permissions: contents: read diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index fe420a7eb..f7eb63a8c 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -9,6 +9,8 @@ on: pull_request: merge_group: +concurrency: ${{ github.workflow }}-${{ github.ref }} + permissions: contents: read diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 632cd6ddc..25de168c1 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,12 +4,10 @@ on: push: merge_group: pull_request: - types: - - opened - - synchronize - - ready_for_review workflow_dispatch: +concurrency: ${{ github.workflow }}-${{ github.ref }} + permissions: contents: write From ab4ba4cf2fa67fa4c339d741eefc5ad068ce4565 Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Sat, 24 Aug 2024 15:05:28 +0530 Subject: [PATCH 3/4] chore: Remove unnecessary workflows --- .github/workflows/build.yml | 49 --------------------------- .github/workflows/release-publish.yml | 47 ------------------------- 2 files changed, 96 deletions(-) delete mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/release-publish.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index c6e96912e..000000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build - -on: - push: {} - merge_group: - pull_request: - types: - - opened - - synchronize - - ready_for_review - -permissions: - contents: read - -jobs: - build-mermaid: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: pnpm/action-setup@v4 - # uses version from "packageManager" field in package.json - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - cache: pnpm - node-version-file: '.node-version' - - - name: Install Packages - run: | - pnpm install --frozen-lockfile - env: - CYPRESS_CACHE_FOLDER: .cache/Cypress - - - name: Run Build - run: pnpm run build - - - name: Upload Mermaid Build as Artifact - uses: actions/upload-artifact@v4 - with: - name: mermaid-build - path: packages/mermaid/dist - - - name: Upload Mermaid Mindmap Build as Artifact - uses: actions/upload-artifact@v4 - with: - name: mermaid-mindmap-build - path: packages/mermaid-mindmap/dist diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml deleted file mode 100644 index 4dcf709c0..000000000 --- a/.github/workflows/release-publish.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Publish release - -on: - release: - types: [published] - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: fregante/setup-git-user@v2 - - - uses: pnpm/action-setup@v4 - # uses version from "packageManager" field in package.json - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - cache: pnpm - node-version-file: '.node-version' - - - name: Install Packages - run: | - pnpm install --frozen-lockfile - npm i json --global - env: - CYPRESS_CACHE_FOLDER: .cache/Cypress - - - name: Prepare release - run: | - VERSION=${GITHUB_REF:10} - echo "Preparing release $VERSION" - git checkout -t origin/release/$VERSION - npm version --no-git-tag-version --allow-same-version $VERSION - git add package.json - git commit -nm "Bump version $VERSION" - git checkout -t origin/master - git merge -m "Release $VERSION" --no-ff release/$VERSION - git push --no-verify - - - name: Publish - run: | - npm set //registry.npmjs.org/:_authToken $NPM_TOKEN - npm publish - env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From d08ef70e0fc55ef9c28df6c976b0006c1bf8c1be Mon Sep 17 00:00:00 2001 From: Sidharth Vinod Date: Sat, 24 Aug 2024 15:06:08 +0530 Subject: [PATCH 4/4] chore: Merge checks into lint --- .github/workflows/checks.yml | 26 -------------------------- .github/workflows/lint.yml | 7 +++++++ 2 files changed, 7 insertions(+), 26 deletions(-) delete mode 100644 .github/workflows/checks.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml deleted file mode 100644 index 012fbf19d..000000000 --- a/.github/workflows/checks.yml +++ /dev/null @@ -1,26 +0,0 @@ -on: - push: - merge_group: - pull_request: - types: - - opened - - synchronize - - ready_for_review - -name: Static analysis on Test files - -jobs: - check-tests: - runs-on: ubuntu-latest - name: check tests - if: github.repository_owner == 'mermaid-js' - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: testomatio/check-tests@stable - with: - framework: cypress - tests: './cypress/e2e/**/**.spec.js' - token: ${{ secrets.GITHUB_TOKEN }} - has-tests-label: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 25de168c1..a32a60ab2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -80,3 +80,10 @@ jobs: working-directory: ./packages/mermaid continue-on-error: ${{ github.event_name == 'push' }} run: pnpm run docs:verify + + - uses: testomatio/check-tests@stable + with: + framework: cypress + tests: './cypress/e2e/**/**.spec.js' + token: ${{ secrets.GITHUB_TOKEN }} + has-tests-label: true