Merge branch 'pipeline-detection-support' of https://github.com/Passi… #63
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
| name: CI pipeline | |
| on: | |
| workflow_dispatch: # Allow running the workflow manually from the GitHub UI | |
| push: | |
| branches: | |
| - "*" | |
| pull_request: | |
| branches: | |
| - "*" | |
| jobs: | |
| # Modern path: GameCI packageMode handles project setup internally. | |
| # Requires the Unity Test Framework UPM package, which exists from 2019.2+, | |
| # so 2018.4 is handled by the separate legacy job below. Unity 6000.5.0f1 is | |
| # also handled separately (see the test-6000_5 job): packageMode hardcodes an | |
| # old codecoverage package that no longer compiles on that editor. | |
| test: | |
| name: Test (Unity ${{ matrix.unity-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false # one Unity version failing must not cancel the others | |
| matrix: | |
| unity-version: [ | |
| "6000.4.5f1", | |
| "6000.3.11f1", | |
| "6000.2.15f1", | |
| "6000.1.9f1", | |
| "6000.0.53f1", | |
| "2022.1.24f1", | |
| "2020.3.48f1", | |
| "2019.4.40f1" | |
| ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| # packageMode requires the package being tested to live in a subdirectory, | |
| # NOT at the repository root. Our repo root *is* the package, so copy it | |
| # into a subfolder. We copy (rather than move) to leave .git intact. | |
| - name: Stage package into subdirectory | |
| run: | | |
| mkdir -p ci-package | |
| rsync -a --exclude 'ci-package' --exclude '.git' ./ ci-package/ | |
| - name: Cache Unity Library | |
| uses: actions/cache@v4 | |
| with: | |
| path: ci-package/Library | |
| key: Library-${{ matrix.unity-version }}-${{ hashFiles('ci-package/**/*.cs', 'ci-package/package.json') }} | |
| restore-keys: | | |
| Library-${{ matrix.unity-version }}- | |
| - name: Run EditMode tests | |
| id: tests | |
| uses: game-ci/unity-test-runner@v4 | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| with: | |
| packageMode: true | |
| projectPath: ci-package | |
| unityVersion: ${{ matrix.unity-version }} | |
| testMode: EditMode | |
| # Integration tests (e.g. the AssetRipper tpk download) hit the network | |
| # and are run locally in the Unity Test Runner, not in CI. | |
| customParameters: -testCategory "!Integration" | |
| githubToken: ${{ secrets.GITHUB_TOKEN }} | |
| artifactsPath: artifacts-${{ matrix.unity-version }} | |
| checkName: Unity ${{ matrix.unity-version }} Test Results | |
| - name: Report test results | |
| uses: dorny/test-reporter@v2 | |
| if: always() | |
| with: | |
| name: Unity ${{ matrix.unity-version }} | |
| path: artifacts-${{ matrix.unity-version }}/*.xml | |
| reporter: dotnet-nunit | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: Unity ${{ matrix.unity-version }} | |
| path: artifacts-${{ matrix.unity-version }} | |
| retention-days: 5 | |
| # Legacy path: Unity 2018.4 predates the Unity Test Framework UPM package, so | |
| # packageMode cannot resolve a test runner for it. Instead build a real host | |
| # project from the GameCI legacy template and import ThunderKit as a package. | |
| test-legacy-2018: | |
| name: Test (Unity 2018.4.36f1) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Setup Unity test project from legacy template | |
| run: | | |
| # ThunderKit is a package; build a host project to import it into. | |
| # Clone the GameCI test project template and move ThunderKit package | |
| # into the test project's Packages folder. | |
| git clone --depth=1 https://github.com/game-ci/unity-actions.git temp-unity-actions | |
| cp -r temp-unity-actions/test-projects/2018.3-legacy-render-pipeline/. UnityTestProject/ | |
| rm -rf temp-unity-actions | |
| # Remove the sample tests from the GameCI template | |
| rm -rf UnityTestProject/Assets/Tests* | |
| # Copy ThunderKit package into the test project's Packages folder | |
| mkdir -p UnityTestProject/Packages/com.passivepicasso.thunderkit | |
| rsync -a --exclude 'UnityTestProject' ./ UnityTestProject/Packages/com.passivepicasso.thunderkit/ | |
| - name: Cache Unity Library | |
| uses: actions/cache@v4 | |
| with: | |
| path: UnityTestProject/Library | |
| key: Library-2018.4.36f1-${{ hashFiles('UnityTestProject/Packages/**/*.cs', 'UnityTestProject/Packages/**/package.json') }} | |
| restore-keys: | | |
| Library-2018.4.36f1- | |
| - name: Run EditMode tests | |
| uses: game-ci/unity-test-runner@v4 | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| with: | |
| testMode: EditMode | |
| unityVersion: 2018.4.36f1 | |
| projectPath: UnityTestProject | |
| # Integration tests (e.g. the AssetRipper tpk download) hit the network | |
| # and are run locally in the Unity Test Runner, not in CI. | |
| customParameters: -testCategory "!Integration" | |
| githubToken: ${{ secrets.GITHUB_TOKEN }} | |
| artifactsPath: artifacts-2018.4.36f1 | |
| checkName: Unity 2018.4.36f1 Test Results | |
| - name: Report test results | |
| uses: dorny/test-reporter@v2 | |
| if: always() | |
| with: | |
| name: Unity 2018.4.36f1 | |
| path: artifacts-2018.4.36f1/*.xml | |
| reporter: dotnet-nunit | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: Unity 2018.4.36f1 | |
| path: artifacts-2018.4.36f1 | |
| retention-days: 5 | |
| # Unity 6000.5.0f1 special case: GameCI packageMode hardcodes injecting | |
| # com.unity.testtools.codecoverage@1.1.1, whose CoverageWindow uses the | |
| # non-generic TreeView/TreeViewItem API that 6000.5.0f1 promoted to an | |
| # error-level obsolete (CS0619), so the coverage assembly fails to compile and | |
| # no tests run. packageMode exposes no way to override that version, so this job | |
| # builds a project we control (like the legacy job) and pins codecoverage 1.3.0, | |
| # which switches to TreeView<int> on 6000.3+. Outside packageMode, GameCI uses | |
| # this manifest as-is instead of injecting its own codecoverage. | |
| test-6000_5: | |
| name: Test (Unity 6000.5.0f1) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| lfs: true | |
| - name: Setup Unity test project with pinned code coverage | |
| run: | | |
| # Minimal Unity project that embeds ThunderKit as a package and pins | |
| # codecoverage to a 6000.5-compatible version. codecoverage 1.3.0 pulls | |
| # com.unity.test-framework + com.unity.settings-manager transitively, and | |
| # ThunderKit's package.json pulls com.unity.scriptablebuildpipeline. | |
| mkdir -p UnityTestProject/Assets | |
| mkdir -p UnityTestProject/ProjectSettings | |
| mkdir -p UnityTestProject/Packages/com.passivepicasso.thunderkit | |
| rsync -a --exclude 'UnityTestProject' --exclude '.git' ./ UnityTestProject/Packages/com.passivepicasso.thunderkit/ | |
| printf 'm_EditorVersion: 6000.5.0f1\n' > UnityTestProject/ProjectSettings/ProjectVersion.txt | |
| cat > UnityTestProject/Packages/manifest.json <<'EOF' | |
| { | |
| "dependencies": { | |
| "com.unity.testtools.codecoverage": "1.3.0" | |
| }, | |
| "testables": [ | |
| "com.passivepicasso.thunderkit" | |
| ] | |
| } | |
| EOF | |
| - name: Cache Unity Library | |
| uses: actions/cache@v4 | |
| with: | |
| path: UnityTestProject/Library | |
| key: Library-6000.5.0f1-${{ hashFiles('UnityTestProject/Packages/**/*.cs', 'UnityTestProject/Packages/**/package.json') }} | |
| restore-keys: | | |
| Library-6000.5.0f1- | |
| - name: Run EditMode tests | |
| uses: game-ci/unity-test-runner@v4 | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| with: | |
| testMode: EditMode | |
| unityVersion: 6000.5.0f1 | |
| projectPath: UnityTestProject | |
| # Integration tests (e.g. the AssetRipper tpk download) hit the network | |
| # and are run locally in the Unity Test Runner, not in CI. | |
| customParameters: -testCategory "!Integration" | |
| githubToken: ${{ secrets.GITHUB_TOKEN }} | |
| artifactsPath: artifacts-6000.5.0f1 | |
| checkName: Unity 6000.5.0f1 Test Results | |
| - name: Report test results | |
| uses: dorny/test-reporter@v2 | |
| if: always() | |
| with: | |
| name: Unity 6000.5.0f1 | |
| path: artifacts-6000.5.0f1/*.xml | |
| reporter: dotnet-nunit | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: Unity 6000.5.0f1 | |
| path: artifacts-6000.5.0f1 | |
| retention-days: 5 |