Skip to content

ci: add ci tests for multiple unity versions and build types #19

ci: add ci tests for multiple unity versions and build types

ci: add ci tests for multiple unity versions and build types #19

Workflow file for this run

name: Unity Tests
on:
push:
paths:
- "**.cs"
- ".github/unity-project/**/*"
- ".github/workflows/unity-tests.yml"
pull_request:
paths:
- "**.cs"
jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
unity-version: ['2019.4.31f1', '2021.3.33f1', '2022.3.6f1', '2022.3.15f1']
build-type: ['pure', 'vrcsdk']
exclude:
- unity-version: "2021.3.33f1"
build-type: "vrcsdk"
- unity-version: "2022.3.15f1"
build-type: "vrcsdk"
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup .NET 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Prepare Unity Project
run: |
mv Tests~ Tests
mkdir -p .github/unity-project/Packages/com.chocopoi.vrc.avatarlib
mv [!.github]* .github/unity-project/Packages/com.chocopoi.vrc.avatarlib/
mv .github/unity-project/* .
rm -rf .github/unity-project
ls -l
ls -l Packages/com.chocopoi.vrc.avatarlib
# Cache
- uses: actions/cache@v3
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
- name: Resolve VPM Project
if: matrix.build-type == 'vrcsdk'
run: |
mv Packages/vpm-manifest.${{ matrix.unity-version }}.json Packages/vpm-manifest.json
dotnet tool install --global vrchat.vpm.cli
vpm resolve project
# Test
- name: Run tests
uses: game-ci/unity-test-runner@v4
id: tests
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
checkName: Test Results (${{ matrix.unity-version }}, ${{ matrix.build-type }})
unityVersion: ${{ matrix.unity-version }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
testMode: 'all'
customParameters: '-assemblyNames "com.chocopoi.vrc.avatarlib.Editor.Tests" -nographics'
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+com.chocopoi.vrc.avatarlib.Editor'
# Upload coverage report to GitHub
- uses: actions/upload-artifact@v2
if: always()
with:
name: Coverage results
path: ${{ steps.tests.outputs.coveragePath }}
# Upload coverage report to Codecov
- name: Upload XML report to Codecov
uses: codecov/codecov-action@v3
with:
flags: automated
token: ${{ secrets.CODECOV_TOKEN }}
files: ${{ steps.tests.outputs.coveragePath }}/**/*.xml