Skip to content

Commit 8c53096

Browse files
authored
Install unity in script and remove kuler90/setup-unity@v1 (#539)
1 parent 02a3372 commit 8c53096

File tree

7 files changed

+226
-183
lines changed

7 files changed

+226
-183
lines changed

.github/workflows/build_android.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ jobs:
5959
ref: ${{ inputs.firebase_cpp_sdk_version }}
6060
submodules: true
6161

62-
- uses: ruby/setup-ruby@v1
63-
with:
64-
ruby-version: 2.6
65-
6662
- name: Setup python
6763
uses: actions/setup-python@v4
6864
with:

.github/workflows/build_linux.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ jobs:
5555
submodules: true
5656
ref: ${{ inputs.firebase_cpp_sdk_version }}
5757

58-
# Set up the requirements, and install Unity
59-
# Ruby setup has to happen before python install and setup, to keep the absl config.
60-
- uses: ruby/setup-ruby@v1
61-
with:
62-
ruby-version: 3.0.2
63-
6458
- name: Setup python
6559
uses: actions/setup-python@v4
6660
with:

.github/workflows/build_macos.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,6 @@ jobs:
5555
submodules: true
5656
ref: ${{ inputs.firebase_cpp_sdk_version }}
5757

58-
# Set up the requirements, and install Unity
59-
# Ruby setup has to happen before python install and setup, to keep the absl config.
60-
- uses: ruby/setup-ruby@v1
61-
with:
62-
ruby-version: 3.0.2
63-
6458
# Remove other python installs before installing the version we want
6559
- name: Remove other pythons
6660
shell: bash

.github/workflows/build_windows.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ jobs:
5858
- name: Support longpaths
5959
run: git config --system core.longpaths true
6060

61-
# Set up the requirements, and install Unity
62-
# Ruby setup has to happen before python install and setup, to keep the absl config.
63-
- uses: ruby/setup-ruby@v1
64-
with:
65-
ruby-version: 3.0.2
66-
6761
- name: Setup python
6862
uses: actions/setup-python@v4
6963
with:

gha/unity/README.md

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,23 @@
33
## Inputs
44
- `version`: **[Required]** Unity Major Version Number. Currently supported values: [2019, 2020].
55

6-
- `platforms`: Platforms that you'd like to support, if not provided, some platforms may encounter errors. Values: [Android,iOS,tvOS,Windows,macOS,Linux].
6+
- `platforms`: Platforms that you'd like to support, if not provided, build apps on certain platforms may encounter errors. Values: [Android,iOS,tvOS,Windows,macOS,Linux].
77

8-
- `username`: Required when Activate Unity license. Refer to the Usage section below.
8+
- `username`: Required when Activate Unity license. See the [Usage](https://github.com/firebase/firebase-unity-sdk/tree/main/gha/unity#usage) section below.
99

10-
- `password`: Required when Activate Unity license. Refer to the Usage section below.
10+
- `password`: Required when Activate Unity license. See the Usage section below.
1111

12-
- `serial_ids`: Required when Activate Unity license. Refer to the Usage section below.
12+
- `serial_ids`: Required when Activate Unity license. See the Usage section below.
1313

14-
- `release_license`: If a license has been activated in the pervious step, then **must** add anothe step and set **"ture"** to `release_license` input.
14+
- `release_license`: If a license has been activated in the pervious step, then **must** add another step to release the license. Set **"ture"** to `release_license` input.
1515

1616
## Output
1717

18-
This GitHub Action will provide `UNITY_VERSION` (full unity version) and `UNITY_ROOT_DIR` (Unity project directory) environment variable
18+
This GitHub Action will provide `UNITY_VERSION` (full unity version, e.g. `2020.3.34f1`) and `UNITY_ROOT_DIR` (Unity project directory, e.g. `/Applications/Unity/Hub/Editor/2020.3.34f1`) environment variables as outputs.
1919

2020
- Output usage:
2121
```yml
22-
- id: unity_setup
23-
uses: firebase/firebase-unity-sdk/gha/unity@main
22+
- uses: firebase/firebase-unity-sdk/gha/unity@main
2423
with:
2524
version: ${{ unity_version }}
2625
platforms: ${{ platforms }}
@@ -38,8 +37,7 @@ This GitHub Action will provide `UNITY_VERSION` (full unity version) and `UNITY_
3837

3938
steps:
4039
# ...
41-
- id: unity_setup
42-
uses: firebase/firebase-unity-sdk/gha/unity@main
40+
- uses: firebase/firebase-unity-sdk/gha/unity@main
4341
with:
4442
version: ${{ unity_version }}
4543
platforms: ${{ platforms }}
@@ -53,7 +51,7 @@ This GitHub Action will provide `UNITY_VERSION` (full unity version) and `UNITY_
5351

5452
steps:
5553
# ...
56-
- id: unity_setup
54+
- id: unity_setup_and_activate
5755
uses: firebase/firebase-unity-sdk/gha/unity@main
5856
with:
5957
version: ${{ unity_version }}
@@ -69,29 +67,45 @@ This GitHub Action will provide `UNITY_VERSION` (full unity version) and `UNITY_
6967
release_license: "true"
7068
```
7169
72-
## [Deprecated] How to upgrade supported unity versions
70+
## How to upgrade supported unity versions
7371
**Background**
7472
75-
This GitHub Action leverages [U3D](github.com/DragonBox/u3d), which is a command line tool for working with Unity from the command line on all three operating systems.
73+
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.
7674
77-
In this GitHub Action, supported Unity Versions are maintained by `UNITY_SETTINGS` in `gha/unity/unity_installer.py`.
75+
In this GitHub Action, supported Unity Versions are maintained by `SETTINGS` in `gha/unity/unity_installer.py`.
7876

7977
**Add a new Unity version support**
8078

81-
1. Install [U3D](github.com/DragonBox/u3d).
79+
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.
8280

8381
2. Generate new JSON string and added it to `UNITY_SETTINGS`:
84-
- `Major_version_number`: unity major version number: 2020, 2021, etc.
85-
- `Full_version_number`: unity full version number. e.g. 2020.3.34f1 for major version 2020. Run `u3d available` and select [Unity LTS versions](https://unity3d.com/unity/qa/lts-releases).
86-
- `Platform`: Values of [Android,iOS,tvOS,Windows,macOS,Linux]
87-
- `Package`:[Unity Hub must **not** been installed] Unity Packages that required for certain platform. e.g. ["Windows-mono"] pakcages for "Windows" platform. To list avaliable packages, run `u3d available -u $unity_version -p`.
82+
- `Major_version_number`: unity major version number: `2020`, `2021`, etc.
83+
- `Full_version_number`: unity full version number. e.g. `2020.3.34f1` for major version `2020`.
84+
- `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
85+
- `Platform`: Firebase Unity SDK supported platforms. Values of [Android,iOS,tvOS,Windows,macOS,Linux]
86+
- `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.
8887

88+
Template:
8989
```
9090
UNITY_SETTINGS = {
9191
Major_version_number: {
9292
OS: {
9393
"version": Full_version_number,
94-
"packages": {Platform: [Package], ...},
94+
"changeset": Changeset,
95+
"modules": {Platform: [Moudles], ...},
96+
},
97+
...
98+
},
99+
}
100+
```
101+
e.g.
102+
```
103+
UNITY_SETTINGS = {
104+
"2020": {
105+
WINDOWS: {
106+
"version": "2020.3.34f1",
107+
"changeset": "9a4c9c70452b",
108+
"modules": {ANDROID: ["android", "ios"], IOS: ["ios"], TVOS: ["appletv"], WINDOWS: [], MACOS: ["mac-mono"], LINUX: ["linux-mono"], PLAYMODE: ["ios"]},
95109
},
96110
...
97111
},
@@ -100,10 +114,4 @@ In this GitHub Action, supported Unity Versions are maintained by `UNITY_SETTING
100114

101115
**Common failures & solutions**
102116

103-
1. If you met problem with `u3d` cmd (e.g. `u3d available -u $unity_version -p`), please install older version of `u3d` and disable the `u3d` version check. Then try it again.
104-
```
105-
gem install u3d -v 1.2.3
106-
export U3D_SKIP_UPDATE_CHECK=1
107-
```
108-
109-
2. If you have problem with Android build. Make sure you are using the right version of NDK and JDK. Testapp building process is using a patch function `patch_android_env` in `build_testapp.py`. (Please refer [Unity Documentation](https://docs.unity3d.com/Manual/android-sdksetup.html) for Android environment setup).
117+
1. If you have problem with Android build. Make sure you are using the right version of NDK and JDK. Testapp building process is using a patch function `patch_android_env` in `build_testapp.py`. (Please refer [Unity Documentation](https://docs.unity3d.com/Manual/android-sdksetup.html) for Android environment setup).

gha/unity/action.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,19 @@ inputs:
3030
runs:
3131
using: 'composite'
3232
steps:
33+
- id: configs
34+
shell: bash
35+
run: |
36+
if [[ "${{ inputs.release_license }}" != "" ]]; then
37+
echo "release_license=True" >> $GITHUB_OUTPUT
38+
else
39+
echo "install_unity=True" >> $GITHUB_OUTPUT
40+
if [[ "${{ inputs.username }}" != "" && "${{ inputs.password }}" != "" && "${{ inputs.serial_ids }}" != "" ]]; then
41+
echo "activate_license=True" >> $GITHUB_OUTPUT
42+
fi
43+
fi
3344
- name: Return Unity license
34-
if: inputs.release_license
45+
if: steps.configs.outputs.release_license
3546
uses: nick-invision/retry@v2
3647
with:
3748
timeout_minutes: 5
@@ -42,28 +53,18 @@ runs:
4253
--version ${{ inputs.version }} \
4354
--logfile "testapps/release_license.log"
4455
cat testapps/release_license.log
45-
- name: unity_setting
46-
if: inputs.release_license == ''
47-
shell: bash
48-
run: |
49-
unity_info=$( python $GITHUB_ACTION_PATH/unity_installer.py --setting --version ${{ inputs.version }})
50-
echo "UNITY_VERSION=$(cut -d',' -f1 <<< ${unity_info})" >> $GITHUB_ENV
51-
echo "UNITY_ROOT_DIR=$(cut -d',' -f2 <<< ${unity_info})" >> $GITHUB_ENV
5256
- name: Install Unity
53-
if: inputs.release_license == ''
54-
uses: kuler90/setup-unity@v1
55-
with:
56-
unity-version: ${{ env.UNITY_VERSION }}
57-
- name: Install Unity Modules
58-
if: inputs.release_license == ''
57+
if: steps.configs.outputs.install_unity
5958
shell: bash
6059
run: |
6160
if [[ -n "${{ inputs.platforms }}" ]]; then
6261
additional_flags+=(--platforms ${{ inputs.platforms }})
6362
fi
64-
python $GITHUB_ACTION_PATH/unity_installer.py --install_modules --version ${{ inputs.version }} ${additional_flags[*]}
63+
unity_info=$(python $GITHUB_ACTION_PATH/unity_installer.py --install --version ${{ inputs.version }} ${additional_flags[*]})
64+
echo "UNITY_VERSION=$(cut -d',' -f1 <<< ${unity_info})" >> $GITHUB_ENV
65+
echo "UNITY_ROOT_DIR=$(cut -d',' -f2 <<< ${unity_info})" >> $GITHUB_ENV
6566
- name: Activate Unity license
66-
if: inputs.release_license == '' && inputs.username != '' && inputs.password != '' && inputs.serial_ids != ''
67+
if: steps.configs.outputs.activate_license
6768
shell: bash
6869
run: |
6970
python $GITHUB_ACTION_PATH/unity_installer.py --activate_license \

0 commit comments

Comments
 (0)