chore(project): upgrade to Unity 2021.3.42f1 #178
Workflow file for this run
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 | |
on: | |
push: | |
branches: | |
- main | |
- next | |
pull_request: | |
types: [opened, synchronize, reopened] | |
workflow_dispatch: {} | |
env: | |
PROJECT_UNITY_VERSION: 2021.3.45f1 | |
UNITY_2020_VERSION: 2020.3.48f1 | |
DISABLE_BUILD_PLATFORM: StandaloneWindows64 | |
jobs: | |
buildAndTestForLinux: | |
name: Test on ${{ matrix.unityVersion }} (${{ matrix.targetPlatform }}) | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
unityVersion: | |
- 2020.3.48f1 | |
- 2021.3.45f1 | |
- 2022.3.50f1 | |
- 6000.0.23f1 | |
targetPlatform: | |
- StandaloneLinux64 | |
- StandaloneWindows64 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}- | |
Library-${{ matrix.targetPlatform }}- | |
Library- | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Set up Node.js | |
if: ${{ matrix.unityVersion == env.UNITY_2020_VERSION }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
- name: Set up Roslyn for Unity 2020 | |
if: ${{ matrix.unityVersion == env.UNITY_2020_VERSION }} | |
run: | | |
npm install -g openupm-cli | |
openupm add com.unity.roslyn | |
- uses: game-ci/unity-test-runner@v4 | |
id: testRunner | |
env: | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
with: | |
unityVersion: ${{ matrix.unityVersion }} | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
customParameters: -debugCodeOptimization -enableCodeCoverage -coverageResultsPath ./CodeCoverage -coverageOptions "useProjectSettings;generateAdditionalMetrics" | |
- name: Build Roslyn project | |
run: dotnet build ./UIComponents.Roslyn/UIComponents.Roslyn.sln -c Release | |
- name: Test Roslyn project | |
run: dotnet test ./UIComponents.Roslyn/UIComponents.Roslyn.sln -c Release --no-build --verbosity normal --collect:"XPlat Code Coverage;ExcludeByFile=**/*.Designer.cs" | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: Test results (all modes) | |
path: ${{ steps.testRunner.outputs.artifactsPath }} | |
- name: Upload code coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
name: Tests | |
flags: automated | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: CodeCoverage/**/*.xml,UIComponents.Roslyn/**/TestResults/**/coverage.cobertura.xml | |
- name: Commit Unity project changes | |
if: ${{ matrix.targetPlatform != env.DISABLE_BUILD_PLATFORM }} | |
run: | | |
git config --global user.name 'github-bot' | |
git config --global user.email 'github-bot@users.noreply.github.com' | |
git add -A | |
git commit -m "chore(ci): switch to different unity version" || echo skipping commit | |
- uses: game-ci/unity-builder@v4 | |
if: ${{ matrix.targetPlatform != env.DISABLE_BUILD_PLATFORM }} | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
unityVersion: ${{ matrix.unityVersion }} | |
targetPlatform: ${{ matrix.targetPlatform }} |