Ignore flaky tests on player #269
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
| # Copyright (c) 2021-2026 Koji Hasegawa. | |
| # This software is released under the MIT License. | |
| name: Test | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '**.md' | |
| - '.github/**' | |
| - '!.github/workflows/test.yml' | |
| pull_request: | |
| types: [ opened, synchronize, reopened ] # Same as default | |
| paths-ignore: | |
| - '**.md' | |
| - '.github/**' | |
| - '!.github/workflows/test.yml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: { } | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| test: | |
| if: github.event.pull_request.head.repo.fork == false # Skip on public fork, because can not read secrets. | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| unityVersion: # Available versions see: https://game.ci/docs/docker/versions | |
| - 6000.0.43f1 # Latest version that does not pin the test framework package. | |
| - 6000.0.44f1 # pin test-framework v1.5.1 | |
| - 6000.0.59f2 # pin test-framework v1.6.0 | |
| - 6000.3.12f1 | |
| - &latest_unity_version 6000.4.1f1 | |
| testMode: | |
| - All # run tests in editor | |
| include: | |
| - unityVersion: *latest_unity_version | |
| octocov: true | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | |
| with: | |
| submodules: false | |
| lfs: false | |
| - name: Restore cache | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 | |
| with: | |
| path: Library | |
| key: Library-${{ runner.os }}-${{ matrix.unityVersion }}-${{ hashFiles('Packages/packages-lock.json') }} | |
| restore-keys: | | |
| Library-${{ runner.os }}-${{ matrix.unityVersion }}- | |
| Library-${{ runner.os }}- | |
| Library- | |
| - name: Set coverage assembly filters | |
| run: | | |
| assemblies=$(find ./Packages -name "*.asmdef" | sed -e s/.*\\//\+/ | sed -e s/\\.asmdef// | sed -e s/^.*\\.Tests//) | |
| assemblies+=("+LocalPackageSample*") | |
| # shellcheck disable=SC2001,SC2048,SC2086 | |
| echo "assembly_filters=+<assets>,$(echo ${assemblies[*]} | sed -e s/\ /,/g),-*.Tests" >> "$GITHUB_ENV" | |
| - name: Set license secret key | |
| run: echo "secret_key=UNITY_LICENSE_$(echo ${{ matrix.unityVersion }} | cut -c 1-4)" >> "$GITHUB_ENV" | |
| - name: Run tests | |
| uses: game-ci/unity-test-runner@0ff419b913a3630032cbe0de48a0099b5a9f0ed9 # v4 | |
| with: | |
| githubToken: ${{ secrets.GITHUB_TOKEN }} | |
| unityVersion: ${{ matrix.unityVersion }} # Default is `auto` | |
| checkName: test result (${{ matrix.unityVersion }}, ${{ matrix.testMode }}) | |
| customParameters: -testCategory "!IgnoreCI;!Integration" -testHelperScreenshotDirectory /github/workspace/artifacts/Screenshots | |
| # Note: `/github/workspace/artifacts` is the artifacts path inside the game-ci container | |
| coverageOptions: generateAdditionalMetrics;generateTestReferences;generateHtmlReport;generateAdditionalReports;dontClear;assemblyFilters:${{ env.assembly_filters }} | |
| # see: https://docs.unity3d.com/Packages/com.unity.testtools.codecoverage@1.2/manual/CoverageBatchmode.html | |
| testMode: ${{ matrix.testMode }} | |
| env: | |
| UNITY_LICENSE: ${{ secrets[env.secret_key] }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| id: test | |
| - name: Set coverage path for octocov | |
| run: sed -i -r 's/\.\/Logs/${{ steps.test.outputs.coveragePath }}/' .octocov.yml | |
| if: ${{ matrix.octocov }} | |
| - name: Run octocov | |
| uses: k1LoW/octocov-action@73d561f65d59e66899ed5c87e4621a913b5d5c20 # v1 | |
| if: ${{ matrix.octocov }} | |
| - name: Upload test results | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: TestResults-Unity${{ matrix.unityVersion }}-${{ matrix.testMode }} | |
| path: | | |
| ${{ steps.test.outputs.artifactsPath }} | |
| ${{ steps.test.outputs.coveragePath }} | |
| if: always() |