Skip to content

Commit

Permalink
Merge pull request #34 from star-e/v3.6.0-pipeline
Browse files Browse the repository at this point in the history
V3.6.0 pipeline
  • Loading branch information
zxx43 committed Jun 16, 2022
2 parents 1989aba + 5cf470c commit e36fbae
Show file tree
Hide file tree
Showing 81 changed files with 1,968 additions and 1,978 deletions.
172 changes: 143 additions & 29 deletions .github/workflows/run_test_cases.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,179 @@
name: run test cases

on:
pull_request:
pull_request_target:
issue_comment:
types: [created, edited]
pull_request_review_comment:
types: [created, edited]

# github.head_ref is only defined on pull_request events
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
run-test-cases:
Win-RunTestCases:
if: |
github.event.issue.pull_request && contains(github.event.comment.body, '@cocos-robot run test cases')
runs-on: run-test-win01
contains(github.event.pull_request.body, '[X] needs automatic test cases check') ||
contains(github.event.comment.body, '@cocos-robot run test cases')
runs-on: self-hosted-win

steps:
- uses: octokit/request-action@v2.x
id: find_pull_request
- name: Get PR Number
id: get_pr
shell: pwsh
run: |
if ("${{ github.event_name }}" -eq "issue_comment") {
Write-Host "::set-output name=pr_number::${{ github.event.issue.number }}"
}
else {
Write-Host "::set-output name=pr_number::${{ github.event.pull_request.number }}"
}
- name: Get PR Details
id: pr_details
uses: octokit/request-action@v2.x
with:
route: GET /repos/cocos-creator/engine/pulls/${{ github.event.issue.number }}
route: GET /repos/cocos/cocos-engine/pulls/${{ steps.get_pr.outputs.pr_number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Parse Pull Request
id: parse_pull_request
id: parse_pr
shell: pwsh
run: |
$pull_request = @"
${{ steps.find_pull_request.outputs.data }}
${{ steps.pr_details.outputs.data }}
"@ | ConvertFrom-Json
Write-Host $pull_request
Write-Host "::set-output name=pr_html_url::$($pull_request.html_url)"
Write-Host "::set-output name=pr_number::$($pull_request.number)"
Write-Host "::set-output name=pr_author::$($pull_request.user.login)"
Write-Host "::set-output name=pr_head_ref::$($pull_request.head.ref)"
Write-Host "::set-output name=pr_head_sha::$($pull_request.head.sha)"
Write-Host "::set-output name=pr_base_ref::$($pull_request.base.ref)"
Write-Host "::set-output name=pr_base_sha::$($pull_request.base.sha)"
- name: Echo pull request
- name: Check Job Parameter
run: |
echo "${{ steps.parse_pull_request.outputs.pr_head_ref }}"
echo "${{ steps.parse_pull_request.outputs.pr_head_sha }}"
echo "${{ steps.parse_pull_request.outputs.pr_base_ref }}"
echo "${{ steps.parse_pull_request.outputs.pr_base_sha }}"
- name: update comment
echo "${{ steps.parse_pr.outputs.pr_head_ref }}"
echo "${{ steps.parse_pr.outputs.pr_head_sha }}"
echo "${{ steps.parse_pr.outputs.pr_base_ref }}"
echo "${{ steps.parse_pr.outputs.pr_base_sha }}"
- name: Checkout engine
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ steps.parse_pr.outputs.pr_base_ref }}

- name: Checkout rebase
run: |
git fetch origin
git reset --hard
git checkout origin/${{ steps.parse_pr.outputs.pr_base_ref }}
git pull origin ${{ steps.parse_pr.outputs.pr_base_ref }} --allow-unrelated-histories
git branch -D ${{ steps.parse_pr.outputs.pr_base_ref }}
git branch ${{ steps.parse_pr.outputs.pr_base_ref }}
git fetch origin pull/${{ steps.get_pr.outputs.pr_number }}/head:pull-${{ steps.get_pr.outputs.pr_number }}
git merge --ff -s recursive --no-verify -m "PR Test" origin/${{ steps.parse_pr.outputs.pr_base_ref }} pull-${{ steps.get_pr.outputs.pr_number }}
- name: npm install
run: |
npm -v
npm install --registry https://registry.npm.taobao.org
- name: Run test cases
timeout-minutes: 120
id: run_test_cases
run: |
cd ..
python3 -u ./python/main.py ${{ steps.parse_pr.outputs.pr_base_ref }}
- name: Update Comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ steps.parse_pull_request.outputs.pr_number }}
issue-number: ${{ steps.get_pr.outputs.pr_number }}
body: |
@${{ steps.parse_pull_request.outputs.pr_author }},请查阅任务(run test cases)执行结果:https://github.com/cocos-creator/engine/actions/runs/${{ github.run_id }}
- name: 'Checkout engine'
uses: actions/checkout@v2
@${{ steps.parse_pr.outputs.pr_author }}, Please check the result of `run test cases`:
- Test Platform: Windows
- Task Result: ${{ steps.run_test_cases.outputs.task }}
- Task URL: ${{ steps.run_test_cases.outputs.url }}
- Task Details: ${{ steps.run_test_cases.outputs.msg }}
- GitHub Action: https://github.com/cocos/cocos-engine/actions/runs/${{ github.run_id }}
macOS-RunTestCases:
if: |
contains(github.event.pull_request.body, '[X] needs automatic test cases check') ||
contains(github.event.comment.body, '@cocos-robot run test cases')
runs-on: self-hosted-mac

steps:
- name: Get PR Number
id: get_pr
shell: pwsh
run: |
if ("${{ github.event_name }}" -eq "issue_comment") {
Write-Host "::set-output name=pr_number::${{ github.event.issue.number }}"
}
else {
Write-Host "::set-output name=pr_number::${{ github.event.pull_request.number }}"
}
- name: Get PR Details
id: pr_deatils
uses: octokit/request-action@v2.x
with:
route: GET /repos/cocos/cocos-engine/pulls/${{ steps.get_pr.outputs.pr_number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Parse Pull Request
id: parse_pr
shell: pwsh
run: |
$pull_request = @"
${{ steps.pr_deatils.outputs.data }}
"@ | ConvertFrom-Json
Write-Host $pull_request
Write-Host "::set-output name=pr_html_url::$($pull_request.html_url)"
Write-Host "::set-output name=pr_author::$($pull_request.user.login)"
Write-Host "::set-output name=pr_head_ref::$($pull_request.head.ref)"
Write-Host "::set-output name=pr_head_sha::$($pull_request.head.sha)"
Write-Host "::set-output name=pr_base_ref::$($pull_request.base.ref)"
Write-Host "::set-output name=pr_base_sha::$($pull_request.base.sha)"
- name: Check Job Parameter
run: |
echo "${{ steps.parse_pr.outputs.pr_head_ref }}"
echo "${{ steps.parse_pr.outputs.pr_head_sha }}"
echo "${{ steps.parse_pr.outputs.pr_base_ref }}"
echo "${{ steps.parse_pr.outputs.pr_base_sha }}"
- name: Checkout engine
uses: actions/checkout@v3
with:
ref: ${{ steps.parse_pull_request.outputs.pr_head_sha }}
path: engine
fetch-depth: 0
ref: ${{ steps.parse_pr.outputs.pr_base_ref }}

- name: 'npm install'
- name: Checkout rebase
run: |
git fetch origin
git reset --hard
git checkout origin/${{ steps.parse_pr.outputs.pr_base_ref }}
git pull origin ${{ steps.parse_pr.outputs.pr_base_ref }} --allow-unrelated-histories
git branch -D ${{ steps.parse_pr.outputs.pr_base_ref }}
git branch ${{ steps.parse_pr.outputs.pr_base_ref }}
git fetch origin pull/${{ steps.get_pr.outputs.pr_number }}/head:pull-${{ steps.get_pr.outputs.pr_number }}
git merge --ff -s recursive --no-verify -m "PR Test" origin/${{ steps.parse_pr.outputs.pr_base_ref }} pull-${{ steps.get_pr.outputs.pr_number }}
- name: npm install
run: |
cd engine
npm -v
npm install --registry https://registry.npm.taobao.org
- name: 'Call run test cases job'
- name: Run test cases
timeout-minutes: 90
id: run_test_cases
run: |
python3 -u ./pr-test/main.py ${{ steps.parse_pull_request.outputs.pr_base_ref }}
cd ..
python3 -u ./python/main.py ${{ steps.parse_pr.outputs.pr_base_ref }}
- name: Update Comment
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ steps.get_pr.outputs.pr_number }}
body: |
@${{ steps.parse_pr.outputs.pr_author }}, Please check the result of `run test cases`:
- Test Platform: macOS
- Task Result: ${{ steps.run_test_cases.outputs.task }}
- Task URL: ${{ steps.run_test_cases.outputs.url }}
- Task Details: ${{ steps.run_test_cases.outputs.msg }}
- GitHub Action: https://github.com/cocos/cocos-engine/actions/runs/${{ github.run_id }}
2 changes: 2 additions & 0 deletions @types/jsb.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* API for jsb module
* Author: haroel
* Homepage: https://github.com/haroel/creatorexDTS
*
* @deprecated since v3.6.0, please import `native` from 'cc' module instead like `import { native } from 'cc';`.
*/
declare namespace jsb {

Expand Down
9 changes: 8 additions & 1 deletion cc.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "./cc.config.schema.json",

"features": {
"base": { "modules": [ "base" ], "dependentAssets": ["0835f102-5471-47a3-9a76-01c07ac9cdb2", "b5475517-23b9-4873-bc1a-968d96616081", "0ed97c56-390e-4dd1-96b7-e7f2d93a98ed", "b23391b6-52eb-46a6-8da1-6244d9d315fb"] },
"base": { "modules": [ "base", "native" ], "dependentAssets": ["0835f102-5471-47a3-9a76-01c07ac9cdb2", "b5475517-23b9-4873-bc1a-968d96616081", "0ed97c56-390e-4dd1-96b7-e7f2d93a98ed", "b23391b6-52eb-46a6-8da1-6244d9d315fb"] },
"gfx-webgl": { "modules": [ "gfx-webgl" ] },
"gfx-webgl2": { "modules": [ "gfx-webgl2" ] },
"3d": { "modules": [ "3d" ] },
Expand Down Expand Up @@ -40,6 +40,13 @@
}
},
"moduleOverrides": [
{
"test": "true",
"isVirtualModule": true,
"overrides": {
"internal:native": "cocos/native-binding/impl.ts"
}
},
{
"test": "context.mode === 'BUILD'",
"isVirtualModule": false,
Expand Down
35 changes: 6 additions & 29 deletions cocos/3d/assets/mesh.jsb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
THE SOFTWARE.
*/
import { ccclass, serializable } from 'cc.decorator';
import { _applyDecoratedDescriptor } from '../../core/data/utils/decorator-jsb-utils';
import { legacyCC } from '../../core/global-exports';

export declare namespace Mesh {
Expand All @@ -47,34 +46,8 @@ const meshAssetProto: any = jsb.Mesh.prototype;

meshAssetProto.createNode = null!;

const clsDecorator = ccclass('cc.Mesh');

const _class2$V = Mesh;

const _descriptor$M = _applyDecoratedDescriptor(_class2$V.prototype, '_struct', [serializable], {
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer () {
return {
vertexBundles: [],
primitives: [],
};
},
});
const _descriptor2$y = _applyDecoratedDescriptor(_class2$V.prototype, '_hash', [serializable], {
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer () {
return 0;
},
});

meshAssetProto._ctor = function () {
jsb.Asset.prototype._ctor.apply(this, arguments);
// _initializerDefineProperty(_this, "_struct", _descriptor$M, _assertThisInitialized(_this));
// _initializerDefineProperty(_this, "_hash", _descriptor2$y, _assertThisInitialized(_this));
this._struct = {
vertexBundles: [],
primitives: [],
Expand All @@ -95,6 +68,10 @@ meshAssetProto.onLoaded = function () {
this._struct = null;
};

clsDecorator(Mesh);

legacyCC.Mesh = jsb.Mesh;

// handle meta data, it is generated automatically
const MeshProto = Mesh.prototype;
serializable(MeshProto, '_struct');
serializable(MeshProto, '_hash');
ccclass('cc.Mesh')(Mesh);
39 changes: 6 additions & 33 deletions cocos/3d/assets/skeleton.jsb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,12 @@ import { Mat4 } from '../../core/math';
import { DataPoolManager } from '../skeletal-animation/data-pool-manager';
import { Asset } from '../../core/assets/asset';
import { legacyCC } from '../../core/global-exports';
import { _applyDecoratedDescriptor } from '../../core/data/utils/decorator-jsb-utils';

export const Skeleton = jsb.Skeleton;
export type Skeleton = jsb.Skeleton;
legacyCC.Skeleton = Skeleton;
const skeletonProto: any = Skeleton.prototype;

const skeletonDecorator = ccclass('cc.Skeleton');

Object.defineProperty(skeletonProto, 'bindposes', {
enumerable: true,
configurable: true,
Expand All @@ -55,35 +52,6 @@ Object.defineProperty(skeletonProto, 'bindposes', {
},
});

const _dec2$1 = type([CCString]);
const _dec3$1 = type([Mat4]);

const _descriptor$2 = _applyDecoratedDescriptor(skeletonProto, '_joints', [_dec2$1], {
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer () {
return [];
},
});

const _descriptor2$2 = _applyDecoratedDescriptor(skeletonProto, '_bindposes', [_dec3$1], {
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer () {
return [];
},
});

const _descriptor3$1 = _applyDecoratedDescriptor(skeletonProto, '_hash', [serializable], {
configurable: true,
enumerable: true,
writable: true,
initializer: function initializer () {
return 0;
},
});

skeletonProto._ctor = function () {
jsb.Asset.prototype._ctor.apply(this, arguments);
Expand All @@ -101,4 +69,9 @@ skeletonProto.onLoaded = function () {
oldSkeletonProtoOnLoaded.call(this);
};

skeletonDecorator(Skeleton);
// handle meta data, it is generated automatically
const SkeletonProto = Skeleton.prototype;
type([CCString])(SkeletonProto, '_joints');
type([Mat4])(SkeletonProto, '_bindposes');
serializable(SkeletonProto, '_hash');
ccclass('cc.Skeleton')(Skeleton);
Loading

0 comments on commit e36fbae

Please sign in to comment.