Skip to content

feat(ci): add automated testing and release workflows#554

Merged
JasonXuDeveloper merged 5 commits into
masterfrom
feat/ci-cd-workflows
Jan 25, 2026
Merged

feat(ci): add automated testing and release workflows#554
JasonXuDeveloper merged 5 commits into
masterfrom
feat/ci-cd-workflows

Conversation

@JasonXuDeveloper
Copy link
Copy Markdown
Owner

Description

This PR implements comprehensive CI/CD automation for JEngine, enabling automated testing on PRs and one-click releases with automatic changelog generation.

Type of Change

  • ✨ New feature (adds functionality)
  • 🔧 Build/config changes

Package Scope

  • JEngine.Core (com.jasonxudeveloper.jengine.core)
  • JEngine.Util (com.jasonxudeveloper.jengine.util)
  • Other (specify): CI/CD infrastructure

What's Included

1. Automated PR Testing

  • unity-tests.yml: Reusable workflow for running Unity EditMode and PlayMode tests
  • pr-tests.yml: Automatically runs tests on every PR and comments results
  • Unity Library caching for 50%+ speedup on subsequent runs
  • PR check status integration (✅ fixed permissions issue)

2. Release Automation

  • release.yml: One-click release workflow with version bumping
  • Automatic changelog generation from conventional commits
  • Support for dual-package versioning (Core + Util)
  • GitHub App authentication for secure bot commits
  • Automatic updates to package.json, README, and CHANGE.md files
  • GitHub release creation with OpenUPM integration

3. Developer Guidelines

  • CLAUDE.md: Added conventional commits specification
  • PULL_REQUEST_TEMPLATE.md: PR template to guide contributors

Benefits

Automated Testing: Every PR runs Unity tests automatically
Quality Control: Tests must pass before merge
Easy Releases: One-click releases with automatic version bumping
Auto Changelog: Generated from conventional commits
OpenUPM Integration: Automatic package publishing
Consistent Commits: Guidelines for contributors

Testing

This PR itself will test the PR workflow:

  • PR tests should trigger automatically
  • Test results should be commented on this PR
  • PR check status should update (with correct permissions)

After merge, the release workflow can be tested manually via Actions tab.

Test environment:

  • Unity version: 2022.3.55f1
  • Platform(s): ubuntu-latest (GitHub Actions)
  • Test mode: [x] EditMode [x] PlayMode

Changes Since Previous PR #553

  • Fixed: Based from master instead of fix/build-error-handling
  • Fixed: Added statuses: write permission to PR tests workflow

Additional Notes

Prerequisites (already completed):

  • ✅ GitHub App (JEngine Release Bot) created with required permissions
  • ✅ Secrets configured: UNITY_EMAIL, UNITY_PASSWORD, UNITY_SERIAL, RELEASE_APP_ID, RELEASE_APP_PRIVATE_KEY
  • ✅ Branch protection bypass configured for Release Bot

First run timing:

  • PR tests: ~7-12 minutes (first run with cache build)
  • Subsequent runs: ~3-5 minutes (with cache)
  • Release workflow: ~15-20 minutes

Post-merge tasks:

  • Test release workflow manually from Actions tab
  • Monitor first release to verify OpenUPM integration
  • Update project documentation with CI/CD info

🤖 This PR was prepared with assistance from Claude Code

JasonXuDeveloper and others added 2 commits January 25, 2026 14:23
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>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 25, 2026

Unity Test Results

EditMode: All tests passed
PlayMode: All tests passed

Unity Version: 2022.3.55f1
Project Path: UnityProject

✅ All tests passed! The PR is ready for review.

View workflow run

Click here to view the full workflow run

- GitHub releases now ONLY created when Core is released
- Release tags always use Core version (e.g., v1.0.6)
- Util-only releases: update package.json only, no GitHub release
- OpenUPM detects both packages from package.json changes
- README updates only when Core is released
- Clear summary messages for Util-only updates

This ensures version consistency and avoids unnecessary GitHub releases.
Always display both package versions in changelogs for clarity:
- Core + Util release: shows both new versions
- Core only: shows new Core version, mentions Util remains unchanged
- Util only: shows new Util version, mentions Core remains unchanged

This helps users understand version compatibility at a glance.
@claude
Copy link
Copy Markdown

claude Bot commented Jan 25, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

OpenUPM requires git tags to detect package updates. Updated workflow:

**Core Release:**
- Tag: v1.0.6 (Core version)
- GitHub Release: ✅ Created
- CHANGE.md: ## 1.0.6 (Date)

**Util-Only Release:**
- Tag: util-v1.0.1 (Util version, prefixed with 'util-')
- GitHub Release: ❌ Not created
- CHANGE.md: ## 1.0.5 (Date) - Util v1.0.1

This ensures:
- OpenUPM always detects updates via git tags
- GitHub releases only created for Core (version consistency)
- Clear distinction between Core and Util-only releases
@JasonXuDeveloper JasonXuDeveloper enabled auto-merge (squash) January 25, 2026 03:47
@claude
Copy link
Copy Markdown

claude Bot commented Jan 25, 2026

Code Review

Found 2 bugs in the workflow files that need to be fixed:


Issue 1: sed command will insert literal \n strings in CHANGE.md

File: .github/workflows/release.yml
Line: 356

The sed command sed -i "2i\\$CHANGE_ENTRY" CHANGE.md will insert literal \n strings instead of actual newlines.

In bash, \n inside double quotes is not interpreted as a newline character - it remains as two literal characters (backslash + n). When $CHANGE_ENTRY is expanded in the sed command, it contains these literal \n strings, and sed's i (insert) command does not automatically interpret them as newlines during variable expansion.

Result: CHANGE.md will contain malformed content like:

## 1.0.6 (January 25 2026)\n\n- **Feature** (core)\n\n

Expected: Properly formatted with actual line breaks:

## 1.0.6 (January 25 2026)

- **Feature** (core)

Fix: Replace line 356 with:

echo -e "$CHANGE_ENTRY" | sed -i '2r /dev/stdin' CHANGE.md

Reference: See the bash variable assignment at

# For Util-only releases, note that Core version didn't change
if [ "${{ inputs.release_core }}" == "true" ]; then
CHANGE_ENTRY="## $VERSION ($DATE)\n\n"
else
CHANGE_ENTRY="## $VERSION ($DATE) - Util v${{ needs.validate.outputs.util_version }}\n\n"
fi
where literal \n strings are constructed.


Issue 2: Incorrect artifact upload paths in unity-tests.yml

File: .github/workflows/unity-tests.yml
Lines: 88, 96

The artifact upload paths ${{ inputs.project_path }}/artifacts/EditMode and ${{ inputs.project_path }}/artifacts/PlayMode are incorrect.

The game-ci/unity-test-runner action outputs artifacts to artifacts/ at the repository root, not inside ${{ inputs.project_path }}/.

Result: The upload-artifact steps will fail to find the test results because they look in the wrong directory (e.g., UnityProject/artifacts/EditMode instead of artifacts/EditMode).

Fix: Either use the action's output (recommended):

# Line 88
path: ${{ steps.editmode-tests.outputs.artifactsPath }}/EditMode

# Line 96  
path: ${{ steps.playmode-tests.outputs.artifactsPath }}/PlayMode

Or use the correct hardcoded paths:

# Line 88
path: artifacts/EditMode

# Line 96
path: artifacts/PlayMode

Reference: See the game-ci/unity-test-runner documentation which shows that artifactsPath defaults to artifacts at the repository root, independent of projectPath.

@JasonXuDeveloper JasonXuDeveloper merged commit f99ecee into master Jan 25, 2026
7 checks passed
@JasonXuDeveloper JasonXuDeveloper deleted the feat/ci-cd-workflows branch January 25, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant