Merge pull request #14 from davidmfinol/addWorkflowdispatch

Update ReadMe.md and add workflow dispatch
This commit is contained in:
David Finol 2023-04-22 09:04:41 -05:00 committed by GitHub
commit 691a498057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 55 deletions

View File

@ -3,35 +3,36 @@ name: Unity Actions
on:
pull_request: {}
push: {}
workflow_dispatch: {}
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
PROJECT_PATH: .
### Refer to https://game.ci/docs/github/getting-started
jobs:
checklicense:
name: check if UNITY_LICENSE is set in github secrets
name: Check for UNITY_LICENSE 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
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
run: |
echo "Skip activation job: ${{ env.UNITY_LICENSE != '' }}"
echo "::set-output name=is_unity_license_set::${{ env.UNITY_LICENSE != '' }}"
export is_unity_license_set="${{ env.UNITY_LICENSE != '' }}"
echo "is_unity_license_set=$is_unity_license_set" >> $GITHUB_OUTPUT
activation:
needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'false'
name: Request activation file 🔑
name: Request manual 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-activation-file@v2
# Upload artifact (Unity_v20XX.X.XXXX.alf)
- name: Expose as artifact
@ -43,7 +44,7 @@ jobs:
test:
needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
name: Test all modes ✨
name: Run all tests ✨
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -52,25 +53,22 @@ jobs:
- uses: actions/cache@v3
with:
path: Library
key: Library-test-project-${{ matrix.targetPlatform }}
restore-keys: |
Library-test-project-
Library-
# https://github.com/game-ci/unity-test-runner/releases/
key: Library-test
- uses: game-ci/unity-test-runner@v2
id: testRunner
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ env.PROJECT_PATH }}
testMode: all
customParameters: "-nographics"
githubToken: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: Test results (all modes)
path: ${{ steps.testRunner.outputs.artifactsPath }}
build:
needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
needs: [test]
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
@ -87,15 +85,14 @@ jobs:
lfs: true
- uses: actions/cache@v3
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/
path: Library
key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v3
with:
@ -103,8 +100,7 @@ jobs:
path: build
buildWithMac:
needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
needs: [build]
name: Build for ${{ matrix.targetPlatform }}
runs-on: macos-latest
strategy:
@ -113,30 +109,56 @@ jobs:
targetPlatform:
- StandaloneOSX
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
path: Library
key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }}
- name: Upload Build
uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: build
buildWithWindows:
needs: [build, buildWithMac]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
needs: build
name: Build for ${{ matrix.targetPlatform }}
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
targetPlatform:
- WSAPlayer
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: build
buildWithWindows2:
needs: buildWithWindows
name: Build for ${{ matrix.targetPlatform }}
runs-on: windows-2019
strategy:
@ -145,25 +167,22 @@ jobs:
targetPlatform:
- StandaloneWindows
- StandaloneWindows64
- WSAPlayer
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
path: Library
key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }}
- name: Upload Build
uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: build

View File

@ -12,4 +12,4 @@ MonoBehaviour:
m_Script: {fileID: 0}
m_Name:
m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState
lastWriteTicks: -8585491470484541603
lastWriteTicks: -8585194918909323212

View File

@ -1,6 +1,6 @@
# unity-actions example
[![Actions 😎](https://github.com/GabLeRoux/unity-actions-example/workflows/Actions%20%F0%9F%98%8E/badge.svg)](https://github.com/GabLeRoux/unity-actions-example/actions)
[![Unity Actions](https://github.com/game-ci/unity-actions-example/actions/workflows/main.yml/badge.svg)](https://github.com/game-ci/unity-actions-example/actions/workflows/main.yml)
Example using unity-actions to test and build a unity project. More information at [game.ci](https://game.ci/)