Fix BatchFixer (#311) #665
This file contains 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: CI-Windows | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
pull_request: | |
branches: | |
- main | |
- release/* | |
jobs: | |
windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v1 | |
- name: Set Environment Variables | |
uses: ./.github/actions/setvars | |
with: | |
varFilePath: ./.github/variables/unity.env | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: '8.0.x' | |
include-prerelease: false | |
# So far we need Unity assemblies (Managed) and framework 4.7.1 reference assemblies (MonoBleedingEdge\lib\mono\4.7.1-api) for testing | |
# We don't need to download/install Unity every run, we just need to cache those managed assemblies | |
# But we have to deal with the following: | |
# - the cache only works under the GITHUB_WORKSPACE folder (so we cannot cache C:\Program Files\Unity) | |
# - the cache is linited to 400M per run (so we cannot cache the full Unity installation) | |
# - When Unity is not installed, our detection logic will fallback to C:\Program Files\Unity given we miss registry keys | |
- name: Enable Unity Cache Support | |
id: cache-unity | |
uses: actions/cache@v3 | |
with: | |
key: ${{ runner.os }}-unitycache-${{ env.UNITY_FULL_VERSION }} | |
path: UnityCache | |
- name: Download Unity | |
if: steps.cache-unity.outputs.cache-hit != 'true' | |
run: bitsadmin /TRANSFER unity /DOWNLOAD /PRIORITY foreground "https://download.unity3d.com/download_unity/${{ env.UNITY_HASH }}/Windows64EditorInstaller/UnitySetup64-${{ env.UNITY_FULL_VERSION }}.exe" "%CD%\unitysetup.exe" | |
shell: cmd | |
- name: Install Unity | |
if: steps.cache-unity.outputs.cache-hit != 'true' | |
run: unitysetup.exe /UI=reduced /S /D=%ProgramFiles%\Unity | |
shell: cmd | |
- name: Prepare Managed Cache | |
if: steps.cache-unity.outputs.cache-hit != 'true' | |
run: xcopy /s /i /y /q "C:\Program Files\Unity\Editor\Data\Managed" "UnityCache\Managed" | |
shell: cmd | |
- name: Prepare MonoBleedingEdge Cache | |
if: steps.cache-unity.outputs.cache-hit != 'true' | |
run: xcopy /s /i /y /q "C:\Program Files\Unity\Editor\Data\MonoBleedingEdge" "UnityCache\MonoBleedingEdge" | |
shell: cmd | |
- name: Restore Managed Cache | |
if: steps.cache-unity.outputs.cache-hit == 'true' | |
run: xcopy /s /i /y /q "UnityCache\Managed" "C:\Program Files\Unity\Editor\Data\Managed" | |
shell: cmd | |
- name: Restore MonoBleedingEdge Cache | |
if: steps.cache-unity.outputs.cache-hit == 'true' | |
run: xcopy /s /i /y /q "UnityCache\MonoBleedingEdge" "C:\Program Files\Unity\Editor\Data\MonoBleedingEdge" | |
shell: cmd | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v2 | |
- name: Build | |
run: dotnet build -c Debug ./src/Microsoft.Unity.Analyzers.sln /p:UseSharedCompilation=false | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: 1 | |
shell: cmd | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v2 | |
- name: Test context (main) | |
if: github.ref == 'refs/heads/main' | |
run: echo "TEST_FILTER=." >> $GITHUB_ENV | |
shell: bash | |
- name: Test context (feature) | |
if: github.ref != 'refs/heads/main' | |
run: echo "TEST_FILTER=FullyQualifiedName!~ConsistencyTests" >> $GITHUB_ENV | |
shell: bash | |
- name: Test | |
run: dotnet test -c Debug ./src/Microsoft.Unity.Analyzers.Tests --filter ${{env.TEST_FILTER}} | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: 1 | |
shell: cmd |