Skip to content

Commit 7a50e97

Browse files
authored
Clean up the usage of kuler90/build-unity (#531)
1 parent a6c5bad commit 7a50e97

File tree

10 files changed

+128
-273
lines changed

10 files changed

+128
-273
lines changed

.github/workflows/build_android.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,13 @@ jobs:
101101
shell: bash
102102
run: |
103103
pip install -r scripts/gha/requirements.txt
104-
105-
- name: Setup Unity
106-
uses: kuler90/setup-unity@v1
104+
105+
- id: unity_setup
106+
uses: ./gha/unity
107107
timeout-minutes: 30
108108
with:
109-
unity-version: 2020.3.34f1
110-
unity-modules: android
109+
version: ${{ inputs.unity_version }}
110+
platforms: ${{ inputs.unity_platform_name }}
111111

112112
- name: Display Swig Version
113113
shell: bash

.github/workflows/build_ios.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ jobs:
8181
run: |
8282
pip install -r scripts/gha/requirements.txt
8383
84-
- name: Setup Unity
85-
uses: kuler90/setup-unity@v1
84+
- id: unity_setup
85+
uses: ./gha/unity
8686
timeout-minutes: 30
8787
with:
88-
unity-version: 2020.3.34f1
89-
unity-modules: ios
88+
version: ${{ inputs.unity_version }}
89+
platforms: ${{ inputs.unity_platform_name }}
9090

9191
- name: Build SDK (iOS)
9292
timeout-minutes: 90

.github/workflows/build_linux.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,12 @@ jobs:
8383
run: |
8484
sudo apt install openssl
8585
86-
- name: Setup Unity
87-
uses: kuler90/setup-unity@v1
86+
- id: unity_setup
87+
uses: ./gha/unity
8888
timeout-minutes: 30
8989
with:
90-
unity-version: 2020.3.40f1
90+
version: ${{ inputs.unity_version }}
91+
platforms: ${{ inputs.unity_platform_name }}
9192

9293
- name: Setup Swig Env
9394
shell: bash

.github/workflows/build_macos.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,12 @@ jobs:
9797
# brew won't overwrite MacOS system default OpenSSL, so force it here.
9898
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl --installed)" >> $GITHUB_ENV
9999
100-
- name: Setup Unity
101-
uses: kuler90/setup-unity@v1
100+
- id: unity_setup
101+
uses: ./gha/unity
102102
timeout-minutes: 30
103103
with:
104-
unity-version: 2020.3.34f1
105-
# Include iOS for the editor tools
106-
unity-modules: ios
104+
version: ${{ inputs.unity_version }}
105+
platforms: ${{ inputs.unity_platform_name }}
107106

108107
- name: Setup Swig Env
109108
shell: bash

.github/workflows/build_tvos.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,12 @@ jobs:
108108
run: |
109109
pod repo add cocoapods https://github.com/CocoaPods/Specs.git
110110
111-
- name: Setup Unity
112-
uses: kuler90/setup-unity@v1
111+
- id: unity_setup
112+
uses: ./gha/unity
113113
timeout-minutes: 30
114114
with:
115-
unity-version: 2020.3.34f1
116-
unity-modules: appletv
115+
version: ${{ inputs.unity_version }}
116+
platforms: ${{ inputs.unity_platform_name }}
117117

118118
- name: Build SDK (tvOS)
119119
timeout-minutes: 90

.github/workflows/build_windows.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,12 @@ jobs:
8989
run: |
9090
choco install openssl -r
9191
92-
- name: Setup Unity
93-
uses: kuler90/setup-unity@v1
92+
- id: unity_setup
93+
uses: ./gha/unity
9494
timeout-minutes: 30
9595
with:
96-
unity-version: 2020.3.34f1
96+
version: ${{ inputs.unity_version }}
97+
platforms: ${{ inputs.unity_platform_name }}
9798

9899
- name: Setup Swig Env
99100
shell: bash

.github/workflows/integration_tests.yml

Lines changed: 25 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -184,72 +184,15 @@ jobs:
184184
- name: setup Xcode version
185185
if: runner.os == 'macOS'
186186
run: sudo xcode-select -s /Applications/Xcode_${{ env.xcodeVersion }}.app/Contents/Developer
187-
188-
- name: Setup Unity (Android)
189-
if: ${{ contains(matrix.platform, 'Android') }}
190-
uses: kuler90/setup-unity@v1
191-
timeout-minutes: 30
192-
with:
193-
unity-version: 2020.3.34f1
194-
unity-modules: android
195-
# Because of a bug, include iOS for the editor tools
196-
- name: Setup Unity (Android, Part 2)
197-
if: ${{ contains(matrix.platform, 'Android') }}
198-
uses: kuler90/setup-unity@v1
187+
- id: unity_setup
188+
uses: ./gha/unity
199189
timeout-minutes: 30
200190
with:
201-
unity-version: 2020.3.34f1
202-
unity-modules: ios
203-
204-
- name: Setup Unity (iOS)
205-
if: ${{ contains(matrix.platform, 'iOS') }}
206-
uses: kuler90/setup-unity@v1
207-
timeout-minutes: 30
208-
with:
209-
unity-version: 2020.3.34f1
210-
unity-modules: ios
211-
212-
- name: Setup Unity (Desktop Windows)
213-
if: ${{ !contains(matrix.platform, 'Android') && !contains(matrix.platform, 'iOS') && runner.os != 'macOS' }}
214-
uses: kuler90/setup-unity@v1
215-
timeout-minutes: 30
216-
with:
217-
unity-version: 2020.3.34f1
218-
unity-modules: mac-mono
219-
- name: Setup Unity (Desktop Windows Part 2)
220-
if: ${{ !contains(matrix.platform, 'Android') && !contains(matrix.platform, 'iOS') && runner.os != 'macOS' }}
221-
uses: kuler90/setup-unity@v1
222-
timeout-minutes: 30
223-
with:
224-
unity-version: 2020.3.34f1
225-
unity-modules: linux-mono
226-
227-
- name: Setup Unity (Desktop macOS)
228-
if: ${{ !contains(matrix.platform, 'Android') && !contains(matrix.platform, 'iOS') && runner.os == 'macOS' }}
229-
uses: kuler90/setup-unity@v1
230-
timeout-minutes: 30
231-
with:
232-
unity-version: 2020.3.34f1
233-
unity-modules: windows-mono
234-
- name: Setup Unity (Desktop macOS Part 2)
235-
if: ${{ !contains(matrix.platform, 'Android') && !contains(matrix.platform, 'iOS') && runner.os == 'macOS' }}
236-
uses: kuler90/setup-unity@v1
237-
timeout-minutes: 30
238-
with:
239-
unity-version: 2020.3.34f1
240-
unity-modules: linux-mono
241-
242-
- name: Activate Unity license
243-
shell: bash
244-
run: |
245-
python gha/unity/unity_installer.py --activate_license \
246-
--version 2020 \
247-
--username "${{ secrets.UNITY_USERNAME }}" \
248-
--password "${{ secrets.UNITY_PASSWORD }}" \
249-
--serial_ids "${{ secrets.SERIAL_ID }}" \
250-
--logfile "testapps/activate_license.log"
251-
cat testapps/activate_license.log
252-
191+
version: ${{ matrix.unity_version }}
192+
platforms: ${{ matrix.platform }}
193+
username: ${{ secrets.UNITY_USERNAME }}
194+
password: ${{ secrets.UNITY_PASSWORD }}
195+
serial_ids: ${{ secrets.SERIAL_ID }}
253196
- name: Prepare for integration tests
254197
timeout-minutes: 10
255198
shell: bash
@@ -275,28 +218,21 @@ jobs:
275218
fi
276219
python scripts/gha/build_testapps.py \
277220
--t ${{ needs.check_and_prepare.outputs.apis }} \
278-
--u 2020.3.34f1 \
221+
--u ${{ env.UNITY_VERSION }} \
279222
--p "${{ matrix.platform }}" \
280223
--ios_sdk "${{ matrix.ios_sdk }}" \
281224
--plugin_dir ~/Downloads/firebase_unity_sdk \
282225
--output_directory "${{ github.workspace }}" \
283226
--artifact_name "${{ steps.matrix_info.outputs.info }}" \
284227
--force_latest_runtime \
285228
--ci
286-
287229
- name: Return Unity license
230+
# Always returns true, even when job failed or canceled. But will not run when a critical failure prevents the task from running.
288231
if: always()
289-
uses: nick-invision/retry@v2
232+
uses: ./gha/unity
290233
with:
291-
timeout_minutes: 5
292-
max_attempts: 2
293-
shell: bash
294-
command: |
295-
python gha/unity/unity_installer.py --release_license \
296-
--version 2020 \
297-
--logfile "testapps/release_license.log"
298-
cat testapps/release_license.log
299-
234+
version: ${{ matrix.unity_version }}
235+
release_license: "true"
300236
- name: Prepare results summary artifact
301237
if: ${{ !cancelled() }}
302238
shell: bash
@@ -422,23 +358,15 @@ jobs:
422358
shell: bash
423359
run: |
424360
pip install -r scripts/gha/requirements.txt
425-
- name: Setup Unity
426-
uses: kuler90/setup-unity@v1
361+
- id: unity_setup
362+
uses: ./gha/unity
427363
timeout-minutes: 30
428364
with:
429-
unity-version: 2020.3.34f1
430-
# Install ios for the editor tools
431-
unity-modules: ios
432-
- name: Activate Unity license
433-
shell: bash
434-
run: |
435-
python gha/unity/unity_installer.py --activate_license \
436-
--version 2020 \
437-
--username "${{ secrets.UNITY_USERNAME }}" \
438-
--password "${{ secrets.UNITY_PASSWORD }}" \
439-
--serial_ids "${{ secrets.SERIAL_ID }}" \
440-
--logfile "testapps/activate_license.log"
441-
cat testapps/activate_license.log
365+
version: ${{ matrix.unity_version }}
366+
platforms: Playmode
367+
username: ${{ secrets.UNITY_USERNAME }}
368+
password: ${{ secrets.UNITY_PASSWORD }}
369+
serial_ids: ${{ secrets.SERIAL_ID }}
442370
- name: Prepare for integration tests
443371
timeout-minutes: 10
444372
shell: bash
@@ -462,25 +390,20 @@ jobs:
462390
fi
463391
python scripts/gha/build_testapps.py \
464392
--t ${{ needs.check_and_prepare.outputs.apis }} \
465-
--u 2020.3.34f1 \
393+
--u ${{ env.UNITY_VERSION }} \
466394
--p Playmode \
467395
--plugin_dir ~/Downloads/firebase_unity_sdk \
468396
--output_directory "${{ github.workspace }}" \
469397
--artifact_name "${{ steps.matrix_info.outputs.info }}" \
470398
--force_latest_runtime \
471399
--ci
472400
- name: Return Unity license
401+
# Always returns true, even when job failed or canceled. But will not run when a critical failure prevents the task from running.
473402
if: always()
474-
uses: nick-invision/retry@v2
403+
uses: ./gha/unity
475404
with:
476-
timeout_minutes: 5
477-
max_attempts: 2
478-
shell: bash
479-
command: |
480-
python gha/unity/unity_installer.py --release_license \
481-
--version 2020 \
482-
--logfile "testapps/release_license.log"
483-
cat testapps/release_license.log
405+
version: ${{ matrix.unity_version }}
406+
release_license: "true"
484407
- name: Prepare results summary artifact
485408
if: ${{ !cancelled() }}
486409
shell: bash
@@ -562,7 +485,7 @@ jobs:
562485
test_type: "game-loop"
563486
test_devices: ${{ matrix.device_detail }}
564487
- name: Read FTL Test Result
565-
if: ${{ matrix.device_type == 'real' }}
488+
if: ${{ matrix.device_type == 'real' && !cancelled() }}
566489
timeout-minutes: 60
567490
shell: bash
568491
run: |

gha/unity/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
## Output
1717

18-
This GitHub Action will provide `unity_version` (full unity version) output and `UNITY_ROOT_DIR` (Unity project directory) environment variable
18+
This GitHub Action will provide `UNITY_VERSION` (full unity version) and `UNITY_ROOT_DIR` (Unity project directory) environment variable
1919

2020
- Output usage:
2121
```yml
@@ -25,8 +25,8 @@ This GitHub Action will provide `unity_version` (full unity version) output and
2525
version: ${{ unity_version }}
2626
platforms: ${{ platforms }}
2727
- run: |
28-
echo '${{ steps.unity_setup.outputs.unity_version }}'
29-
echo '$UNITY_ROOT_DIR'
28+
echo '${{ env.UNITY_VERSION }}'
29+
echo '${{ env.UNITY_ROOT_DIR }}'
3030
```
3131
3232
## Usage
@@ -69,7 +69,7 @@ This GitHub Action will provide `unity_version` (full unity version) output and
6969
release_license: "true"
7070
```
7171
72-
## How to upgrade supported unity versions
72+
## [Deprecated] How to upgrade supported unity versions
7373
**Background**
7474
7575
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.

gha/unity/action.yml

Lines changed: 11 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ inputs:
2727
release_license:
2828
required: false
2929

30-
outputs:
31-
unity_version:
32-
value: ${{ steps.unity_installation.outputs.unity_version }}
33-
3430
runs:
3531
using: 'composite'
3632
steps:
@@ -46,40 +42,26 @@ runs:
4642
--version ${{ inputs.version }} \
4743
--logfile "testapps/release_license.log"
4844
cat testapps/release_license.log
49-
- name: Install Unity installer (U3D)
50-
if: inputs.release_license == ''
51-
uses: nick-invision/retry@v2
52-
with:
53-
timeout_minutes: 10
54-
max_attempts: 2
55-
shell: bash
56-
command: gem install u3d -v 1.2.3
57-
- name: Set the Unity Env
45+
- name: unity_setting
5846
if: inputs.release_license == ''
5947
shell: bash
6048
run: |
61-
echo "LC_ALL=en_US.UTF-8" >> $GITHUB_ENV
62-
echo "LANG=en_US.UTF-8" >> $GITHUB_ENV
63-
echo "U3D_PASSWORD=" >> $GITHUB_ENV
64-
echo "U3D_SKIP_UPDATE_CHECK=1" >> $GITHUB_ENV
65-
- name: Download Unity Fallback
66-
if: inputs.release_license == '' && startsWith(matrix.os, 'windows')
67-
shell: bash
68-
run: |
69-
mkdir -p ~/Downloads
70-
curl -L https://download.unity3d.com/download_unity/9a4c9c70452b/Windows64EditorInstaller/UnitySetup64.exe -o ~/Downloads/UnityInstaller.exe
71-
ls -l ~/Downloads/
72-
- id: unity_installation
73-
name: Install Unity
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
52+
- 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
7458
if: inputs.release_license == ''
7559
shell: bash
7660
run: |
7761
if [[ -n "${{ inputs.platforms }}" ]]; then
7862
additional_flags+=(--platforms ${{ inputs.platforms }})
7963
fi
80-
unity_info=$( python $GITHUB_ACTION_PATH/unity_installer.py --install --version ${{ inputs.version }} ${additional_flags[*]} )
81-
echo "UNITY_ROOT_DIR=$(cut -d',' -f2 <<< ${unity_info})" >> $GITHUB_ENV
82-
echo "unity_version=$(cut -d',' -f1 <<< ${unity_info})" >> $GITHUB_OUTPUT
64+
python $GITHUB_ACTION_PATH/unity_installer.py --install_modules --version ${{ inputs.version }} ${additional_flags[*]}
8365
- name: Activate Unity license
8466
if: inputs.release_license == '' && inputs.username != '' && inputs.password != '' && inputs.serial_ids != ''
8567
shell: bash

0 commit comments

Comments
 (0)