Skip to content

fix(core): bump Nino to fix Dictionary serialization in HybridCLR #152

fix(core): bump Nino to fix Dictionary serialization in HybridCLR

fix(core): bump Nino to fix Dictionary serialization in HybridCLR #152

Workflow file for this run

name: PR Tests
on:
pull_request:
branches: [master]
types: [opened, synchronize, reopened]
# Path filtering moved to job level using dorny/paths-filter
# This ensures the workflow always runs and reports a status
# Ensure only one test run per PR at a time
concurrency:
group: pr-tests-${{ github.event.pull_request.number }}
cancel-in-progress: true
# Workflow-level permissions set to maximum needed by any job
# Individual jobs further restrict to only what they need
permissions:
contents: read
checks: write
statuses: write
pull-requests: write
jobs:
changes:
name: Detect Changes
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
should_test: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
src:
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.core/**'
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.util/**'
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.ui/**'
- 'UnityProject/Assets/Tests/**'
- '.github/workflows/unity-tests.yml'
- '.github/workflows/pr-tests.yml'
run-tests:
name: Run Unity Tests
needs: changes
if: needs.changes.outputs.should_test == 'true'
permissions:
contents: read
checks: write
uses: ./.github/workflows/unity-tests.yml
secrets: inherit
skip-tests:
name: Skip Unity Tests
needs: changes
if: needs.changes.outputs.should_test == 'false'
runs-on: ubuntu-latest
permissions:
statuses: write
steps:
- name: Skip tests
run: echo "No relevant changes detected, skipping tests"
- name: Set PR check status (skipped)
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.pull_request.head.sha,
state: 'success',
target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
description: 'Skipped - no relevant changes',
context: 'Unity Tests'
});
upload-coverage:
name: Upload Coverage
needs: [changes, run-tests]
runs-on: ubuntu-latest
if: needs.changes.outputs.should_test == 'true' && needs.run-tests.result == 'success'
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download coverage artifacts
uses: actions/download-artifact@v4
with:
name: Coverage-results-2022.3.55f1
path: coverage
- name: List coverage files
run: |
echo "Coverage directory structure:"
find coverage -type f -name "*.xml" 2>/dev/null || echo "No XML files found"
- name: Fix coverage paths
run: |
# Unity test runner generates paths with /github/workspace/ prefix (Docker container path)
# Strip this prefix so Codecov can match paths to repository files
echo "Fixing coverage paths..."
find coverage -name "*.xml" -exec sed -i 's|/github/workspace/||g' {} \;
echo "Path fix complete. Sample paths after fix:"
find coverage -name "TestCoverageResults*.xml" -exec grep -h "fullPath=" {} \; | head -5 || true
- name: Upload coverage to Codecov (util package)
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/**/TestCoverageResults*.xml
flags: util
name: jengine-util
fail_ci_if_error: true
verbose: true
- name: Upload coverage to Codecov (ui package)
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/**/TestCoverageResults*.xml
flags: ui
name: jengine-ui
fail_ci_if_error: true
verbose: true
comment-results:
name: Comment Test Results
needs: [changes, run-tests, skip-tests]
runs-on: ubuntu-latest
if: always() && needs.changes.outputs.should_test == 'true'
permissions:
pull-requests: write
statuses: write
steps:
- name: Comment PR with test results
uses: actions/github-script@v7
with:
script: |
const testResults = `${{ needs.run-tests.outputs.test_results }}`;
const jobStatus = '${{ needs.run-tests.result }}';
let comment = testResults;
if (jobStatus === 'success') {
comment += '\n\n✅ All tests passed! The PR is ready for review.';
} else if (jobStatus === 'failure') {
comment += '\n\n❌ Some tests failed. Please fix the failing tests before merging.';
} else {
comment += '\n\n⚠️ Test execution was cancelled or encountered an error.';
}
comment += `\n\n<details><summary>View workflow run</summary>\n\n[Click here to view the full workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\n\n</details>`;
// Find existing comment
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});
const botComment = comments.data.find(comment =>
comment.user.type === 'Bot' &&
comment.body.includes('Unity Test Results')
);
if (botComment) {
// Update existing comment
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: comment
});
} else {
// Create new comment
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: comment
});
}
- name: Set PR check status
uses: actions/github-script@v7
with:
script: |
const jobStatus = '${{ needs.run-tests.result }}';
const state = jobStatus === 'success' ? 'success' : 'failure';
const description = jobStatus === 'success'
? 'All Unity tests passed'
: 'Unity tests failed';
await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
sha: context.payload.pull_request.head.sha,
state: state,
target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
description: description,
context: 'Unity Tests'
});