Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .c8.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"reporter": ["html"],
"reporter": ["html", "lcov", "text-summary"],
"reports-dir": "./c8-cov",
"all": true,
"include": [
"packages/plugin-selenium-driver/*/plugin/index.*",
"packages/web-application/*/web-client.*",
"packages/web-application/*/web-application.*"
"packages/plugin-playwright-driver/src/**/*",
"packages/web-application/src/**/*",
"core/*/src/**/*"
]
}
51 changes: 51 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"permissions": {
"allow": [
"Bash(npm run build:main:*)",
"Bash(npm install:*)",
"Bash(npx mocha:*)",
"Bash(npm test)",
"Bash(sed:*)",
"Bash(git checkout:*)",
"Bash(npx tsc:*)",
"Bash(npx playwright:*)",
"Bash(lerna exec:*)",
"Bash(npx lerna exec:*)",
"Bash(ls:*)",
"Bash(npm ls:*)",
"Bash(npm run cleanup:*)",
"Bash(npm run test:ci:*)",
"Bash(node:*)",
"Bash(npm run test:e2e:*)",
"Bash(npm run test:coverage:*)",
"Bash(npm run test:playwright:*)",
"Bash(PLAYWRIGHT_DEBUG=1 npx mocha --config .mocharc.debug.json --grep \"should create browser client for applicant\")",
"Bash(PLAYWRIGHT_DEBUG=1 npx mocha --config .mocharc.debug.json --grep \"should navigate to URL\" --timeout 10000)",
"Bash(PLAYWRIGHT_DEBUG=1 npx mocha --config .mocharc.debug.json --grep \"should support modern browser features\" --timeout 15000)",
"Bash(timeout:*)",
"Bash(npm run test:debug:*)",
"Bash(mkdir:*)",
"Bash(cp:*)",
"Bash(npm run test:*)",
"Bash(npm run build:*)",
"Bash(gtimeout:*)",
"Bash(find:*)",
"Bash(npm run:*)",
"Bash(PLAYWRIGHT_DEBUG=1 npm run test:playwright)",
"Bash(curl:*)",
"Bash(pgrep:*)",
"Bash(pkill:*)",
"Bash(kill:*)",
"Bash(chmod:*)",
"Bash(/Users/danbao/workspace/github/ringcentral/testring/cleanup-playwright.sh)",
"Bash(diff:*)",
"Bash(npx testring run:*)",
"Bash(ts-node:*)",
"Bash(npx ts-node:*)",
"Bash(grep:*)",
"Bash(/dev/null)",
"Bash(true)"
],
"deny": []
}
}
76 changes: 67 additions & 9 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,90 @@ on:
jobs:
build:
strategy:
fail-fast: false # 不要让一个任务失败导致整个 matrix 停止
matrix:
node-version: [16, 18, 22]
os: [ubuntu-latest, macos-latest]
node-version: [20, 22, 24]
os: [ubuntu-latest, macos-latest, windows-latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build:main
- run: npm run test:ci

- name: Coveralls
if: ${{ matrix.os=='ubuntu-latest' && matrix.node-version=='16'}}
# Install Playwright browsers for E2E tests
- name: Install Playwright Browsers
run: npx playwright install chromium firefox

# Run all tests with coverage
- run: npm run test:ci:coverage

# Display coverage summaries
- name: Display Coverage Reports
if: ${{ matrix.os=='ubuntu-latest' && matrix.node-version=='22'}}
run: |
echo "=== Unit Test Coverage Summary ==="
if [ -f "./.coverage/lcov.info" ]; then
echo "✅ Unit test coverage report generated"
# Display basic coverage info
grep -E "^(SF|LF|LH)" ./.coverage/lcov.info | head -20
else
echo "❌ Unit test coverage file not found"
fi

echo ""
echo "=== E2E Test Coverage Summary ==="
if [ -f "./c8-cov/lcov.info" ]; then
echo "✅ E2E test coverage report generated"
# Display basic coverage info
grep -E "^(SF|LF|LH)" ./c8-cov/lcov.info | head -20
else
echo "❌ E2E test coverage file not found"
fi

# Prepare coverage report for Coveralls
- name: Prepare Coverage Report
if: ${{ matrix.os=='ubuntu-latest' && matrix.node-version=='22'}}
run: |
# Create merged coverage directory
mkdir -p ./merged-coverage

# Check which coverage files exist and use the appropriate one
if [ -f "./.coverage/lcov.info" ] && [ -f "./c8-cov/lcov.info" ]; then
echo "Both coverage reports found. Using unit test coverage as primary..."
# For now, prioritize unit test coverage as it covers more of the codebase
cp ./.coverage/lcov.info ./merged-coverage/lcov.info
echo "✅ Unit test coverage report prepared for upload"
elif [ -f "./.coverage/lcov.info" ]; then
echo "Using unit test coverage report..."
cp ./.coverage/lcov.info ./merged-coverage/lcov.info
echo "✅ Unit test coverage report prepared for upload"
elif [ -f "./c8-cov/lcov.info" ]; then
echo "Using E2E test coverage report..."
cp ./c8-cov/lcov.info ./merged-coverage/lcov.info
echo "✅ E2E test coverage report prepared for upload"
else
echo "❌ No coverage reports found!"
ls -la ./.coverage/ || echo "No .coverage directory"
ls -la ./c8-cov/ || echo "No c8-cov directory"
exit 1
fi

- name: Upload Coverage to Coveralls
if: ${{ matrix.os=='ubuntu-latest' && matrix.node-version=='22'}}
uses: coverallsapp/github-action@master
with:
path-to-lcov: './.coverage/lcov.info'
path-to-lcov: './merged-coverage/lcov.info'
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: SonarCloud Scan
if: ${{ matrix.os=='ubuntu-latest' && matrix.node-version=='16' && github.event.pull_request.merged == true}}
if: ${{ matrix.os=='ubuntu-latest' && matrix.node-version=='22' && github.event.pull_request.merged == true}}
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
50 changes: 46 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch full history for commit info
- uses: actions/setup-node@v4
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -25,11 +27,51 @@ jobs:
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"

- name: Get commit info
id: commit_info
run: |
echo "commit_id=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "github_username=${{ github.actor }}" >> $GITHUB_OUTPUT

- name: Check if should publish to dev
id: check_dev_publish
run: |
if [[ "${{ github.repository }}" != "ringcentral/testring" ]] || [[ "${{ github.ref }}" != "refs/heads/master" ]]; then
if [[ -n "${{ secrets.NPM_TOKEN }}" ]]; then
echo "should_publish_dev=true" >> $GITHUB_OUTPUT
echo "Publishing to dev packages because:"
echo " Repository: ${{ github.repository }} (not ringcentral/testring)"
echo " Branch: ${{ github.ref }} (not refs/heads/master)"
echo " NPM_TOKEN is available"
else
echo "should_publish_dev=false" >> $GITHUB_OUTPUT
echo "Not publishing: NPM_TOKEN not available"
fi
else
echo "should_publish_dev=false" >> $GITHUB_OUTPUT
echo "Publishing to production packages (ringcentral/testring master branch)"
fi

- run: npm ci
- run: npx playwright install chromium
- run: npm run build:main
- run: npm run publish:version ${{ github.event.inputs.version }}
- run: npm run publish:ci

# Production publish (original logic)
- name: Publish to production
if: steps.check_dev_publish.outputs.should_publish_dev == 'false'
run: |
npm run publish:version ${{ github.event.inputs.version }}
npm run publish:ci
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Dev publish (new logic)
- name: Publish to dev packages
if: steps.check_dev_publish.outputs.should_publish_dev == 'true'
run: |
npm run publish:dev -- --github-username=${{ steps.commit_info.outputs.github_username }} --commit-id=${{ steps.commit_info.outputs.commit_id }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

packages/**/dist
packages/**/chrome-cache
packages/**/node_modules
Expand All @@ -17,4 +18,8 @@ lerna-debug.log
.DS_Store
.tsbuildinfo

c8-cov/
c8-cov/
coverage/

# Test Generated File
packages/e2e-test-app/test/playwright/test/**/*.pdf
Loading
Loading