Skip to content

Unity Build & Test

Unity Build & Test #17

Workflow file for this run

name: Unity Build & Test
on:
schedule:
- cron: '0 0 * * 0' # Every Sunday at midnight
push:
branches:
- 'main'
pull_request:
branches:
- '*'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# only cancel the current run for open pull requests
cancel-in-progress: ${{ ( github.event_name == 'pull_request' || github.event.action == 'synchronize' ) }}
jobs:
build:
env:
UNITY_PROJECT_PATH: ''
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
unity-versions: [2020.x, 2021.x, 2022.x, 6000.x]
include: # for each os specify the build targets
- os: ubuntu-latest
build-target: StandaloneLinux64
- os: windows-latest
build-target: StandaloneWindows64
- os: macos-13
build-target: StandaloneOSX
steps:
- uses: actions/checkout@v4
- uses: RageAgainstThePixel/unity-setup@v1
with:
build-targets: ${{ matrix.build-target }}
- uses: RageAgainstThePixel/activate-unity-license@v1
with:
license: 'Personal'
username: ${{ secrets.UNITY_USERNAME }}
password: ${{ secrets.UNITY_PASSWORD }}
# serial: ${{ secrets.UNITY_SERIAL }} # required for Professional license activations
- uses: RageAgainstThePixel/unity-action@v1
name: Project Validation
with:
log-name: 'project-validation'
args: '-quit -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.ValidateProject'
- uses: RageAgainstThePixel/unity-action@v1
name: '${{ matrix.build-target }}-Test'
with:
log-name: '${{ matrix.build-target }}-Test'
build-target: ${{ matrix.build-target }}
args: '-nographics -batchmode -runTests -testPlatform EditMode -testResults "${{ github.workspace }}/Logs/${{ matrix.build-target }}-test-results.xml"'
- uses: RageAgainstThePixel/unity-action@v1
name: '${{ matrix.build-target }}-Build'
with:
log-name: '${{ matrix.build-target }}-Build'
build-target: '${{ matrix.build-target }}'
args: '-quit -batchmode -executeMethod Utilities.Editor.BuildPipeline.UnityPlayerBuildTools.StartCommandLineBuild -sceneList Assets/Samples/Demo/Demo.unity'
- uses: actions/upload-artifact@v4
id: upload-artifact
name: 'Upload ${{ matrix.build-target }} Artifacts'
if: success() || failure()
with:
compression-level: 0
retention-days: 1
name: '${{ github.run_number }}.${{ github.run_attempt }}-${{ matrix.os }}-${{ matrix.unity-versions }}-${{ matrix.build-target }}-Artifacts'
path: |
${{ github.workspace }}/Logs/*-test-results.xml
${{ github.workspace }}/**/*.log
${{ env.UNITY_PROJECT_PATH || github.workspace }}/Builds/${{ matrix.build-target }}/**/*
!${{ env.UNITY_PROJECT_PATH || github.workspace }}/Library/**/*
!/**/*_BackUpThisFolder_ButDontShipItWithYourGame/**
!/**/*_BurstDebugInformation_DoNotShip/**