Skip to content

31 add object adapter #47

31 add object adapter

31 add object adapter #47

name: 🧪 Unit Tests And Code Coverage
on:
pull_request:
branches:
- main
jobs:
testAllModes:
name: Test in ${{ matrix.testMode }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- temp_package
unityVersion: [2022.3.21f1]
testMode:
- playmode
- editmode
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create temp_package directory
run: mkdir temp_package
- name: Move package to temp_package directory
run: |
shopt -s extglob
mv !(temp_package|.github) temp_package/
mv .github temp_package/.github
- name: Verify package.json existence
run: |
if [ ! -f temp_package/package.json ]; then
echo "package.json not found in temp_package"
exit 1
fi
- name: Get runner's uid and gid
id: runner-info
run: |
echo "uid=$(id -u)" >> $GITHUB_ENV
echo "gid=$(id -g)" >> $GITHUB_ENV
- name: Run Unity Tests
uses: game-ci/unity-test-runner@v4
id: tests
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
packageMode: true
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
testMode: ${{ matrix.testMode }}
artifactsPath: ${{ matrix.testMode }}-artifacts
githubToken: ${{ secrets.GITHUB_TOKEN }}
checkName: ${{ matrix.testMode }} Test Results
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+Soobak.SoobakUnityLibrary.*'
- name: Upload Test Results
uses: actions/upload-artifact@v4
if: always()
with:
name: Test results for ${{ matrix.testMode }}
path: ${{ matrix.testMode }}-artifacts
- name: Upload Coverage Results
uses: actions/upload-artifact@v4
if: always()
with:
name: Coverage results for ${{ matrix.testMode }}
path: CodeCoverage/
- name: Upload Badge Coverage Report
uses: actions/upload-artifact@v4
if: always()
with:
name: Badge coverage report for ${{ matrix.testMode }}
path: CodeCoverage/Report/badge_linecoverage.svg
combineResults:
needs: [testAllModes]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install Dependencies
run: npm install xml2js @actions/github@latest
- name: Combine results and create comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node .github/scripts/combine-results.js