Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- added additional validation steps
- updated how output directory is set
  • Loading branch information
StephenHodgson authored Jul 23, 2024
1 parent 5796055 commit e808d68
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/valdate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
build-target: StandaloneLinux64
- os: windows-latest
build-target: StandaloneWindows64
- os: macos-13
build-target: StandaloneOSX
- os: macos-latest
build-target: StandaloneOSX

Expand All @@ -39,6 +41,7 @@ jobs:
with:
repository: RageAgainstThePixel/com.utilities.buildpipeine
path: test-project
ref: development

# Installs the Unity Editor based on your project version text file
# sets -> env.UNITY_EDITOR_PATH
Expand All @@ -53,13 +56,10 @@ jobs:
# https://github.com/XRTK/activate-unity-license
- uses: xrtk/activate-unity-license@v5
with:
# Required
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
# Optional
license-type: 'Personal' # Chooses license type to use [ Personal, Professional ]
auth-key: ${{ secrets.UNITY_2FA_KEY }} # Required for personal activations
# serial: ${{ secrets.UNITY_SERIAL }} # Required for pro/plus activations
# serial: ${{ secrets.UNITY_SERIAL }} # Required for pro activations

- name: Unity Build (${{ matrix.build-target }})
uses: ./ #RageAgainstThePixel/unity-build
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 Stephen Hodgson
Copyright (c) 2024 Stephen Hodgson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ This action has the following input parameters:
- **`publish-artifacts:`** *Optional*. Should the workflow publish artifacts? Default is `true`.
- **`test:`** *Optional*. Run editor tests. Default is `true`.
- **`additional-test-args:`** *Optional* Additional [command line arguments](https://docs.unity3d.com/Manual/EditorCommandLineArguments.html) to pass to test command. Default is ''.
- **`additional-validation-args:`** *Optional* Additional command line arguments to pass during project validation phase.
52 changes: 33 additions & 19 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ 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
# StandaloneWindows64, WSAPlayer, StandaloneOSX, iOS, StandaloneLinux64, Android, Lumin, WebGL, VisionOS
default: ''
test:
description: 'Run editor tests'
required: false
default: 'true'
additional-validation-args:
description: 'Additional args to pass to validation command'
required: false
default: ''
additional-test-args:
description: 'Additional args to pass to test command'
required: false
Expand All @@ -34,24 +38,37 @@ inputs:
runs:
using: "composite"
steps:
- uses: xrtk/unity-action@v6
name: Project Validation
with:
log-name: 'project-validation'
args: '-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject'

- name: Set output directory
id: set-output-directory
- name: Unity Build Pipeline Utility
run: |
# Unity Build Pipeline Utility
Write-Host "::debug::Build Target: ${{ inputs.build-target }}"
Write-Host "::debug::Run Editor Tests: ${{ inputs.test }}"
Write-Host "::debug::Additional Validation Args: ${{ inputs.additional-validation-args }}"
Write-Host "::debug::Additional Test Args: ${{ inputs.additional-test-args }}"
Write-Host "::debug::Additional Build Args: ${{ inputs.additional-build-args }}"
Write-Host "::debug::Publish Artifacts: ${{ inputs.publish-artifacts }}"
$outputDirectoryArgs = ''
$outputDirectory = '${{ env.UNITY_PROJECT_PATH }}/Builds'
if ("${{ inputs.output-directory }}" -ne "") {
echo "OUTPUT_DIRECTORY_ARGS= -buildOutputDirectory ${{ inputs.output-directory }}" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "OUTPUT_DIRECTORY=${{ inputs.output-directory }}" | Out-File -FilePath $env:GITHUB_ENV -Append
} else {
echo "OUTPUT_DIRECTORY_ARGS=" | Out-File -FilePath $env:GITHUB_ENV -Append
echo "OUTPUT_DIRECTORY=${{ env.UNITY_PROJECT_PATH }}/Builds" | Out-File -FilePath $env:GITHUB_ENV -Append
$outputDirectoryArgs = ' -buildOutputDirectory ${{ inputs.output-directory }}'
$outputDirectory = '${{ inputs.output-directory }}'
}
Write-Host "::debug::OutputDirectory: $outputDirectory"
Write-Host "::debug::OutputDirectoryArgs: $outputDirectoryArgs"
"OUTPUT_DIRECTORY=$outputDirectory" >> $env:GITHUB_ENV
"OUTPUT_DIRECTORY_ARGS=$outputDirectoryArgs" >> $env:GITHUB_ENV
shell: pwsh

- uses: xrtk/unity-action@v6
name: Project Validation
with:
log-name: 'project-validation'
args: '-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject ${{ inputs.additional-validation-args }}'

- uses: xrtk/unity-action@v6
if: ${{ inputs.test == 'true' }}
name: '${{ inputs.build-target }}-Tests'
Expand All @@ -68,9 +85,7 @@ runs:
args: >-
-quit -nographics -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild ${{ inputs.additional-build-args }}${{ env.OUTPUT_DIRECTORY_ARGS }}
- name: Ensure Unity process is dead
if: always()
run: |
- run: |
$processIdFile = Join-Path $env:GITHUB_WORKSPACE "unity-process-id.txt"
if (Test-Path $processIdFile) {
Expand All @@ -83,6 +98,7 @@ runs:
}
}
shell: pwsh
if: always()
- uses: actions/upload-artifact@v4
name: Upload Artifacts
Expand All @@ -95,8 +111,6 @@ runs:
path: |
${{ env.UNITY_PROJECT_PATH }}/Logs/*.log
${{ env.OUTPUT_DIRECTORY }}/**/*
!${{ env.OUTPUT_DIRECTORY }}/**/*_BackUpThisFolder_ButDontShipItWithYourGame/**
!${{ env.OUTPUT_DIRECTORY }}/**/*_BurstDebugInformation_DoNotShip/**/*
- name: Clean Artifacts
if: ${{ always() && inputs.publish-artifacts == 'true' }}
Expand Down

0 comments on commit e808d68

Please sign in to comment.