Simplify unity-actions workflow (#1)

* Simplify unity-actions workflow

* Remove WebGL from build as it's currently failing

* Trigger builds on main branch push

This is tricky. I wish we could trigger on all branches push, but it seems like internal PRs are run twice when using this:

```yaml

on:
  pull_request: {}
  push: {}
```

So specifying a branch is a bit better somehow. Related discussions:
* https://github.community/t/how-to-run-a-workflow-only-once-even-when-triggered-mutliple-times/16436
* https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662
This commit is contained in:
Gabriel Le Breton
2020-10-19 16:53:30 +00:00
committed by GitHub
parent 9f0672b9e4
commit 45b231938b
2 changed files with 68 additions and 47 deletions
+68 -19
View File
@@ -1,4 +1,4 @@
name: Actions 😎
name: Unity Actions
on:
pull_request: {}
@@ -6,18 +6,76 @@ on:
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/[email protected]
with:
path: Library
key: Library-test-project-${{ matrix.targetPlatform }}
restore-keys: |
Library-test-project-
Library-
- uses: webbertakken/[email protected]
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
@@ -33,21 +91,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-[email protected]
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