2. CI #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unity Actions | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: {} | |
permissions: | |
contents: write | |
actions: write | |
### Refer to https://game.ci/docs/github/getting-started | |
jobs: | |
checklicense: | |
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 != '' }}" | |
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 manual activation file 🔑 | |
runs-on: ubuntu-latest | |
steps: | |
# Request manual activation file | |
- name: Request manual activation file | |
id: getManualLicenseFile | |
uses: game-ci/unity-request-activation-file@v2 | |
# Upload artifact (Unity_v20XX.X.XXXX.alf) | |
- name: Expose as artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.getManualLicenseFile.outputs.filePath }} | |
path: ${{ steps.getManualLicenseFile.outputs.filePath }} | |
test: | |
needs: checklicense | |
if: needs.checklicense.outputs.is_unity_license_set == 'true' | |
name: Run all tests ✨ | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-test | |
- uses: game-ci/unity-test-runner@v4 | |
id: testRunner | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
githubToken: ${{ secrets.GITHUB_TOKEN }} | |
projectPath: . | |
testMode: playmode | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Test results (all modes) | |
path: ${{ steps.testRunner.outputs.artifactsPath }} | |
build: | |
needs: test | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
targetPlatform: | |
- StandaloneLinux64 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-${{ matrix.targetPlatform }} | |
- uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
targetPlatform: ${{ matrix.targetPlatform }} | |
projectPath: . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build-${{ matrix.targetPlatform }} | |
path: build | |
buildForMac: | |
needs: build | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: macos-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
targetPlatform: | |
- StandaloneOSX | |
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 }} | |
projectPath: . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build-${{ matrix.targetPlatform }} | |
path: build | |
buildForWindows: | |
needs: buildForMac | |
name: Build for ${{ matrix.targetPlatform }} | |
runs-on: windows-2019 | |
strategy: | |
fail-fast: false | |
matrix: | |
targetPlatform: | |
- StandaloneWindows | |
- StandaloneWindows64 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
lfs: true | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-${{ matrix.targetPlatform }} | |
- uses: game-ci/unity-builder@v4 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
targetPlatform: ${{ matrix.targetPlatform }} | |
projectPath: . | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build-${{ matrix.targetPlatform }} | |
path: build |