Simplify unity-actions workflow

This commit is contained in:
Gabriel Le Breton 2020-10-18 22:41:51 -04:00
parent 9f0672b9e4
commit 2d689e523a
2 changed files with 70 additions and 48 deletions

View File

@ -1,27 +1,86 @@
name: Actions 😎
name: Unity Actions
on:
pull_request: {}
push: { branches: [main] }
push: {}
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_VERSION: 2020.1.7f1
PROJECT_PATH: .
jobs:
buildAndTestForSomePlatforms:
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
uses: webbertakken/unity-request-manual-activation-file@master
with:
unityVersion: ${{ env.UNITY_VERSION }}
# 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@v1.1.0
with:
path: Library
key: Library-test-project-${{ matrix.targetPlatform }}
restore-keys: |
Library-test-project-
Library-
- uses: webbertakken/unity-test-runner@v1.7
id: testRunner
with:
projectPath: ${{ env.PROJECT_PATH }}
unityVersion: ${{ env.UNITY_VERSION }}
testMode: all
customParameters: "-nographics"
- uses: actions/upload-artifact@v1
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 }} on version ${{ matrix.unityVersion }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
projectPath:
- .
unityVersion:
- 2020.1.7f1
targetPlatform:
- StandaloneOSX
- StandaloneWindows64
- StandaloneLinux64
- WebGL
steps:
- uses: actions/checkout@v2
with:
@ -33,21 +92,12 @@ jobs:
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# - uses: webbertakken/unity-test-runner@master
# id: testRunner
# with:
# projectPath: ${{ matrix.projectPath }}
# unityVersion: ${{ matrix.unityVersion }}
# - uses: actions/upload-artifact@v1
# with:
# name: Test results (all modes)
# path: ${{ steps.testRunner.outputs.artifactsPath }}
- uses: webbertakken/unity-builder@master
- uses: webbertakken/unity-builder@v1.4
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
projectPath: ${{ env.PROJECT_PATH }}
unityVersion: ${{ env.UNITY_VERSION }}
targetPlatform: ${{ matrix.targetPlatform }}
customParameters: '-nographics'
customParameters: "-nographics"
- uses: actions/upload-artifact@v1
with:
name: Build

View File

@ -1,28 +0,0 @@
name: Acquire activation file
on:
#uncomment this to make it show once, stop the job in github actions, comment it again, then run using the "Run workflow" button and fill the form with desired unity version
# push: { branches: [main] }
workflow_dispatch:
inputs:
unityVersion:
description: 'Unity version to use during activation request'
required: true
default: 2020.1.7f1
jobs:
activation:
name: Request manual activation file 🔑
runs-on: ubuntu-latest
steps:
# Request manual activation file
- name: Request manual activation file
id: getManualLicenseFile
uses: webbertakken/unity-request-manual-activation-file@master
with:
unityVersion: ${{ github.event.inputs.unityVersion }}
# 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 }}