您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
43 行
2.2 KiB
43 行
2.2 KiB
test_linux_protobuf_generation:
|
|
name: Protobuf Generation Tests
|
|
agent:
|
|
type: Unity::VM
|
|
image: package-ci/ubuntu:stable
|
|
flavor: b1.large
|
|
variables:
|
|
GRPC_VERSION: "1.14.1"
|
|
CS_PROTO_PATH: "com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects"
|
|
commands:
|
|
- |
|
|
sudo apt-get update && sudo apt-get install -y python3-venv nuget
|
|
python3 -m venv venv && source venv/bin/activate
|
|
nuget install Grpc.Tools -Version $GRPC_VERSION -OutputDirectory protobuf-definitions/
|
|
python3 -m pip install --upgrade pip --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
|
|
python3 -m pip install grpcio==1.28.1 grpcio-tools==1.13.0 protobuf==3.11.3 six==1.14.0 mypy-protobuf==1.16.0 --progress-bar=off --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple
|
|
pushd protobuf-definitions
|
|
chmod +x Grpc.Tools.$GRPC_VERSION/tools/linux_x64/protoc
|
|
chmod +x Grpc.Tools.$GRPC_VERSION/tools/linux_x64/grpc_csharp_plugin
|
|
COMPILER=Grpc.Tools.$GRPC_VERSION/tools/linux_x64 ./make.sh
|
|
popd
|
|
mkdir -p artifacts
|
|
touch artifacts/proto.patch
|
|
git diff --exit-code -- :/ ":(exclude,top)$CS_PROTO_PATH/*.meta" \
|
|
|| { GIT_ERR=$?; echo "protobufs need to be regenerated, apply the patch uploaded to artifacts."; \
|
|
echo "Apply the patch with the command 'git apply proto.patch'"; \
|
|
git diff -- :/ ":(exclude,top)$CS_PROTO_PATH/*.meta" > artifacts/proto.patch; exit $GIT_ERR; }
|
|
triggers:
|
|
cancel_old_ci: true
|
|
expression: |
|
|
(pull_request.target eq "main" OR
|
|
pull_request.target eq "v2-staging" OR
|
|
pull_request.target match "release.+") AND
|
|
NOT pull_request.draft AND
|
|
(pull_request.changes.any match "protobuf-definitions/**" OR
|
|
pull_request.changes.any match "com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects/**" OR
|
|
pull_request.changes.any match "ml-agents-envs/mlagents_envs/communicator_objects/**" OR
|
|
pull_request.changes.any match ".yamato/protobuf-generation-test.yml") AND
|
|
NOT pull_request.changes.all match "protobuf-definitions/**/*.md"
|
|
artifacts:
|
|
patch:
|
|
paths:
|
|
- "artifacts/*.*"
|