🚑 ci: export unity license secret #4
This file contains hidden or 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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: Unity EditMode Suite | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| checks: write | |
| statuses: write | |
| concurrency: | |
| group: unity-editmode-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| UNITY_VERSION: 6000.0.0f1 | |
| PROJECT_PATH: . | |
| TEST_PLATFORM: EditMode | |
| jobs: | |
| editmode: | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| name: EditMode Regression | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 40 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| fetch-depth: 0 | |
| - name: Guard license secret | |
| if: ${{ env.TEST_PLATFORM == 'EditMode' }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${UNITY_LICENSE:-}" ]; then | |
| echo "::error::UNITY_LICENSE secret is required for EditMode automation." >&2 | |
| exit 1 | |
| fi | |
| - name: Cache Library | |
| uses: actions/cache@v4 | |
| with: | |
| path: Library | |
| key: ${{ runner.os }}-unity-${{ env.UNITY_VERSION }}-${{ hashFiles('Packages/packages-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-unity-${{ env.UNITY_VERSION }}- | |
| - name: Run EditMode Tests | |
| uses: game-ci/unity-test-runner@v4 | |
| with: | |
| githubToken: ${{ secrets.GITHUB_TOKEN }} | |
| projectPath: ${{ env.PROJECT_PATH }} | |
| unityVersion: ${{ env.UNITY_VERSION }} | |
| testMode: ${{ env.TEST_PLATFORM }} | |
| artifactsPath: Artifacts | |
| coverageOptions: generateAdditionalMetrics;generateHtmlReport;generateBadgeReport | |
| - name: Publish Artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: editmode-suite | |
| path: Artifacts | |
| - name: Surface Coverage Summary | |
| if: always() | |
| shell: pwsh | |
| run: | | |
| $summaryPath = Join-Path Artifacts "coverage/Report/Summary.xml" | |
| if (Test-Path $summaryPath) { | |
| [xml]$summary = Get-Content $summaryPath | |
| $attributes = $summary.Summary.Attributes | |
| $coverageAttr = $attributes.GetNamedItem('lineCoverage') | |
| if (-not $coverageAttr) { | |
| $coverageAttr = $attributes.GetNamedItem('linecoverage') | |
| } | |
| if ($coverageAttr) { | |
| $coverage = [math]::Round([double]$coverageAttr.Value, 2) | |
| Write-Host "::notice::Line coverage: $coverage%" | |
| } else { | |
| Write-Warning 'Coverage summary present but lineCoverage attribute missing.' | |
| } | |
| } else { | |
| Write-Warning 'Coverage summary not generated.' | |
| } |