Skip to content

Commit a00abdf

Browse files
unity-setup@v3.0.0 (#60)
- update unity-cli@v4.1.0 - install editors with the official unity cli instead of unity hub - add `unity-cli-version`, `channels` and `allow-security-alert` inputs - add `steps.[id].outputs` - `unity-cli-path`: The file path to the official unity cli - `unity-cli-version`: The installed official unity cli version - replace `UNITY_HUB_PATH` with `UNITY_CLI_PATH` - remove `unity-hub-path` output and `auto-update-hub` and `hub-version` inputs - install linux editor dependencies for cached installations - mark transient failures for reruns - add v2 upgrade notes to README.md - bump deps - update build-options validation tests
1 parent 30fcbcb commit a00abdf

15 files changed

Lines changed: 5907 additions & 22608 deletions
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"os": [
3+
"ubuntu-latest",
4+
"windows-latest",
5+
"macos-latest"
6+
],
7+
"unity-version": [
8+
"4.7.2",
9+
"5.6.7f1 (e80cc3114ac1)",
10+
"2017.4.40f1",
11+
"2018",
12+
"2019.x",
13+
"2020.*",
14+
"2021.3.x",
15+
"2022.3.*"
16+
],
17+
"include": [
18+
{
19+
"os": "ubuntu-latest",
20+
"build-targets": "StandaloneLinux64, Android, WebGL",
21+
"modules": "linux-server"
22+
},
23+
{
24+
"os": "windows-latest",
25+
"build-targets": "StandaloneWindows64, Android, WSAPlayer",
26+
"modules": "windows-server"
27+
},
28+
{
29+
"os": "macos-latest",
30+
"build-targets": "StandaloneOSX Android iOS VisionOS",
31+
"modules": "mac-server"
32+
},
33+
{
34+
"os": "windows-latest",
35+
"unity-version": "4.7.2",
36+
"build-targets": "None",
37+
"modules": "None"
38+
},
39+
{
40+
"os": "macos-latest",
41+
"unity-version": "4.7.2",
42+
"build-targets": "None",
43+
"modules": "None"
44+
}
45+
],
46+
"exclude": [
47+
{
48+
"os": "ubuntu-latest",
49+
"unity-version": "5.6.7f1 (e80cc3114ac1)"
50+
},
51+
{
52+
"os": "ubuntu-latest",
53+
"unity-version": "4.7.2"
54+
},
55+
{
56+
"os": "windows-latest",
57+
"unity-version": "4.7.2",
58+
"build-targets": "StandaloneWindows64, Android, WSAPlayer",
59+
"modules": "windows-server"
60+
},
61+
{
62+
"os": "macos-latest",
63+
"unity-version": "4.7.2",
64+
"build-targets": "StandaloneOSX Android iOS VisionOS",
65+
"modules": "mac-server"
66+
}
67+
]
68+
}

‎.github/workflows/build-options.json‎

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@
55
"macos-latest"
66
],
77
"unity-version": [
8-
"None",
9-
"4.7.2",
10-
"5.6.7f1 (e80cc3114ac1)",
11-
"2017.4.40f1",
12-
"2018",
13-
"2019.x",
14-
"2020.*",
15-
"2021.3.x",
16-
"2022.3.*",
17-
"6000.0.x",
18-
"6000.1.*",
8+
"6000.0",
9+
"6000.1",
1910
"6000.2",
2011
"6000.3",
2112
"6000.4",
@@ -52,45 +43,5 @@
5243
"build-targets": "None",
5344
"modules": "None"
5445
}
55-
],
56-
"exclude": [
57-
{
58-
"os": "ubuntu-latest",
59-
"unity-version": "None",
60-
"build-targets": "StandaloneLinux64, Android, WebGL",
61-
"modules": "linux-server"
62-
},
63-
{
64-
"os": "windows-latest",
65-
"unity-version": "None",
66-
"build-targets": "StandaloneWindows64, Android, WSAPlayer",
67-
"modules": "windows-server"
68-
},
69-
{
70-
"os": "macos-latest",
71-
"unity-version": "None",
72-
"build-targets": "StandaloneOSX Android iOS VisionOS",
73-
"modules": "mac-server"
74-
},
75-
{
76-
"os": "ubuntu-latest",
77-
"unity-version": "5.6.7f1 (e80cc3114ac1)"
78-
},
79-
{
80-
"os": "ubuntu-latest",
81-
"unity-version": "4.7.2"
82-
},
83-
{
84-
"os": "windows-latest",
85-
"unity-version": "4.7.2",
86-
"build-targets": "StandaloneWindows64, Android, WSAPlayer",
87-
"modules": "windows-server"
88-
},
89-
{
90-
"os": "macos-latest",
91-
"unity-version": "4.7.2",
92-
"build-targets": "StandaloneOSX Android iOS VisionOS",
93-
"modules": "mac-server"
94-
}
9546
]
96-
}
47+
}

‎.github/workflows/build.yml‎

Lines changed: 68 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,42 +7,98 @@ on:
77
matrix:
88
required: true
99
type: string
10+
allow-security-alert:
11+
required: false
12+
type: boolean
13+
default: false
1014
jobs:
1115
build:
1216
name: ${{ matrix.name }}
1317
runs-on: ${{ matrix.os }}
1418
strategy:
1519
matrix: ${{ fromJSON(inputs.matrix) }}
1620
fail-fast: false
17-
timeout-minutes: 30
21+
# a hung download must not hold the matrix; rows that install the Android module and its SDK get more
22+
timeout-minutes: ${{ contains(matrix.build-targets, 'Android') && 60 || 45 }}
23+
defaults:
24+
run:
25+
shell: bash
1826
env:
1927
UNITY_EDITORS: '' # set by the unity-setup action
20-
UNITY_HUB_PATH: '' # set by the unity-setup action
28+
UNITY_CLI_PATH: '' # set by the unity-setup action
2129
UNITY_EDITOR_PATH: '' # set by the unity-setup action
2230
UNITY_PROJECT_PATH: '' # set by the unity-setup action
2331
steps:
32+
# runs alongside checkout; the wait before the editor packages joins it
2433
- name: Free Disk Space
34+
id: free-disk-space
35+
background: true
2536
if: ${{ matrix.os == 'ubuntu-latest' && (matrix.unity-version != '2018' && matrix.unity-version != '2017.4.40f1') }}
26-
uses: endersonmenezes/free-disk-space@7901478139cff6e9d44df5972fd8ab8fcade4db1 # v3.2.2
37+
uses: endersonmenezes/free-disk-space@8b8cd4e2277836962939a8f3b4ea0ee4bc006156 # v4.0.1
2738
with:
2839
remove_android: true
2940
remove_dotnet: false
3041
remove_tool_cache: false
31-
- uses: actions/checkout@v6
42+
- uses: actions/checkout@v7
43+
- name: Wait for Free Disk Space
44+
wait: free-disk-space
45+
# the editor's apt packages come from a mirror that has served them at about 40 kB/s, so the .deb files are kept
46+
# in the Actions cache: an apt hook copies every package dpkg installs, and a later run puts them back into apt's
47+
# archive before unity-setup, so apt finds them already downloaded
48+
- name: Restore Linux editor packages
49+
id: linux-packages
50+
if: ${{ runner.os == 'Linux' && matrix.unity-version != 'None' }}
51+
run: |
52+
echo "key=unity-linux-packages-${ImageOS}-${ImageVersion}" >> "$GITHUB_OUTPUT"
53+
echo "restore-key=unity-linux-packages-${ImageOS}-" >> "$GITHUB_OUTPUT"
54+
mkdir -p "${RUNNER_TEMP}/apt-packages"
55+
echo "DPkg::Pre-Install-Pkgs {\"xargs -r cp -n -t ${RUNNER_TEMP}/apt-packages/ || true\";};" | sudo tee /etc/apt/apt.conf.d/99unity-setup-keep-packages > /dev/null
56+
- uses: actions/cache/restore@v6
57+
id: linux-packages-cache
58+
if: ${{ steps.linux-packages.outcome == 'success' }}
59+
with:
60+
path: ${{ runner.temp }}/apt-packages
61+
key: ${{ steps.linux-packages.outputs.key }}
62+
restore-keys: ${{ steps.linux-packages.outputs.restore-key }}
63+
- name: Seed apt with cached packages
64+
if: ${{ steps.linux-packages-cache.outputs.cache-matched-key != '' }}
65+
run: |
66+
count=$(find "${RUNNER_TEMP}/apt-packages" -maxdepth 1 -name '*.deb' | wc -l | tr -d ' ')
67+
echo "Restored ${count} cached packages"
68+
if [ "${count}" -gt 0 ]; then
69+
sudo cp -n "${RUNNER_TEMP}"/apt-packages/*.deb /var/cache/apt/archives/
70+
fi
3271
- uses: ./ # buildalon/unity-setup
3372
id: unity-setup
3473
with:
3574
version-file: None
3675
unity-version: ${{ matrix.unity-version }}
3776
build-targets: ${{ matrix.build-targets }}
3877
modules: ${{ matrix.modules }}
39-
auto-update-hub: ${{ !contains(matrix.modules, 'None') }}
40-
hub-version: ${{ contains(matrix.modules, 'None') && '3.12.0' || '' }}
78+
# streams that only have betas or alphas so far resolve to those; a stable release wins once there is one
79+
channels: f,b,a
80+
allow-security-alert: ${{ inputs.allow-security-alert }}
81+
- name: Collect Linux editor packages
82+
id: linux-packages-collect
83+
if: ${{ steps.linux-packages.outcome == 'success' && steps.linux-packages-cache.outputs.cache-hit != 'true' }}
84+
run: |
85+
sudo chown -R "$(id -u):$(id -g)" "${RUNNER_TEMP}/apt-packages"
86+
count=$(find "${RUNNER_TEMP}/apt-packages" -maxdepth 1 -name '*.deb' | wc -l | tr -d ' ')
87+
echo "Collected ${count} packages"
88+
echo "count=${count}" >> "$GITHUB_OUTPUT"
89+
- uses: actions/cache/save@v6
90+
# rows run in parallel, so several may try the same key; the first save wins and the rest only warn
91+
if: ${{ steps.linux-packages-collect.outputs.count > 0 }}
92+
continue-on-error: true
93+
with:
94+
path: ${{ runner.temp }}/apt-packages
95+
key: ${{ steps.linux-packages.outputs.key }}
4196
- run: |
42-
ENV_UNITY_HUB_PATH="${{ env.UNITY_HUB_PATH }}"
43-
echo "env.UNITY_HUB_PATH: \"${ENV_UNITY_HUB_PATH}\""
44-
STEPS_UNITY_HUB_PATH="${{ steps.unity-setup.outputs.unity-hub-path }}"
45-
echo "steps.unity-setup.outputs.unity-hub-path: \"${STEPS_UNITY_HUB_PATH}\""
97+
ENV_UNITY_CLI_PATH="${{ env.UNITY_CLI_PATH }}"
98+
echo "env.UNITY_CLI_PATH: \"${ENV_UNITY_CLI_PATH}\""
99+
STEPS_UNITY_CLI_PATH="${{ steps.unity-setup.outputs.unity-cli-path }}"
100+
echo "steps.unity-setup.outputs.unity-cli-path: \"${STEPS_UNITY_CLI_PATH}\""
101+
"${ENV_UNITY_CLI_PATH}" --version
46102
ENV_UNITY_EDITORS='${{ env.UNITY_EDITORS }}' # single quotes to preserve JSON format and quotes from breaking the script
47103
# The json string is raw and not escaped, which breaks echoing it directly. Escape quotes for safe echoing.
48104
ENV_UNITY_EDITORS="${ENV_UNITY_EDITORS//\"/\\\"}"
@@ -61,8 +117,8 @@ jobs:
61117
echo "steps.unity-setup.outputs.unity-project-path: \"${STEPS_UNITY_PROJECT_PATH}\""
62118
63119
# validate both the env and output variables are the same
64-
if [[ "${ENV_UNITY_HUB_PATH}" != "${STEPS_UNITY_HUB_PATH}" ]]; then
65-
echo "Error: UNITY_HUB_PATH env and output do not match!"
120+
if [[ "${ENV_UNITY_CLI_PATH}" != "${STEPS_UNITY_CLI_PATH}" ]]; then
121+
echo "Error: UNITY_CLI_PATH env and output do not match!"
66122
exit 1
67123
fi
68124
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: rerun-validate
2+
# workflow_run only fires for workflow files on the default branch, so this starts working once it is merged to main
3+
on:
4+
workflow_run:
5+
workflows: [validate]
6+
types: [completed]
7+
jobs:
8+
rerun:
9+
if: github.event.workflow_run.conclusion == 'failure'
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 15
12+
permissions:
13+
actions: write # to rerun the failed jobs
14+
checks: read # to read the failed jobs' annotations
15+
steps:
16+
- uses: buildalon/retry-failed-jobs@v1
17+
with:
18+
markers: unity-license-exhausted,unity-transient-failure

‎.github/workflows/update-release-tags.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
permissions:
1010
contents: write
1111
steps:
12-
- uses: actions/checkout@v6
12+
- uses: actions/checkout@v7
1313
with:
1414
fetch-depth: 0
1515
- uses: RageAgainstThePixel/update-action-release-tags@v1

‎.github/workflows/validate.yml‎

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
name: validate
22
on:
33
schedule:
4-
- cron: '0 0 * * 0' # Run every Sunday at midnight
4+
- cron: '0 8 21 * *' # monthly: the older editors, which no longer change
55
push:
66
branches: [main]
77
pull_request:
88
branches: ['*']
99
types: [opened, synchronize, reopened, ready_for_review]
10-
# Allows you to run this workflow manually from the Actions tab
11-
workflow_dispatch:
10+
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
11+
inputs:
12+
editors:
13+
description: Which editors to test
14+
type: choice
15+
options: [unity-6-and-newer, legacy]
16+
default: unity-6-and-newer
1217
concurrency:
13-
group: ${{ github.workflow }}-${{ github.ref }}
18+
# the monthly legacy run gets its own group, so a push to main does not cancel it
19+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'schedule' && 'legacy' || inputs.editors || 'unity-6-and-newer' }}
1420
cancel-in-progress: true
1521
jobs:
1622
setup:
1723
if: github.event.pull_request.draft == false
18-
runs-on: ubuntu-slim
1924
permissions:
2025
contents: read
21-
steps:
22-
- uses: actions/checkout@v6
23-
with:
24-
sparse-checkout: .github/
25-
- uses: RageAgainstThePixel/job-builder@v1
26-
id: setup-jobs
27-
with:
28-
build-options: ./.github/workflows/build-options.json
29-
group-by: unity-version
30-
job-name-prefix: Install
31-
outputs:
32-
jobs: ${{ steps.setup-jobs.outputs.jobs }}
26+
# pull requests and pushes test the streams Unity lists; the older editors run monthly or on demand
27+
uses: RageAgainstThePixel/workflows/.github/workflows/unity-stream-matrix.yml@main
28+
with:
29+
legacy: ${{ inputs.editors == 'legacy' }}
30+
job-name-prefix: Install
3331
validate:
3432
if: ${{ needs.setup.outputs.jobs }}
3533
needs: setup
@@ -39,17 +37,18 @@ jobs:
3937
strategy:
4038
matrix: ${{ fromJSON(needs.setup.outputs.jobs) }}
4139
fail-fast: false
42-
max-parallel: 1
4340
secrets: inherit
4441
uses: ./.github/workflows/build.yml
4542
with:
4643
matrix: ${{ toJSON(matrix.jobs.matrix) }}
44+
allow-security-alert: ${{ needs.setup.outputs.allow-security-alert == 'true' }}
4745
timeline:
4846
needs: [setup, validate]
4947
if: always()
5048
runs-on: ubuntu-slim
49+
timeout-minutes: 5
5150
permissions:
5251
contents: read
5352
steps:
54-
- uses: Kesin11/actions-timeline@44c9c178ffb2fb1d9859614a3ffa79ccfb77565e # v3.1.0
53+
- uses: Kesin11/actions-timeline@460b1f8a750077029ad3589824d371b200e91dcf # v3.2.1
5554
continue-on-error: true

0 commit comments

Comments
 (0)