unity-actions-example/.github/workflows/main.yml
David Finol 1720b45ad0
Remove unityVersion
We no longer need to specify unityVersion, so it is better to not include it
2021-02-04 20:50:32 -06:00

106 lines
3.4 KiB
YAML

name: Unity Actions
on:
pull_request: {}
push: { branches: [main, master, develop] }
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
PROJECT_PATH: .
jobs:
checklicense:
name: check if UNITY_LICENSE is set in github secrets
runs-on: ubuntu-latest
outputs:
is_unity_license_set: ${{ steps.checklicense_job.outputs.is_unity_license_set }}
steps:
- name: Check whether unity activation requests should be done
id: checklicense_job
run: |
echo "Skip activation job: ${{ env.UNITY_LICENSE != '' }}"
echo "::set-output name=is_unity_license_set::${{ env.UNITY_LICENSE != '' }}"
activation:
needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'false'
name: Request activation file 🔑
runs-on: ubuntu-latest
steps:
# Request manual activation file
- name: Request manual activation file
id: getManualLicenseFile
# https://github.com/game-ci/unity-request-activation-file/releases/
uses: game-ci/unity-request-manual-activation-file@v2.0-alpha-1
# Upload artifact (Unity_v20XX.X.XXXX.alf)
- name: Expose as artifact
uses: actions/upload-artifact@v1
with:
name: ${{ steps.getManualLicenseFile.outputs.filePath }}
path: ${{ steps.getManualLicenseFile.outputs.filePath }}
test:
needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
name: Test all modes ✨
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: actions/cache@v2.1.3
with:
path: Library
key: Library-test-project-${{ matrix.targetPlatform }}
restore-keys: |
Library-test-project-
Library-
# https://github.com/game-ci/unity-test-runner/releases/
- uses: game-ci/unity-test-runner@v2.0-alpha-2
id: testRunner
with:
projectPath: ${{ env.PROJECT_PATH }}
testMode: all
customParameters: "-nographics"
- uses: actions/upload-artifact@v2
with:
name: Test results (all modes)
path: ${{ steps.testRunner.outputs.artifactsPath }}
build:
needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneOSX
- StandaloneWindows
- StandaloneWindows64
- StandaloneLinux64
- iOS
- Android
# See https://github.com/game-ci/docker/issues/53 webgl will be supported in editor image v0.9
# - WebGL
steps:
- uses: actions/checkout@v2
with:
lfs: true
- uses: actions/cache@v2.1.3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# https://github.com/game-ci/unity-builder/releases/
- uses: game-ci/unity-builder@v2.0-alpha-6
with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v2
with:
name: Build-${{ matrix.targetPlatform }}
path: build