remaining format fix to pass presubmit #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: C# Code Quality and Build | |
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| push: | |
| branches: [ "main" ] | |
| jobs: | |
| quality_check_and_build: | |
| runs-on: ubuntu-latest | |
| env: | |
| FORMAT_PROJECT_FILE: TempFormat.csproj | |
| PACKAGE_PATH: my-package | |
| PACKAGE_NAME: com.google.xr.extensions | |
| steps: | |
| ## Step 1: Checkout and Environment Setup | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| path: ${{ env.PACKAGE_PATH }} | |
| fetch-depth: 0 | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| ## Step 2: C# Style & Formatting Check | |
| - name: Create Temporary Formatting Project | |
| run: | | |
| echo '<Project Sdk="Microsoft.NET.Sdk">' > TempFormat.csproj | |
| echo ' <PropertyGroup>' >> ${{ env.FORMAT_PROJECT_FILE }} | |
| echo ' <TargetFramework>netstandard2.0</TargetFramework>' >> TempFormat.csproj | |
| echo ' <IsPackable>false</IsPackable>' >> TempFormat.csproj | |
| echo ' </PropertyGroup>' >> TempFormat.csproj | |
| echo ' <ItemGroup>' >> TempFormat.csproj | |
| echo ' <Compile Include="./**/*.cs" Exclude="**/*.Generated.cs;**/*.g.cs" />' >> TempFormat.csproj | |
| echo ' </ItemGroup>' >> TempFormat.csproj | |
| echo '</Project>' >> TempFormat.csproj | |
| - name: Run DotNet Format Check | |
| run: | | |
| dotnet format TempFormat.csproj --verify-no-changes --verbosity normal | |
| rm ${{ env.FORMAT_PROJECT_FILE }} | |
| ## Step 3: Prepare Unity Environment | |
| - name: Checkout Template Project | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: game-ci/unity-test-runner | |
| path: template-repo | |
| fetch-depth: 1 | |
| - name: Prepare Project & Inject Package | |
| id: setup_project | |
| run: | | |
| # Setup Integration Project from Template | |
| mv template-repo/unity-project-with-correct-tests IntegrationProject | |
| rm -rf template-repo | |
| rm -rf IntegrationProject/Assets/* | |
| mkdir -p IntegrationProject/Assets | |
| # Inject Package | |
| DEST="IntegrationProject/Packages/${{ env.PACKAGE_NAME }}" | |
| mkdir -p $DEST | |
| rsync -av --exclude='.git' ${{ env.PACKAGE_PATH }}/ $DEST/ | |
| # Update Project Version | |
| UNITY_VER=$(jq -r '.unity' ${{ env.PACKAGE_PATH }}/package.json) | |
| UNITY_REL=$(jq -r '.unityRelease // empty' ${{ env.PACKAGE_PATH }}/package.json) | |
| if [[ -n "$UNITY_REL" && "$UNITY_REL" != "null" ]]; then | |
| FULL_VER="$UNITY_VER.$UNITY_REL" | |
| else | |
| FULL_VER="$UNITY_VER" | |
| fi | |
| echo "m_EditorVersion: $FULL_VER" > IntegrationProject/ProjectSettings/ProjectVersion.txt | |
| echo "unity_version=$FULL_VER" >> $GITHUB_OUTPUT | |
| - name: Free Up Disk Space | |
| uses: jlumbroso/free-disk-space@main | |
| with: | |
| tool-cache: false | |
| android: true | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| swap-storage: true | |
| ## Step 4: Compile and Validate | |
| - name: Test & Compile | |
| uses: game-ci/unity-test-runner@v4 | |
| env: | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
| with: | |
| unityVersion: ${{ steps.setup_project.outputs.unity_version }} | |
| projectPath: IntegrationProject | |
| testMode: EditMode | |
| checkName: "Compilation Check" | |
| ## Step 5: License Cleanup | |
| - name: Return License | |
| if: always() | |
| uses: game-ci/unity-return-license@v2 | |
| env: | |
| UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} |