diff --git a/.github/workflows/kover.yaml b/.github/workflows/kover.yaml new file mode 100644 index 00000000..cfbb00dc --- /dev/null +++ b/.github/workflows/kover.yaml @@ -0,0 +1,65 @@ +name: Measure coverage + +on: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 # 需要完整历史记录以计算覆盖率差异 + + - name: Set up Zig + uses: goto-bus-stop/setup-zig@v2 + + - name: Set up Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: stable + targets: 'x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu,x86_64-pc-windows-msvc,x86_64-apple-darwin,aarch64-apple-darwin' + + - name: Install system dependencies + run: bash ./setup-ubuntu.sh + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + + - name: Set up Gradle + uses: gradle/gradle-build-action@v3 + with: + cache-read-only: false + + - name: Run tests with coverage for swc-binding module + run: ./gradlew :swc-binding:test :swc-binding:koverXmlReport --no-daemon + + - name: Verify coverage report exists + run: | + if [ ! -f "swc-binding/build/reports/kover/report.xml" ]; then + echo "Error: Coverage report not found!" + exit 1 + fi + echo "Coverage report found at swc-binding/build/reports/kover/report.xml" + + - name: Add coverage report to PR + id: kover + uses: mi-kas/kover-report@v1 + with: + path: | + ${{ github.workspace }}/swc-binding/build/reports/kover/report.xml + title: 📊 Code Coverage Report + # 使用 github.token(已通过 permissions.pull-requests: write 授权) + # 如需使用自定义 token,可在仓库 Secrets 中设置 PR_TOKEN 并替换为 ${{ secrets.PR_TOKEN }} + token: ${{ secrets.PR_TOKEN || github.token }} + update-comment: true + min-coverage-overall: 80 + min-coverage-changed-files: 80 + coverage-counter-type: LINE diff --git a/.gitignore b/.gitignore index d5292ffb..c45c837c 100644 --- a/.gitignore +++ b/.gitignore @@ -211,4 +211,16 @@ gradle-app.setting # End of https://www.toptal.com/developers/gitignore/api/kotlin,gradle,rust,node -.DS_Store \ No newline at end of file +# swc/ directory (but not test files) +*.md +.gitignore +swc-generator/test-outputs/ +backup-20251022-125828/ +swc-jni/.cargo/ +swc-jni/*.sh +swc-jni/coverage.json +swc-jni/build.sh +.DS_Store +test-outputs/ +swc-binding/bin/ +build-plugin/bin diff --git a/.idea/compiler.xml b/.idea/compiler.xml index b589d56e..b86273d9 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml index bab10a0c..0aecc81c 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -1,5 +1,6 @@ +