🐒
game-ci/unity-builder@v4 のSelfHostedRunnerでハマる
2024-08-19時点の情報
game-ci/unity-buidler@v4を使ってself-hosted runnerでビルドするときに、地味にハマったのでメモ。
ハマリ1. UnityEditorがすでにインストールされているエラーでハマる
Run game-ci/unity-builder@v4
Warning:
Library folder does not exist.
Consider setting up caching to speed up your workflow,
if this is not your first build.
(node:22372) NOTE: We are formalizing our plans to enter AWS SDK for JavaScript (v2) into maintenance mode in 2023.
Please migrate your code to use AWS SDK for JavaScript (v3).
For more information, check the migration guide at https://a.co/7PzMCcy
(Use `node --trace-warnings ...` to show where the warning was created)
/bin/sh
0
0
Generated version 0.0.7 (no version tags found).
Using android versionCode 7
Building locally
/Applications/Unity Hub.app/Contents/MacOS/Unity Hub -- --headless install --version 2022.3.20f1 --changeset 61c2feb0970d --module webgl --architecture arm64 --childModules
2024-08-19 15:06:25.176 Unity Hub[22389:419502] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.
Error while installing an editor or a module from changeset. Error: Editor already installed in this location.
どうやらGameCIが /Applications/Unity/Hub/Editor/{version}/Unity.app/Contents/MacOS/Unity
のロケーションにインストールされているUnityEditorしか認識しないようだった。
カスタムロケーションにインストールされていたので、UnityHubを起動して、/Applications/Unity/Hub/Editor
にインストール先を変更するとうまく動いた.
ハマリ2. self hosted runnerなのにlicense認証しようとしてしまう
Run game-ci/unity-builder@v4
...
[Licensing::Module] License activation has failed. Aborting.
Unclassified error occured while trying to activate license.
Exit code was: 1
Error: There was an error while trying to activate the Unity license.
Error: Build failed with exit code 1
skipActivationというオプションで認証フェーズをスキップできた.
game-ci/unity-builder@v4のwithオプションにこれを追加することで対応
最終的には下記のようなworkflowでうまくいった.
(UNITY_EMAIL,UNITY_LICENSE,UNITY_PASSWORDは不要かも)
name: Unity WebGL Build
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
name: Build Unity WebGL Project
#runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
lfs: true
- name: Cache Library
uses: actions/cache@v3
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
- name: Build WebGL
uses: game-ci/unity-builder@v4
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: WebGL
skipActivation: true
- name: Upload WebGL Build
uses: actions/upload-artifact@v3
with:
name: WebGL Build
path: build/WebGL
Discussion