Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
50 changes: 50 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# XRTK Unity Build

A GitHub Action that builds XRTK based projects.

Part of the [Mixed Reality Toolkit (XRTK)](https://github.com/XRTK) open source project.

> This action requires that your Unity project be setup and using the com.xrtk.core package.

## How to use

```yaml
on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
build-target: StandaloneWindows64
- os: macos-latest
build-target: StandaloneOSX
- os: linux-latest
build-target: StandaloneLinux64

steps:
- uses: actions/checkout@v2
with:
submodules: recursive
clean: true

- name: Unity Build (${{ matrix.build-target }})
uses: xrtk/unity-build@main
with:
build-target: ${{ matrix.build-target }}
```
63 changes: 63 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 'Unity Build (XRTK)'
description: 'Runs a Build using the specified build targets'
branding:
icon: ''
color: ''

inputs:
build-target:
description: 'The build target to build for.'
# Unity -buildTarget command line args https://docs.unity3d.com/Manual/CommandLineArguments.html
# StandaloneWindows64, WSAPlayer, StandaloneOSX, iOS, StandaloneLinux64, Android, Lumin, WebGL
defaults: ''

runs:
using: "composite"
steps:
- id: unity-validate
name: Unity Editor Validation
uses: xrtk/unity-validate@main

- uses: xrtk/unity-action@main
name: Project Validation
with:
name: 'project-validation'
editor-path: '${{ steps.unity-validate.outputs.editor-path }}'
project-path: '${{ steps.unity-validate.outputs.project-path }}'
args: '-quit -batchmode -executeMethod XRTK.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject'

- uses: xrtk/unity-action@main
name: '${{ inputs.build-target }}-Tests'
with:
name: '${{ inputs.build-target }}-Tests'
editor-path: '${{ steps.unity-validate.outputs.editor-path }}'
project-path: '${{ steps.unity-validate.outputs.project-path }}'
build-target: '${{ inputs.build-target }}'
args: '-batchmode -runEditorTests'

- uses: xrtk/unity-action@main
name: '${{ inputs.build-target }}-Build'
with:
name: '${{ inputs.build-target }}-Build'
editor-path: '${{ steps.unity-validate.outputs.editor-path }}'
project-path: '${{ steps.unity-validate.outputs.project-path }}'
build-target: '${{ inputs.build-target }}'
args: '-quit -batchmode -executeMethod XRTK.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild'

- name: Zip Artifacts
if: always()
run: |
$artifacts = "${{ steps.unity-validate.outputs.project-path }}/Builds"

if (Test-Path -Path $artifacts) {
Compress-Archive -Path "$artifacts/*" -DestinationPath ${{ github.workspace }}/${{ runner.os }}-${{ inputs.build-target }}-Artifacts.zip -Force
Remove-Item $artifacts -Force -Recurse
}
shell: pwsh

- uses: actions/upload-artifact@v2
name: Upload Artifacts
if: always()
with:
name: '${{ runner.os }}-${{ inputs.build-target }}-Artifacts'
path: '${{ github.workspace }}/${{ runner.os }}-${{ inputs.build-target }}-Artifacts.zip'