-
Notifications
You must be signed in to change notification settings - Fork 1
chore: Cherry-picked changes from upstream #30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4525c12
9382543
60bfbb7
599432b
4bf2b57
48c0258
5523be7
41f4b1e
ccfb98c
91d8dd9
a1bf3df
5270a37
c8885bf
69bb1db
84391c0
21be2ae
2ea0b24
0d4abdd
13ac038
0350a4a
81323b9
bca846e
8e49a15
26115f4
a5efe09
3687edf
d5aaf0a
d6bf539
a8f39b9
ed5a078
406a687
68db1ce
f0a9f9d
5278205
9caf78b
d90c38a
93663c1
4e2c25a
7f202a8
2626a92
5338383
e1a9b28
705d563
002dd82
985b58c
3cb291f
f5141f7
99f8008
da068d1
3182f59
e2cca77
ed80b01
0d7510d
9f8ab3d
7bb4c2f
ab9e702
df53471
5f13524
4b903d7
6309830
1be0b71
3104fa8
005c1a4
7a5c88e
7ca4552
8ced823
431d211
729a329
f180292
006bb35
b80b259
0677a56
43f97fd
c5f7ecf
b6711ce
3242f6a
4bc351f
b6806eb
7eff6e3
79d242f
5c1f12a
9c14371
c70ecbd
c82c7b9
117cc5c
9716921
375eab3
4735627
9648089
1e1da40
be410ae
a0a0138
9d45b55
ba90694
8e65d6e
d20e6b2
5df3f2b
a621d90
3f45ca3
7b2f9c4
3dd6cc3
fb1e648
19e6e43
8bc80c9
6aea700
5da561a
4ca925c
af68fd9
c199c33
ca7dc64
ebc233d
db7663e
66b5759
e4cf2fd
68340ce
9c8cc20
9b720e5
ad83a2d
d5207bd
adff71d
e2e6c67
05f74e2
601c760
768cd6a
9e6748a
e0a6714
fc87092
9c696e0
dbf9186
5e77473
56d846b
fd6023c
a51a4c8
4cc0cd3
25eda56
b4d65a4
bb1560f
e1d41b2
e742452
c996fd8
d1036f3
4d20709
8a25fef
12c22ea
1aef29c
9aad0e3
778116b
66f4d13
ffbe24c
495ac7f
ea54b76
11b193b
772fd4b
e128173
d9583cf
22f8d9c
20e1472
9662475
5064965
3050a50
d02e668
29a421c
c065278
6daea16
c2b38ba
0333657
8cfce25
a364e95
5161edd
b1d3a42
141edea
0a59067
af727c5
e0acfeb
d051c3e
1dd3c50
336be87
527181a
a6727af
7997bbd
82e4443
7deb072
1bf757d
906c24a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +0,0 @@ | ||
| dist/ | ||
| lib/ | ||
| node_modules/ | ||
| jest.config.js | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this file. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,90 +0,0 @@ | ||
| { | ||
| "plugins": ["jest", "@typescript-eslint", "prettier", "unicorn"], | ||
| "extends": ["plugin:unicorn/recommended", "plugin:github/recommended", "plugin:prettier/recommended"], | ||
| "parser": "@typescript-eslint/parser", | ||
| "parserOptions": { | ||
| "ecmaVersion": 2020, | ||
| "sourceType": "module", | ||
| "extraFileExtensions": [".mjs"], | ||
| "ecmaFeatures": { | ||
| "impliedStrict": true | ||
| }, | ||
| "project": "./tsconfig.json" | ||
| }, | ||
| "env": { | ||
| "node": true, | ||
| "es6": true, | ||
| "jest/globals": true, | ||
| "es2020": true | ||
| }, | ||
| "rules": { | ||
| // Error out for code formatting errors | ||
| "prettier/prettier": "error", | ||
| // Namespaces or sometimes needed | ||
| "import/no-namespace": "off", | ||
| // Properly format comments | ||
| "spaced-comment": ["error", "always"], | ||
| "lines-around-comment": [ | ||
| "error", | ||
| { | ||
| "beforeBlockComment": true, | ||
| "beforeLineComment": true, | ||
| "allowBlockStart": true, | ||
| "allowObjectStart": true, | ||
| "allowArrayStart": true, | ||
| "allowClassStart": true, | ||
| "ignorePattern": "pragma|ts-ignore" | ||
| } | ||
| ], | ||
| // Mandatory spacing | ||
| "padding-line-between-statements": [ | ||
| "error", | ||
| { | ||
| "blankLine": "always", | ||
| "prev": "*", | ||
| "next": "return" | ||
| }, | ||
| { | ||
| "blankLine": "always", | ||
| "prev": "directive", | ||
| "next": "*" | ||
| }, | ||
| { | ||
| "blankLine": "any", | ||
| "prev": "directive", | ||
| "next": "directive" | ||
| } | ||
| ], | ||
| // Enforce camelCase | ||
| "camelcase": "error", | ||
| // Allow forOfStatements | ||
| "no-restricted-syntax": ["error", "ForInStatement", "LabeledStatement", "WithStatement"], | ||
| // Continue is viable in forOf loops in generators | ||
| "no-continue": "off", | ||
| // From experience, named exports are almost always desired. I got tired of this rule | ||
| "import/prefer-default-export": "off", | ||
| // Unused vars are useful to keep method signatures consistent and documented | ||
| "@typescript-eslint/no-unused-vars": "off", | ||
| // For this project only use kebab-case | ||
| "unicorn/filename-case": [ | ||
| "error", | ||
| { | ||
| "cases": { | ||
| "kebabCase": true | ||
| } | ||
| } | ||
| ], | ||
| // Allow Array.from(set) mitigate TS2569 which would require '--downlevelIteration' | ||
| "unicorn/prefer-spread": "off", | ||
| // Temp disable to prevent mixing changes with other PRs | ||
| "i18n-text/no-en": "off" | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": ["jest.setup.js"], | ||
| "rules": { | ||
| "import/no-commonjs": "off" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,202 @@ | ||
| name: Validate Community Plugins | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| plugin_filter: | ||
| description: 'Filter plugins by name (regex pattern, empty = all)' | ||
| required: false | ||
| default: '' | ||
| unity_version: | ||
| description: 'Override Unity version (empty = use plugin default)' | ||
| required: false | ||
| default: '' | ||
|
|
||
| permissions: | ||
| contents: read | ||
| issues: write | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need write permission? |
||
|
|
||
| jobs: | ||
| load-plugins: | ||
| name: Load Plugin Registry | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| matrix: ${{ steps.parse.outputs.matrix }} | ||
| plugin_count: ${{ steps.parse.outputs.count }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just note that we should update this and other refs of this checkout action to v7 in a subsequent PR. Let's keep this PR strictly to upstream changes. |
||
|
|
||
| - name: Parse plugin registry | ||
| id: parse | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const fs = require('fs'); | ||
| const yaml = require('js-yaml'); | ||
|
|
||
| const registry = yaml.load(fs.readFileSync('community-plugins.yml', 'utf8')); | ||
| let plugins = registry.plugins || []; | ||
|
|
||
| // Apply name filter if provided | ||
| const filter = '${{ github.event.inputs.plugin_filter }}'; | ||
| if (filter) { | ||
| const regex = new RegExp(filter, 'i'); | ||
| plugins = plugins.filter(p => regex.test(p.name)); | ||
| } | ||
|
|
||
| // Expand platform matrix | ||
| const matrix = []; | ||
| for (const plugin of plugins) { | ||
| const platforms = plugin.platforms || ['StandaloneLinux64']; | ||
| for (const platform of platforms) { | ||
| matrix.push({ | ||
| name: plugin.name, | ||
| package: plugin.package, | ||
| source: plugin.source || 'git', | ||
| unity: '${{ github.event.inputs.unity_version }}' || plugin.unity || '2021.3', | ||
| platform: platform, | ||
| timeout: plugin.timeout || 30 | ||
| }); | ||
| } | ||
| } | ||
|
|
||
| core.setOutput('matrix', JSON.stringify({ include: matrix })); | ||
| core.setOutput('count', matrix.length); | ||
| console.log(`Found ${matrix.length} plugin-platform combinations to validate`); | ||
|
|
||
| validate: | ||
| name: '${{ matrix.name }} (${{ matrix.platform }})' | ||
| needs: load-plugins | ||
| if: needs.load-plugins.outputs.plugin_count > 0 | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: ${{ fromJson(matrix.timeout) }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: ${{ fromJson(needs.load-plugins.outputs.matrix) }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Create test project | ||
| run: | | ||
| mkdir -p test-project/Assets | ||
| mkdir -p test-project/Packages | ||
| mkdir -p test-project/ProjectSettings | ||
|
|
||
| # Create minimal manifest.json | ||
| if [ "${{ matrix.source }}" = "git" ]; then | ||
| cat > test-project/Packages/manifest.json << 'MANIFEST' | ||
| { | ||
| "dependencies": { | ||
| "com.unity.modules.imgui": "1.0.0", | ||
| "com.unity.modules.jsonserialize": "1.0.0" | ||
| } | ||
| } | ||
| MANIFEST | ||
|
|
||
| # Add git package via manifest | ||
| cd test-project | ||
| python3 -c " | ||
| import sys, json | ||
| manifest = json.load(sys.stdin) | ||
| manifest['dependencies']['${{ matrix.name }}'] = '${{ matrix.package }}' | ||
| json.dump(manifest, sys.stdout, indent=2) | ||
| " < Packages/manifest.json > Packages/manifest.tmp && mv Packages/manifest.tmp Packages/manifest.json | ||
| cd .. | ||
| fi | ||
|
|
||
| # Create minimal ProjectSettings | ||
| cat > test-project/ProjectSettings/ProjectVersion.txt << EOF | ||
| m_EditorVersion: ${{ matrix.unity }} | ||
| EOF | ||
|
|
||
| - name: Build with unity-builder | ||
| uses: ./ | ||
| id: build | ||
| with: | ||
| projectPath: test-project | ||
| targetPlatform: ${{ matrix.platform }} | ||
| unityVersion: ${{ matrix.unity }} | ||
| continue-on-error: true | ||
|
|
||
| - name: Record result | ||
| if: always() | ||
| run: | | ||
| STATUS="${{ steps.build.outcome }}" | ||
| { | ||
| echo "## ${{ matrix.name }} — ${{ matrix.platform }}" | ||
| echo "" | ||
| if [ "$STATUS" = "success" ]; then | ||
| echo "✅ **PASSED** — Compiled and built successfully" | ||
| else | ||
| echo "❌ **FAILED** — Build or compilation failed" | ||
| fi | ||
| echo "" | ||
| echo "- Unity: ${{ matrix.unity }}" | ||
| echo "- Platform: ${{ matrix.platform }}" | ||
| echo "- Source: ${{ matrix.source }}" | ||
| echo "- Package: \`${{ matrix.package }}\`" | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
|
|
||
| report: | ||
| name: Validation Report | ||
| needs: [load-plugins, validate] | ||
| if: always() | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Generate summary | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const { data: run } = await github.rest.actions.listJobsForWorkflowRun({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| run_id: context.runId | ||
| }); | ||
|
|
||
| const validateJobs = run.jobs.filter(j => j.name.startsWith('validate')); | ||
| const passed = validateJobs.filter(j => j.conclusion === 'success').length; | ||
| const failed = validateJobs.filter(j => j.conclusion === 'failure').length; | ||
| const total = validateJobs.length; | ||
|
|
||
| let summary = `# Community Plugin Validation Report\n\n`; | ||
| summary += `**${passed}/${total} passed** | ${failed} failed\n\n`; | ||
| summary += `| Plugin | Platform | Status |\n|--------|----------|--------|\n`; | ||
|
|
||
| for (const job of validateJobs) { | ||
| const icon = job.conclusion === 'success' ? '✅' : '❌'; | ||
| summary += `| ${job.name} | | ${icon} ${job.conclusion} |\n`; | ||
| } | ||
|
|
||
| await core.summary.addRaw(summary).write(); | ||
|
|
||
| // Create or update issue if there are failures | ||
| if (failed > 0) { | ||
| const title = `Community Plugin Validation: ${failed} failure(s) — ${new Date().toISOString().split('T')[0]}`; | ||
| const body = summary + `\n\n[Workflow Run](${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId})`; | ||
|
|
||
| const { data: issues } = await github.rest.issues.listForRepo({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| state: 'open', | ||
| labels: 'community-plugin-validation' | ||
| }); | ||
|
|
||
| if (issues.length > 0) { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: issues[0].number, | ||
| body: body | ||
| }); | ||
| } else { | ||
| await github.rest.issues.create({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| title: title, | ||
| body: body, | ||
| labels: ['community-plugin-validation'] | ||
| }); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this file.