mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-21 08:19:43 +02:00
Compare commits
8 Commits
mermaid@11
...
6671-code-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
f8e71102fd | ||
![]() |
642b781317 | ||
![]() |
4d26480075 | ||
![]() |
f35aae313c | ||
![]() |
d0cabd080f | ||
![]() |
c9eae01d06 | ||
![]() |
df9abe0be9 | ||
![]() |
c33484f9bc |
114
.github/workflows/e2e.yml
vendored
114
.github/workflows/e2e.yml
vendored
@@ -38,6 +38,8 @@ jobs:
|
|||||||
options: --user 1001
|
options: --user 1001
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
|
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
|
||||||
@@ -55,6 +57,7 @@ jobs:
|
|||||||
if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }}
|
if: ${{ steps.cache-snapshot.outputs.cache-hit != 'true' }}
|
||||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
with:
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
ref: ${{ env.targetHash }}
|
ref: ${{ env.targetHash }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@@ -83,6 +86,8 @@ jobs:
|
|||||||
containers: [1, 2, 3, 4, 5]
|
containers: [1, 2, 3, 4, 5]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
||||||
# uses version from "packageManager" field in package.json
|
# uses version from "packageManager" field in package.json
|
||||||
@@ -137,13 +142,118 @@ jobs:
|
|||||||
SPLIT_INDEX: ${{ strategy.job-index }}
|
SPLIT_INDEX: ${{ strategy.job-index }}
|
||||||
SPLIT_FILE: 'cypress/timings.json'
|
SPLIT_FILE: 'cypress/timings.json'
|
||||||
VITEST_COVERAGE: true
|
VITEST_COVERAGE: true
|
||||||
|
- name: Debug coverage generation
|
||||||
|
if: ${{ steps.cypress.conclusion == 'success' }}
|
||||||
|
run: |
|
||||||
|
echo "Checking if coverage files were generated:"
|
||||||
|
ls -la coverage/ || echo "No coverage directory"
|
||||||
|
ls -la coverage/cypress/ || echo "No coverage/cypress directory"
|
||||||
|
echo "Looking for any .info files:"
|
||||||
|
find . -name "*.info" -type f | head -10 || echo "No .info files found"
|
||||||
|
- name: Prepare coverage artifacts
|
||||||
|
if: ${{ steps.cypress.conclusion == 'success' }}
|
||||||
|
run: |
|
||||||
|
mkdir -p coverage/cypress
|
||||||
|
if [ -f coverage/cypress/coverage-final.json ]; then
|
||||||
|
cp coverage/cypress/coverage-final.json coverage/cypress/coverage-final-${{ matrix.containers }}.json
|
||||||
|
echo "Created coverage-final-${{ matrix.containers }}.json"
|
||||||
|
ls -la coverage/cypress/coverage-final-${{ matrix.containers }}.json
|
||||||
|
else
|
||||||
|
echo "Error: coverage/cypress/coverage-final.json not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Upload e2e coverage artifact
|
||||||
|
if: ${{ steps.cypress.conclusion == 'success' }}
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: e2e-coverage-${{ matrix.containers }}
|
||||||
|
path: coverage/cypress/coverage-final-${{ matrix.containers }}.json
|
||||||
|
|
||||||
|
coverage-merge:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: e2e
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0
|
||||||
|
with:
|
||||||
|
node-version-file: '.node-version'
|
||||||
|
- name: Download e2e coverage shards
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
pattern: e2e-coverage-*
|
||||||
|
path: coverage/e2e-shards
|
||||||
|
merge-multiple: true
|
||||||
|
- name: Debug downloaded artifacts
|
||||||
|
run: |
|
||||||
|
echo "Contents of coverage/e2e-shards:"
|
||||||
|
find coverage/e2e-shards -type f -name "*.info" | head -20
|
||||||
|
echo "All files in coverage/e2e-shards:"
|
||||||
|
ls -la coverage/e2e-shards/
|
||||||
|
echo "Directory structure:"
|
||||||
|
find coverage/e2e-shards -type f | head -20
|
||||||
|
echo "Looking for coverage-final.json files:"
|
||||||
|
find coverage/e2e-shards -name "coverage-final.json" | head -20
|
||||||
|
- name: Install dependencies for merging
|
||||||
|
run: pnpm install --frozen-lockfile
|
||||||
|
env:
|
||||||
|
CYPRESS_CACHE_FOLDER: .cache/Cypress
|
||||||
|
- name: Prepare coverage files for merge script
|
||||||
|
run: |
|
||||||
|
mkdir -p coverage/vitest coverage/cypress
|
||||||
|
# Copy E2E coverage-final.json files to the structure expected by scripts/coverage.ts
|
||||||
|
for i in {1..5}; do
|
||||||
|
if [ -f "coverage/e2e-shards/coverage-final-$i.json" ]; then
|
||||||
|
cp "coverage/e2e-shards/coverage-final-$i.json" "coverage/cypress/coverage-final.json"
|
||||||
|
echo "Copied coverage-final-$i.json to cypress/"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
# Create a minimal but valid vitest coverage-final.json
|
||||||
|
echo '{"type":"Coverage","version":"1.1","data":{}}' > coverage/vitest/coverage-final.json
|
||||||
|
echo "Prepared coverage files:"
|
||||||
|
ls -la coverage/vitest/
|
||||||
|
ls -la coverage/cypress/
|
||||||
|
echo "Checking file contents:"
|
||||||
|
echo "Vitest coverage file:"
|
||||||
|
cat coverage/vitest/coverage-final.json
|
||||||
|
echo "Cypress coverage file:"
|
||||||
|
cat coverage/cypress/coverage-final.json
|
||||||
|
echo "Validating JSON files:"
|
||||||
|
if jq . coverage/vitest/coverage-final.json > /dev/null; then
|
||||||
|
echo "✓ Vitest coverage file is valid JSON"
|
||||||
|
else
|
||||||
|
echo "✗ Vitest coverage file is invalid JSON"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if jq . coverage/cypress/coverage-final.json > /dev/null; then
|
||||||
|
echo "✓ Cypress coverage file is valid JSON"
|
||||||
|
else
|
||||||
|
echo "✗ Cypress coverage file is invalid JSON"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
- name: Generate LCOV from coverage data
|
||||||
|
run: |
|
||||||
|
mkdir -p coverage/combined
|
||||||
|
# Convert coverage-final.json to LCOV format using nyc
|
||||||
|
if [ -f coverage/cypress/coverage-final.json ]; then
|
||||||
|
echo "Converting Cypress coverage to LCOV..."
|
||||||
|
npx nyc report --reporter=lcov --report-dir=coverage/combined --cwd=. --temp-dir=coverage/cypress
|
||||||
|
echo "LCOV generation completed"
|
||||||
|
ls -la coverage/combined/
|
||||||
|
else
|
||||||
|
echo "No Cypress coverage file found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
- name: Upload Coverage to Codecov
|
- name: Upload Coverage to Codecov
|
||||||
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
|
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
|
||||||
# Run step only pushes to develop and pull_requests
|
# Run step only pushes to develop and pull_requests
|
||||||
if: ${{ steps.cypress.conclusion == 'success' && (github.event_name == 'pull_request' || github.ref == 'refs/heads/develop')}}
|
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop'}}
|
||||||
with:
|
with:
|
||||||
files: coverage/cypress/lcov.info
|
files: coverage/combined/lcov.info
|
||||||
flags: e2e
|
flags: e2e
|
||||||
name: mermaid-codecov
|
name: mermaid-codecov
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: false
|
||||||
|
3
.github/workflows/test.yml
vendored
3
.github/workflows/test.yml
vendored
@@ -10,6 +10,8 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
|
||||||
# uses version from "packageManager" field in package.json
|
# uses version from "packageManager" field in package.json
|
||||||
@@ -41,7 +43,6 @@ jobs:
|
|||||||
- name: Verify out-of-tree build with TypeScript
|
- name: Verify out-of-tree build with TypeScript
|
||||||
run: |
|
run: |
|
||||||
pnpm test:check:tsc
|
pnpm test:check:tsc
|
||||||
|
|
||||||
- name: Upload Coverage to Codecov
|
- name: Upload Coverage to Codecov
|
||||||
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
|
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1
|
||||||
# Run step only pushes to develop and pull_requests
|
# Run step only pushes to develop and pull_requests
|
||||||
|
14
.nycrc
Normal file
14
.nycrc
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"reporter": ["text", "lcov", "json", "html"],
|
||||||
|
"exclude": [
|
||||||
|
"node_modules/**/*",
|
||||||
|
"cypress/**/*",
|
||||||
|
"coverage/**/*",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.test.js",
|
||||||
|
"**/*.test.ts"
|
||||||
|
],
|
||||||
|
"all": true,
|
||||||
|
"check-coverage": false
|
||||||
|
}
|
27
codecov.yml
Normal file
27
codecov.yml
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
coverage:
|
||||||
|
status:
|
||||||
|
project:
|
||||||
|
default:
|
||||||
|
target: auto
|
||||||
|
threshold: 1%
|
||||||
|
patch:
|
||||||
|
default:
|
||||||
|
target: auto
|
||||||
|
threshold: 1%
|
||||||
|
|
||||||
|
comment:
|
||||||
|
layout: 'reach,diff,flags,tree'
|
||||||
|
behavior: default
|
||||||
|
require_changes: false
|
||||||
|
|
||||||
|
flags:
|
||||||
|
unit:
|
||||||
|
paths:
|
||||||
|
- packages/
|
||||||
|
e2e:
|
||||||
|
paths:
|
||||||
|
- packages/
|
||||||
|
|
||||||
|
# Wait for both unit and e2e coverage uploads before finalizing
|
||||||
|
notify:
|
||||||
|
after_n_builds: 2
|
@@ -15,6 +15,13 @@ export default eyesPlugin(
|
|||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
coverage(on, config);
|
coverage(on, config);
|
||||||
cypressSplit(on, config);
|
cypressSplit(on, config);
|
||||||
|
|
||||||
|
// Ensure coverage generates LCOV format
|
||||||
|
on('task', {
|
||||||
|
coverage: () => {
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
});
|
||||||
on('before:browser:launch', (browser, launchOptions) => {
|
on('before:browser:launch', (browser, launchOptions) => {
|
||||||
if (browser.name === 'chrome' && browser.isHeadless) {
|
if (browser.name === 'chrome' && browser.isHeadless) {
|
||||||
launchOptions.args.push('--window-size=1440,1024', '--force-device-scale-factor=1');
|
launchOptions.args.push('--window-size=1440,1024', '--force-device-scale-factor=1');
|
||||||
|
Reference in New Issue
Block a user