Skip to content

Commit 28d27eb

Browse files
feat(ci): add automated testing and release workflows
Implement comprehensive CI/CD automation for JEngine: - Add reusable Unity test workflow with EditMode/PlayMode support - Add PR testing workflow with automatic test result comments - Add release automation workflow with dual-package version bumping - Add automatic changelog generation from conventional commits - Add GitHub App authentication for secure bot commits - Add conventional commit guidelines to CLAUDE.md - Add PR template to guide contributors on commit format This enables: - Automated Unity testing on every PR - One-click releases with automatic version updates - Automatic changelog generation and GitHub releases - OpenUPM integration for package distribution Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 4751058 commit 28d27eb

5 files changed

Lines changed: 870 additions & 0 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
## Description
2+
3+
<!-- Provide a brief description of the changes in this PR -->
4+
5+
## Type of Change
6+
7+
<!-- Check the type that applies to this PR -->
8+
9+
- [ ] 🐛 Bug fix (fixes an issue)
10+
- [ ] ✨ New feature (adds functionality)
11+
- [ ] 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] 📝 Documentation update
13+
- [ ] 🎨 Code style/formatting
14+
- [ ] ♻️ Code refactoring (no functional changes)
15+
- [ ] ✅ Test updates
16+
- [ ] 🔧 Build/config changes
17+
18+
## Package Scope
19+
20+
<!-- Check which package(s) this PR affects -->
21+
22+
- [ ] JEngine.Core (`com.jasonxudeveloper.jengine.core`)
23+
- [ ] JEngine.Util (`com.jasonxudeveloper.jengine.util`)
24+
- [ ] Other (specify):
25+
26+
## Checklist
27+
28+
- [ ] My code follows the project's coding conventions (see [CLAUDE.md](../CLAUDE.md))
29+
- [ ] I have performed a self-review of my code
30+
- [ ] I have commented my code, particularly in hard-to-understand areas
31+
- [ ] I have added/updated XML documentation for public APIs
32+
- [ ] I have added/updated tests that prove my fix is effective or that my feature works
33+
- [ ] New and existing unit tests pass locally with my changes
34+
- [ ] I have used `UniTask` for async operations (not `System.Threading.Tasks.Task`)
35+
- [ ] My changes handle Unity domain reloads properly (if applicable to Editor code)
36+
37+
## Commit Message Format
38+
39+
We use **Conventional Commits** for automated changelog generation. Please format your commit messages as:
40+
41+
```
42+
<type>(<scope>): <subject>
43+
```
44+
45+
### Examples
46+
47+
```bash
48+
feat(core): add ChaCha20 encryption support
49+
fix(util): resolve JAction memory leak on cancellation
50+
docs: update installation guide for Unity 2022.3
51+
refactor(core): simplify bootstrap initialization
52+
test(util): add coverage for JAction edge cases
53+
chore(ci): update GameCI Unity version to 2022.3.55f1
54+
```
55+
56+
### Types
57+
58+
- `feat:` - New feature (appears in changelog)
59+
- `fix:` - Bug fix (appears in changelog)
60+
- `docs:` - Documentation only
61+
- `style:` - Code style/formatting
62+
- `refactor:` - Code refactoring
63+
- `test:` - Test changes
64+
- `chore:` - Build/config changes
65+
66+
### Scopes
67+
68+
- `core` - JEngine.Core package
69+
- `util` - JEngine.Util package
70+
- `ci` - CI/CD workflows
71+
- `docs` - Documentation
72+
73+
### Breaking Changes
74+
75+
For breaking changes, add `!` after the type/scope or include `BREAKING CHANGE:` in the footer:
76+
77+
```bash
78+
feat(core)!: redesign encryption API
79+
80+
BREAKING CHANGE: EncryptionManager.Encrypt() now requires EncryptionConfig parameter
81+
```
82+
83+
## Testing
84+
85+
<!-- Describe how you tested your changes -->
86+
87+
**Test environment:**
88+
- Unity version:
89+
- Platform(s):
90+
- Test mode: [ ] EditMode [ ] PlayMode [ ] Manual
91+
92+
**Steps to test:**
93+
1.
94+
2.
95+
3.
96+
97+
## Additional Notes
98+
99+
<!-- Any additional information that reviewers should know -->

.github/workflows/pr-tests.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: PR Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
paths:
7+
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.core/**'
8+
- 'UnityProject/Packages/com.jasonxudeveloper.jengine.util/**'
9+
- 'UnityProject/Assets/Tests/**'
10+
- '.github/workflows/**'
11+
12+
# Ensure only one test run per PR at a time
13+
concurrency:
14+
group: pr-tests-${{ github.event.pull_request.number }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
run-tests:
19+
name: Run Unity Tests
20+
uses: ./.github/workflows/unity-tests.yml
21+
secrets: inherit
22+
23+
comment-results:
24+
name: Comment Test Results
25+
needs: run-tests
26+
runs-on: ubuntu-latest
27+
if: always()
28+
permissions:
29+
pull-requests: write
30+
31+
steps:
32+
- name: Comment PR with test results
33+
uses: actions/github-script@v7
34+
with:
35+
script: |
36+
const testResults = `${{ needs.run-tests.outputs.test_results }}`;
37+
const jobStatus = '${{ needs.run-tests.result }}';
38+
39+
let comment = testResults;
40+
41+
if (jobStatus === 'success') {
42+
comment += '\n\n✅ All tests passed! The PR is ready for review.';
43+
} else if (jobStatus === 'failure') {
44+
comment += '\n\n❌ Some tests failed. Please fix the failing tests before merging.';
45+
} else {
46+
comment += '\n\n⚠️ Test execution was cancelled or encountered an error.';
47+
}
48+
49+
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>`;
50+
51+
// Find existing comment
52+
const comments = await github.rest.issues.listComments({
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
issue_number: context.issue.number,
56+
});
57+
58+
const botComment = comments.data.find(comment =>
59+
comment.user.type === 'Bot' &&
60+
comment.body.includes('Unity Test Results')
61+
);
62+
63+
if (botComment) {
64+
// Update existing comment
65+
await github.rest.issues.updateComment({
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
comment_id: botComment.id,
69+
body: comment
70+
});
71+
} else {
72+
// Create new comment
73+
await github.rest.issues.createComment({
74+
owner: context.repo.owner,
75+
repo: context.repo.repo,
76+
issue_number: context.issue.number,
77+
body: comment
78+
});
79+
}
80+
81+
- name: Set PR check status
82+
uses: actions/github-script@v7
83+
with:
84+
script: |
85+
const jobStatus = '${{ needs.run-tests.result }}';
86+
const state = jobStatus === 'success' ? 'success' : 'failure';
87+
const description = jobStatus === 'success'
88+
? 'All Unity tests passed'
89+
: 'Unity tests failed';
90+
91+
await github.rest.repos.createCommitStatus({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
sha: context.payload.pull_request.head.sha,
95+
state: state,
96+
target_url: `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
97+
description: description,
98+
context: 'Unity Tests'
99+
});

0 commit comments

Comments
 (0)