Skip to content

Commit f019e9d

Browse files
@xrtk/unity-build@v4 (#5)
1 parent 0640490 commit f019e9d

File tree

3 files changed

+134
-36
lines changed

3 files changed

+134
-36
lines changed

.github/workflows/validate.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: unity-build-validation
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
pull_request:
8+
branches:
9+
- '*'
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
concurrency:
15+
group: ${{ github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
build:
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
max-parallel: 2 # Use this if you're activating pro license with matrix
23+
matrix:
24+
include:
25+
- os: ubuntu-latest
26+
build-target: Android
27+
- os: windows-latest
28+
build-target: StandaloneWindows64
29+
- os: macos-latest
30+
build-target: Android
31+
32+
steps:
33+
- name: checkout self
34+
uses: actions/checkout@v3
35+
36+
- name: checkout test project
37+
uses: actions/checkout@v3
38+
with:
39+
repository: xrtk/com.xrtk.test
40+
path: test-project
41+
42+
# Installs the Unity Editor based on your project version text file
43+
# sets -> env.UNITY_EDITOR_PATH
44+
# sets -> env.UNITY_PROJECT_PATH
45+
# https://github.com/XRTK/unity-setup
46+
- uses: xrtk/unity-setup@v6
47+
with:
48+
build-targets: ${{ matrix.build-target }}
49+
version-file-path: 'test-project/**/ProjectSettings/ProjectVersion.txt'
50+
51+
# Activates the installation with the provided credentials
52+
# https://github.com/XRTK/activate-unity-license
53+
- uses: xrtk/activate-unity-license@v2
54+
with:
55+
username: ${{ secrets.UNITY_USERNAME }}
56+
password: ${{ secrets.UNITY_PASSWORD }}
57+
serial: ${{ secrets.UNITY_SERIAL }} # Required for pro/plus activations
58+
license-type: 'Professional' # Chooses license type to use [ Personal, Professional ]
59+
60+
- name: Unity Build (${{ matrix.build-target }})
61+
uses: ./ #xrtk/unity-build
62+
with:
63+
build-target: ${{ matrix.build-target }}
64+
65+
- name: Unity Build No Tests (${{ matrix.build-target }})
66+
uses: ./ #xrtk/unity-build
67+
with:
68+
build-target: ${{ matrix.build-target }}
69+
test: false
70+
71+
- name: Unity Build No Artifacts (${{ matrix.build-target }})
72+
uses: ./ #xrtk/unity-build
73+
with:
74+
build-target: ${{ matrix.build-target }}
75+
publish-artifacts: false

README.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ jobs:
2828
build:
2929
runs-on: ${{ matrix.os }}
3030
strategy:
31+
#max-parallel: 2 # Use this if you're activating pro license with matrix
3132
matrix:
3233
include:
3334
- os: windows-latest
@@ -38,10 +39,29 @@ jobs:
3839
build-target: StandaloneLinux64
3940

4041
steps:
41-
# be sure to first checkout your repo
42+
- uses: actions/checkout@v3
43+
44+
# Installs the Unity Editor based on your project version text file
45+
# sets -> env.UNITY_EDITOR_PATH
46+
# sets -> env.UNITY_PROJECT_PATH
47+
# https://github.com/XRTK/unity-setup
48+
- uses: xrtk/unity-setup@v6
49+
with:
50+
build-targets: ${{ matrix.build-target }}
51+
52+
# Activates the installation with the provided credentials
53+
# https://github.com/XRTK/activate-unity-license
54+
- uses: xrtk/activate-unity-license@v2
55+
with:
56+
# Required
57+
username: ${{ secrets.UNITY_USERNAME }}
58+
password: ${{ secrets.UNITY_PASSWORD }}
59+
# Optional
60+
serial: ${{ secrets.UNITY_SERIAL }} # Required for pro/plus activations
61+
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
4262

4363
- name: Unity Build (${{ matrix.build-target }})
44-
uses: xrtk/unity-build@v3
64+
uses: xrtk/unity-build@v5
4565
with:
4666
build-target: ${{ matrix.build-target }}
4767
```

action.yaml

+37-34
Original file line numberDiff line numberDiff line change
@@ -10,64 +10,67 @@ inputs:
1010
# Unity -buildTarget command line args https://docs.unity3d.com/Manual/CommandLineArguments.html
1111
# StandaloneWindows64, WSAPlayer, StandaloneOSX, iOS, StandaloneLinux64, Android, Lumin, WebGL
1212
default: ''
13-
additional-validate-args:
14-
description: 'Additional args to pass to validate command'
15-
default: ''
13+
test:
14+
description: 'Run editor tests'
15+
required: false
16+
default: 'true'
1617
additional-test-args:
1718
description: 'Additional args to pass to test command'
19+
required: false
1820
default: ''
1921
additional-build-args:
2022
description: 'Additional args to pass to build command'
23+
required: false
2124
default: ''
25+
publish-artifacts:
26+
description: 'Should the workflow publish artifacts?'
27+
required: false
28+
default: 'true'
2229

2330
runs:
2431
using: "composite"
2532
steps:
26-
- id: unity-validate
27-
name: Unity Editor Validation
28-
uses: xrtk/unity-validate@v2
29-
30-
- uses: xrtk/unity-action@v3
33+
- uses: xrtk/unity-action@v5
3134
name: Project Validation
3235
with:
33-
name: 'project-validation'
34-
editor-path: '${{ env.editor-path }}'
35-
project-path: '${{ env.project-path }}'
36-
args: '-quit -batchmode -executeMethod XRTK.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject ${{ inputs.additional-validate-args }}'
36+
log-name: 'project-validation'
37+
args: '-quit -nographics -batchmode -executeMethod XRTK.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject'
3738

38-
- uses: xrtk/unity-action@v3
39+
- uses: xrtk/unity-action@v5
40+
if: ${{ inputs.test == 'true' }}
3941
name: '${{ inputs.build-target }}-Tests'
4042
with:
41-
name: '${{ inputs.build-target }}-Tests'
42-
editor-path: '${{ env.editor-path }}'
43-
project-path: '${{ env.project-path }}'
43+
log-name: '${{ inputs.build-target }}-Tests'
4444
build-target: '${{ inputs.build-target }}'
45-
args: '-batchmode -runEditorTests ${{ inputs.additional-test-args }}'
45+
args: '-nographics -batchmode -runEditorTests ${{ inputs.additional-test-args }}'
4646

47-
- uses: xrtk/unity-action@v3
47+
- uses: xrtk/unity-action@v5
4848
name: '${{ inputs.build-target }}-Build'
4949
with:
50-
name: '${{ inputs.build-target }}-Build'
51-
editor-path: '${{ env.editor-path }}'
52-
project-path: '${{ env.project-path }}'
50+
log-name: '${{ inputs.build-target }}-Build'
5351
build-target: '${{ inputs.build-target }}'
54-
args: '-quit -batchmode -executeMethod XRTK.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild ${{ inputs.additional-build-args }}'
52+
args: '-quit -nographics -batchmode -executeMethod XRTK.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild ${{ inputs.additional-build-args }}'
53+
54+
- uses: josStorer/[email protected]
55+
if: ${{ always() && inputs.publish-artifacts == 'true' }}
56+
id: current-time
57+
with:
58+
format: YYYY-MM-DDTHH-mm-ss-sss
59+
60+
- uses: actions/upload-artifact@v3
61+
name: Upload Artifacts
62+
if: ${{ always() && inputs.publish-artifacts == 'true' }}
63+
with:
64+
name: '${{ runner.os }}-${{ inputs.build-target }}-Artifacts-${{ steps.current-time.outputs.formattedTime }}'
65+
path: '${{ env.UNITY_PROJECT_PATH }}/Builds'
5566

56-
- name: Zip Artifacts
57-
if: always()
67+
- name: Clean Artifacts
68+
if: ${{ always() && inputs.publish-artifacts == 'true' }}
5869
run: |
59-
# Zip Artifacts
60-
$artifacts = "${{ env.project-path }}/Builds"
70+
# Clean Artifacts
71+
$artifacts = "${{ env.UNITY_PROJECT_PATH }}/Builds"
6172
6273
if (Test-Path -Path $artifacts) {
63-
Compress-Archive -Path "$artifacts/*" -DestinationPath ${{ github.workspace }}/${{ runner.os }}-${{ inputs.build-target }}-Artifacts.zip -Force
6474
Remove-Item $artifacts -Force -Recurse
6575
}
6676
shell: pwsh
67-
68-
- uses: actions/upload-artifact@v3
69-
name: Upload Artifacts
70-
if: always()
71-
with:
72-
name: '${{ runner.os }}-${{ inputs.build-target }}-Artifacts'
73-
path: '${{ github.workspace }}/${{ runner.os }}-${{ inputs.build-target }}-Artifacts.zip'

0 commit comments

Comments
 (0)