Skip to content

Commit af5e674

Browse files
Updated format check script
1 parent 6761cd5 commit af5e674

File tree

3 files changed

+41
-23
lines changed

3 files changed

+41
-23
lines changed
8.92 MB
Binary file not shown.
Lines changed: 40 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
name: C# Code Style Check
22

33
on:
4-
pull_request:
5-
branches: [ "main" ]
4+
pull_request_target:
5+
types: [opened, synchronize, reopened]
6+
branches: [ "main" ]
67
push:
78
branches: [ "main" ]
89

910
jobs:
1011
quality_check_and_build:
11-
runs-on: ubuntu-latest
12+
runs-on: ubuntu-22.04
1213

1314
env:
14-
FORMAT_PROJECT_FILE: TempFormat.csproj
1515
PACKAGE_PATH: my-package
1616
PACKAGE_NAME: com.google.xr.extensions
1717

@@ -24,25 +24,42 @@ jobs:
2424
path: ${{ env.PACKAGE_PATH }}
2525
fetch-depth: 0
2626

27-
- name: Setup .NET SDK
28-
uses: actions/setup-dotnet@v4
29-
with:
30-
dotnet-version: 8.0.x
3127

3228
## Step 2: C# Style & Formatting Check
33-
- name: Create Temporary Formatting Project
34-
run: |
35-
echo '<Project Sdk="Microsoft.NET.Sdk">' > ${{ env.FORMAT_PROJECT_FILE }}
36-
echo ' <PropertyGroup>' >> ${{ env.FORMAT_PROJECT_FILE }}
37-
echo ' <TargetFramework>netstandard2.0</TargetFramework>' >> ${{ env.FORMAT_PROJECT_FILE }}
38-
echo ' <IsPackable>false</IsPackable>' >> ${{ env.FORMAT_PROJECT_FILE }}
39-
echo ' </PropertyGroup>' >> ${{ env.FORMAT_PROJECT_FILE }}
40-
echo ' <ItemGroup>' >> ${{ env.FORMAT_PROJECT_FILE }}
41-
echo ' <Compile Include="./**/*.cs" Exclude="**/*.Generated.cs;**/*.g.cs" />' >> ${{ env.FORMAT_PROJECT_FILE }}
42-
echo ' </ItemGroup>' >> ${{ env.FORMAT_PROJECT_FILE }}
43-
echo '</Project>' >> ${{ env.FORMAT_PROJECT_FILE }}
44-
45-
- name: Run DotNet Format Check
29+
- name: Run Style Check
30+
env:
31+
ZIP_PASSWORD: ${{ secrets.UNITY_FORMAT_CHECK }}
4632
run: |
47-
dotnet format TempFormat.csproj --verify-no-changes --verbosity normal
48-
rm ${{ env.FORMAT_PROJECT_FILE }}
33+
sudo dpkg --add-architecture i386
34+
sudo apt-get update
35+
sudo apt-get install -y libc6:i386 libncurses5:i386 libstdc++6:i386 zlib1g:i386 dos2unix
36+
37+
# --- 2. Fix Missing 32-bit Loader ---
38+
# Crucial: Legacy binaries look for /lib/ld-linux.so.2
39+
if [ ! -f /lib/ld-linux.so.2 ]; then
40+
sudo ln -s /lib/i386-linux-gnu/ld-linux.so.2 /lib/ld-linux.so.2
41+
fi
42+
43+
# --- 3. Clean & Unzip ---
44+
rm -rf /tmp/working_dir
45+
mkdir -p /tmp/working_dir
46+
# -o overwrites without asking, -q is quiet
47+
pushd ${{ env.PACKAGE_PATH }}
48+
unzip -o -P "$ZIP_PASSWORD" -q ".github/StyleDeputyWithUnityRules.zip" -d "/tmp/working_dir"
49+
50+
# --- 4. Fix The "No Such File" Errors ---
51+
WRAPPER="/tmp/working_dir/google3/devtools/unity3d/style_deputy/_StyleDeputyWithUnityRules_binary"
52+
MONO="/tmp/working_dir/google3/mono-sgen"
53+
54+
# FIX A: Convert Windows Line Endings to Linux (Critical!)
55+
dos2unix "$WRAPPER"
56+
57+
# FIX B: specific chmod for both the wrapper AND the inner mono binary
58+
chmod +x "$WRAPPER"
59+
chmod +x "$MONO"
60+
61+
# --- 5. Run ---
62+
# The wrapper script expects this env var to find its files
63+
export TEST_SRCDIR="/tmp/working_dir"
64+
TEST_SRCDIR="/tmp/working_dir" "$WRAPPER" --style="/tmp/working_dir/google3/ExternalCSharpStyle.StyleCop" .
65+
popd

Samples~/HandMesh/HandMeshController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ private void Update()
122122
{
123123
continue;
124124
}
125+
125126
if (info.ChangeState == MeshChangeState.Added
126127
|| info.ChangeState == MeshChangeState.Updated)
127128
{

0 commit comments

Comments
 (0)