2024-09-30 02:05:26 -07:00
|
|
|
# .github/workflows/test.yaml
|
2024-09-30 00:19:46 -07:00
|
|
|
name: Test
|
|
|
|
|
|
|
|
on:
|
2024-09-30 02:47:47 -07:00
|
|
|
schedule:
|
|
|
|
- cron: '0 2 * * *' # Runs at 2 AM UTC every day
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2024-09-30 03:17:04 -07:00
|
|
|
workflow_dispatch:
|
2024-09-30 00:19:46 -07:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
testAllModes:
|
|
|
|
name: Test in ${{ matrix.testMode }}
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
testMode:
|
|
|
|
- playmode
|
|
|
|
- editmode
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
lfs: true
|
2024-09-30 02:05:26 -07:00
|
|
|
|
2024-09-30 00:19:46 -07:00
|
|
|
- uses: actions/cache@v4
|
|
|
|
with:
|
|
|
|
path: ${{ matrix.projectPath }}/Library
|
|
|
|
key: Library-${{ matrix.projectPath }}
|
|
|
|
restore-keys: |
|
|
|
|
Library-
|
2024-09-30 02:05:26 -07:00
|
|
|
|
2024-09-30 00:19:46 -07:00
|
|
|
- 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:
|
|
|
|
projectPath: ${{ matrix.projectPath }}
|
|
|
|
testMode: ${{ matrix.testMode }}
|
|
|
|
artifactsPath: ${{ matrix.testMode }}-artifacts
|
|
|
|
githubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
checkName: ${{ matrix.testMode }} Test Results
|
|
|
|
coverageOptions: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport;assemblyFilters:+bamlab.*'
|
2024-09-30 02:05:26 -07:00
|
|
|
|
2024-09-30 00:19:46 -07:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: Test results for ${{ matrix.testMode }}
|
|
|
|
path: ${{ steps.tests.outputs.artifactsPath }}
|
2024-09-30 02:05:26 -07:00
|
|
|
|
2024-09-30 00:19:46 -07:00
|
|
|
- uses: actions/upload-artifact@v4
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: Coverage results for ${{ matrix.testMode }}
|
2024-09-30 02:05:26 -07:00
|
|
|
path: ${{ steps.tests.outputs.coveragePath }}
|
|
|
|
|
|
|
|
- name: Deploy Coverage Report
|
|
|
|
if: always()
|
|
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ${{ steps.tests.outputs.coveragePath }}
|
|
|
|
destination_dir: coverage/${{ matrix.testMode }}
|
|
|
|
allow_empty_commit: true
|
|
|
|
keep_files: true
|
|
|
|
force_orphan: false
|