Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ on:
jobs:
build_desktop:
name: build-linux-unity${{inputs.unity_version}}-CPP${{ inputs.firebase_cpp_sdk_version }}
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional? Remember we need to ping to ubuntu 20

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.
I believe github will remove ubuntu 20 runner in the future. Then, we still need to solve the issue.
This PR is to fix the installation issue on newer ubuntu runners, so that we don't have to ping to ubuntu 20.

Copy link
Contributor

@StephenHodgson StephenHodgson Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unity does not support Ubuntu 22.04. This should be reverted until the next Unity Hub release that does support it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See forum post for details https://forum.unity.com/threads/running-unity-on-ubuntu-22-04.1284083/

I've already tried the workaround in my installation scripts but cannot get around the fuse error

Copy link
Contributor Author

@sunmou99 sunmou99 Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the info.
Yeah, I also tried the workaround and it didn't work.
But, we are building SDK here and only installing (not launching) Editor.
So, it worked in my CI:

I1129 21:42:55.199143 140596922395520 unity_installer.py:343] run_with_retry: xvfb-run unityhub --headless install --version 2020.3.40f1 --changeset ba48d4efcef1 (attempt 1 of 3)
I1129 21:46:01.864848 140596922395520 unity_installer.py:346] cmd stdout: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Unknown or unsupported transport “disabled” for address “disabled:”
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
...
Progress:
[Unity 2020.3.40f1] downloading 98.77%
Progress:
[Unity 2020.3.40f1] downloading 100.00%
Progress:
[Unity 2020.3.40f1] finished downloading.
Progress:
[Unity 2020.3.40f1] finished downloading.
Progress:
[Unity 2020.3.40f1] queued for install.
Progress:
[Unity 2020.3.40f1] queued for install.
Progress:
[Unity 2020.3.40f1] validating installation...
Progress:
[Unity 2020.3.40f1] validating installation...
Progress:
[Unity 2020.3.40f1] installing...
Progress:
[Unity 2020.3.40f1] installed successfully.
All Tasks Completed Successfully.
Progress:
[Unity 2020.3.40f1] installed successfully.
All Tasks Completed Successfully.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You guys don't do and validation and testing in editor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do. But not on Ubuntu runners.

strategy:
fail-fast: false

Expand Down
21 changes: 12 additions & 9 deletions gha/unity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This GitHub Action will provide `UNITY_VERSION` (full unity version, e.g. `2020.

- Output usage:
```yml
- uses: firebase/firebase-unity-sdk/gha/unity@main
- uses: ./gha/unity
with:
version: ${{ unity_version }}
platforms: ${{ platforms }}
Expand All @@ -37,13 +37,13 @@ This GitHub Action will provide `UNITY_VERSION` (full unity version, e.g. `2020.

steps:
# ...
- uses: firebase/firebase-unity-sdk/gha/unity@main
- uses: ./gha/unity
with:
version: ${{ unity_version }}
platforms: ${{ platforms }}
```

- Install Unity, Activate and Release Unity License
- Install Unity, Activate and Release Unity License. Always release the license after usage.
```yml
jobs:
build_testapp:
Expand All @@ -52,7 +52,7 @@ This GitHub Action will provide `UNITY_VERSION` (full unity version, e.g. `2020.
steps:
# ...
- id: unity_setup_and_activate
uses: firebase/firebase-unity-sdk/gha/unity@main
uses: ./gha/unity
with:
version: ${{ unity_version }}
platforms: ${{ platforms }}
Expand All @@ -61,7 +61,7 @@ This GitHub Action will provide `UNITY_VERSION` (full unity version, e.g. `2020.
serial_ids: ${{ secrets.SERIAL_ID }}
# ...
- id: release_license
uses: firebase/firebase-unity-sdk/gha/unity@main
uses: ./gha/unity
with:
version: ${{ unity_version }}
release_license: "true"
Expand All @@ -72,18 +72,21 @@ This GitHub Action will provide `UNITY_VERSION` (full unity version, e.g. `2020.

This GitHub Action leverages [Unity Hub](https://unity3d.com/get-unity/download), which is a standalone application that streamlines the way you navigate, download, and manage your Unity projects and installations. Unity Hub is with beta version CLI support, and we are using it for Unity versions management.

In this GitHub Action, supported Unity Versions are maintained by `SETTINGS` in `gha/unity/unity_installer.py`.
In this GitHub Action, supported Unity Versions are maintained by `SETTINGS` in [`gha/unity/unity_installer.py`](https://github.com/firebase/firebase-unity-sdk/blob/unity-readme/gha/unity/unity_installer.py#L89).

**Add a new Unity version support**

1. Select your version from [Unity LTS versions list](https://unity3d.com/unity/qa/lts-releases) and make sure this version can be installed with Unity Hub.
1. Select your version from [Unity LTS versions list](https://unity3d.com/unity/qa/lts-releases):
- Make sure this version can be installed with Unity Hub.
- Make sure this version works on you computer first.
- You may need to select different versions for different OS.

2. Generate new JSON string and added it to `UNITY_SETTINGS`:
2. Generate a JSON string which contains the following information and added it to `UNITY_SETTINGS`:
- `Major_version_number`: unity major version number: `2020`, `2021`, etc.
- `Full_version_number`: unity full version number. e.g. `2020.3.34f1` for major version `2020`.
- `Changeset`: changeset locates at the bottom of this page https://unity3d.com/unity/whats-new/{unity_version}. Note: the version is neither `Major_version_number` nor `Full_version_number`. e.g. https://unity3d.com/unity/whats-new/2020.3.34
- `Platform`: Firebase Unity SDK supported platforms. Values of [Android,iOS,tvOS,Windows,macOS,Linux]
- `Modules`:[Unity Hub must been installed] Unity modules that required for certain platform. e.g. ["windows-mono"] module for "Windows" platform. To list avaliable modules, run `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub" -- --headless help` on your mac machine.
- `Modules`:[Unity Hub must been installed] Unity modules that required for certain platform. e.g. ["windows-mono"] module for "Windows" platform. To list avaliable modules on mac machines, run `"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub" -- --headless help` .

Template:
```
Expand Down
23 changes: 11 additions & 12 deletions gha/unity/unity_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@
"unity_hub_url": {
WINDOWS: "https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.exe",
MACOS: "https://public-cdn.cloud.unity3d.com/hub/prod/UnityHubSetup.dmg",
LINUX: "https://public-cdn.cloud.unity3d.com/hub/prod/UnityHub.AppImage",
LINUX: "",
},
# Unity Hub will be installed at this location
"unity_hub_path": {
WINDOWS: '"C:/Program Files/Unity Hub/Unity Hub.exe"',
MACOS: '"/Applications/Unity Hub.app"',
LINUX: '"/home/runner/Unity Hub/UnityHub.AppImage"',
LINUX: '/usr/bin/unityhub',
},
"unity_hub_executable": {
WINDOWS: '"C:/Program Files/Unity Hub/Unity Hub.exe" -- --headless',
MACOS: '"/Applications/Unity Hub.app/Contents/MacOS/Unity Hub" -- --headless',
LINUX: 'xvfb-run --auto-servernum "/home/runner/Unity Hub/UnityHub.AppImage" --headless',
LINUX: 'xvfb-run unityhub --headless',
},
# Unity will be installed at this location
"unity_path": {
Expand Down Expand Up @@ -241,8 +241,9 @@ def install(unity_version, platforms):
def install_unity_hub():
runner_os = get_os()
unity_hub_url = SETTINGS["unity_hub_url"][runner_os]
unity_hub_installer = path.basename(unity_hub_url)
download_unity_hub(unity_hub_url, unity_hub_installer, max_attempts=MAX_ATTEMPTS)
if unity_hub_url:
unity_hub_installer = path.basename(unity_hub_url)
download_unity_hub(unity_hub_url, unity_hub_installer, max_attempts=MAX_ATTEMPTS)
if runner_os == MACOS:
run(f'sudo hdiutil attach {unity_hub_installer}', max_attempts=MAX_ATTEMPTS)
mounted_to = glob.glob("/Volumes/Unity Hub*/Unity Hub.app")
Expand All @@ -253,13 +254,11 @@ def install_unity_hub():
elif runner_os == WINDOWS:
run(f'{unity_hub_installer} /S', max_attempts=MAX_ATTEMPTS)
elif runner_os == LINUX:
home_dir = os.environ["HOME"]
unity_hub_path = SETTINGS["unity_hub_path"][runner_os]
run(f'mkdir -p "{home_dir}/Unity Hub" "{home_dir}/.config/Unity Hub"')
run(f'mv {unity_hub_installer} {unity_hub_path}')
run(f'chmod +x {unity_hub_path}')
run(f'touch "{home_dir}/.config/Unity Hub/eulaAccepted"', max_attempts=MAX_ATTEMPTS)

# https://docs.unity3d.com/hub/manual/InstallHub.html#install-hub-linux
run('sudo sh -c \'echo "deb https://hub.unity3d.com/linux/repos/deb stable main" > /etc/apt/sources.list.d/unityhub.list\'')
run('wget -qO - https://hub.unity3d.com/linux/keys/public | sudo apt-key add -', max_attempts=MAX_ATTEMPTS)
run('sudo apt update')
run('sudo apt-get install unityhub', max_attempts=MAX_ATTEMPTS)

def download_unity_hub(unity_hub_url, unity_hub_installer, max_attempts=1):
attempt_num = 1
Expand Down