Skip to content

fix: Continue to work on GH action. #9

fix: Continue to work on GH action.

fix: Continue to work on GH action. #9

name: Static Code Analysis
on:
push:
branches:
- main
- feat/static-analysis
pull_request:
branches:
- main
- feat/static-analysis
workflow_dispatch:
jobs:
analyze:
runs-on: ubuntu-latest
steps:
# Checkout - Checks out the code
- name: Checkout code
uses: actions/checkout@v4
with:
lfs: true
# Cache Sets up a Caching mechanism to save on repeat runs
- uses: actions/cache@v3
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
# Setup the .NET Core to make analyzers run properly
- name: Set up .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
# Build (Specifically targetting StandaloneLinux64)
- name: Build project
uses: game-ci/unity-builder@v4
env:
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: StandaloneLinux64
# Generate the project files (this is a prerequisite for running Roslynator Analyzers)
- name: Generate project files
run: |
# Run Unity in batch mode to generate .sln and .csproj files
/opt/unity/Editor/Unity -batchmode -quit -projectPath . -executeMethod UnityEditor.SyncVS.SyncSolution
# Restores NuGet packages (of which the Roslynator Analyzers are members)
- name: Restore NuGet packages
run: |
# Assuming Unity generates files in the root or known subdirectory
dotnet restore eos_plugin_for_unity.sln # Update with the correct path
# Actually run the static code analysis of the project
- name: Run static code analysis
run: |
dotnet build eos_plugin_for_unity.sln /warnaserror /p:TreatWarningsAsErrors=true # Update with the correct path