Skip to content

Upgrade to Unity 6 #239

Upgrade to Unity 6

Upgrade to Unity 6 #239

Workflow file for this run

# Copyright (c) 2021-2023 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: 15
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
- 6000.0.44f1 # pin test-framework v1.5.1
- 6000.0.59f2
- 6000.1.17f1
- 6000.2.5f1
- 6000.2.6f1 # pin test-framework v1.6.0
- 6000.2.7f2
testMode:
- All # run tests in editor
include:
- unityVersion: 6000.2.7f2
octocov: true
- unityVersion: 6000.2.7f2
testMode: Standalone # run tests on player
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
submodules: false
lfs: false
- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4
with:
path: Library
key: Library-linux-${{ matrix.unityVersion }}-${{ github.ref }}
restore-keys: |
Library-linux-${{ matrix.unityVersion }}
Library-linux
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"
coverageOptions: generateAdditionalMetrics;generateTestReferences;generateHtmlReport;generateAdditionalReports;dontClear;assemblyFilters:${{ env.assembly_filters }}
# see: https://docs.unity3d.com/Packages/[email protected]/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@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: TestResults-Unity${{ matrix.unityVersion }}-${{ matrix.testMode }}
path: |
${{ steps.test.outputs.artifactsPath }}
${{ steps.test.outputs.coveragePath }}
if: always()
notify:
needs: 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: 5
permissions:
actions: read
steps:
- uses: Gamesight/slack-workflow-status@68bf00d0dbdbcb206c278399aa1ef6c14f74347a # v1.3.0
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}