-
-
Notifications
You must be signed in to change notification settings - Fork 28
98 lines (89 loc) · 4.26 KB
/
Copy pathtest_unity_plugin.yml
File metadata and controls
98 lines (89 loc) · 4.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: test-unity-plugin
##############################################################################
# 1. Triggers
##############################################################################
on:
workflow_call:
inputs:
projectPath: { required: true, type: string }
unityVersion: { required: true, type: string }
testMode: { required: true, type: string }
secrets:
UNITY_LICENSE: { required: true }
UNITY_EMAIL: { required: true }
UNITY_PASSWORD: { required: true }
##############################################################################
# 2. Jobs – runs only after a maintainer applies the `ci-ok` label
#
# Both the Linux ("base") and Windows ("windows-mono") build targets run on
# ubuntu-latest using the matching unityci editor image. The previous
# windows-latest matrix was dropped: Unity activation inside the Windows
# container fails with exit -1073741515 (STATUS_DLL_NOT_FOUND) before any test
# runs. "windows-mono" preserves Windows-target coverage without that broken
# environment (same approach as the Animation extension).
##############################################################################
jobs:
test:
if: |
github.event_name != 'pull_request_target' ||
contains(github.event.pull_request.labels.*.name,'ci-ok')
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
platform: [base, windows-mono]
name: ${{ inputs.unityVersion }} ${{ inputs.testMode }} on ${{ matrix.platform }}
runs-on: ${{ matrix.os }}
steps:
# --------------------------------------------------------------------- #
# (PR only) abort if the contributor also changed workflow files
# --------------------------------------------------------------------- #
- name: Abort if workflow files modified
if: ${{ github.event_name == 'pull_request_target' }}
run: |
git fetch --depth=1 origin "${{ github.base_ref }}"
if git diff --name-only HEAD origin/${{ github.base_ref }} | grep -q '^\.github/workflows/'; then
echo "::error::This PR edits workflow files – refusing to run with secrets"; exit 1;
fi
# --------------------------------------------------------------------- #
# Checkout the contributor's commit safely
# --------------------------------------------------------------------- #
- uses: actions/checkout@v4
with:
lfs: false
# --------------------------------------------------------------------- #
# Cache & run the Unity test-runner
# --------------------------------------------------------------------- #
- uses: actions/cache@v4
with:
path: |
${{ inputs.projectPath }}/Library
~/.cache/unity3d
key: Library-${{ inputs.unityVersion }}-${{ inputs.testMode }}-${{ matrix.platform }}
# --------------------------------------------------------------------- #
- name: Generate custom image name
id: custom_image
run: |
echo "image=unityci/editor:ubuntu-${{ inputs.unityVersion }}-${{ matrix.platform }}-3" >> $GITHUB_OUTPUT
shell: bash
- 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: ${{ inputs.projectPath }}
unityVersion: ${{ inputs.unityVersion }}
testMode: ${{ inputs.testMode }}
customImage: ${{ steps.custom_image.outputs.image }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
checkName: ${{ inputs.unityVersion }} ${{ inputs.testMode }} ${{ matrix.platform }} Test Results
artifactsPath: artifacts-${{ inputs.unityVersion }}-${{ inputs.testMode }}-${{ matrix.platform }}
customParameters: -CI true -GITHUB_ACTIONS true
# --------------------------------------------------------------------- #
- uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: Test results for ${{ inputs.unityVersion }} ${{ inputs.testMode }} on ${{ matrix.platform }}
path: ${{ steps.tests.outputs.artifactsPath }}