test_mac_protobuf_generation: name: Protobuf Generation Tests agent: type: Unity::VM::osx image: ml-agents/ml-agents-bokken-mac:0.1.4-492264 flavor: b1.small variables: GRPC_VERSION: "1.14.1" CS_PROTO_PATH: "com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects" commands: - | brew install nuget nuget install Grpc.Tools -Version $GRPC_VERSION -OutputDirectory protobuf-definitions/ python3 -m venv venv . venv/bin/activate pip install --upgrade pip --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple 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 cd protobuf-definitions chmod +x Grpc.Tools.$GRPC_VERSION/tools/macosx_x64/protoc chmod +x Grpc.Tools.$GRPC_VERSION/tools/macosx_x64/grpc_csharp_plugin COMPILER=Grpc.Tools.$GRPC_VERSION/tools/macosx_x64 ./make.sh 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 "master" 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 ".yamato/protobuf-generation-test.yml") AND NOT pull_request.changes.all match "protobuf-definitions/**/*.md" artifacts: patch: paths: - "artifacts/*.*"