-
Notifications
You must be signed in to change notification settings - Fork 459
Expand file tree
/
Copy pathproject-builders.yml
More file actions
85 lines (69 loc) · 6.58 KB
/
project-builders.yml
File metadata and controls
85 lines (69 loc) · 6.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{% metadata_file .yamato/project-builders/builder.metafile %}
---
# The above line corresponds to https://internaldocs.unity.com/yamato_continuous_integration/usage/templating/
# Yamato paths disclaimer:
# Note that artifacts can get only local paths and since cloned project is in different location, you need to be careful with paths
# All artifact paths are defined relative to the Yamato source directory (YAMATO_SOURCE_DIR) and are case-sensitive.
# !!! important “Artifact directory locations” All artifact globs are defined relative to the source directory (YAMATO_SOURCE_DIR). Yamato can’t capture artifacts from outside this directory, so if you need files from elsewhere, you should copy them into your source directory as part of job commands.
# Those jobs were created in order to (in most cases) speed up playtesting and development time.
# The aim is to collect all possible projects that use Netcode for Entities and create a job that will build the project with the given version of N4E package.
# The package is taken directly from the branch from which the job was triggered. So image triggering the job from release/2.0.0 and release/2.1.0 branch to compare differences
# Example use case would be to trigger the build job on Sunday so by Monday morning all builds are ready for playtesting. This limits the time a dev/QA has to spend building projects for different configurations (win, mac, Android, scripting backends, burst etc) or simply time necessary for building huge projects (Megacity).
# This job takes parameters as scriptable backend configuration, burst compilation, unity editor version and platform.
# Since Yamato variables can't be restricted to only specific values, the job will validate the parameters passed to it and fail quickly if those are incorrect. In order to see what options are available, please look at the variable name.
# Note that for now all of those builds are being made on Windows machine (so for example combination of macOS + il2cpp is expected to fail)
# TODO: for now all builds are being made on Windows machine, but it would be nice to have a Mac build as well.
# TODO: add iOS support
{% for buildProject in BuildProjects -%}
build_{{ buildProject[0] }}_project:
name: {{ buildProject[0] }}
agent:
type: Unity::VM
image: package-ci/win10:v4
flavor: b1.xlarge
variables:
UNITY_VERSION: {{ buildProject[1].minUnityVersion }}
SCRIPTING_BACKEND_IL2CPP_MONO: il2cpp
BURST_ON_OFF: on
PLATFORM_WIN64_MAC_ANDROID: win64
SAMPLE_BRANCH: {{ buildProject[1].defaultBranch }}
commands:
- echo Building {{ buildProject[0] }} project from branch %SAMPLE_BRANCH% with Unity version of %UNITY_VERSION%, Scripting backend %SCRIPTING_BACKEND_IL2CPP_MONO%, Burst %BURST_ON_OFF% for platform %PLATFORM_WIN64_MAC_ANDROID%
# Validate inputs passed via Yamato variables
- python Tools/scripts/BuildAutomation/validate_params.py
# Clone the external project repository into a specific directory. Notice that branch is also specified.
- git clone --single-branch --branch %SAMPLE_BRANCH% {{ buildProject[1].GithubRepo }} {{ ClonedProjectRoot }}
# Replace file: references in the manifest with latest released versions from Unity Package Vision API.
# This replaces the need for maintaining separate release-manifest.json files in each project.
- python Tools/scripts/BuildAutomation/resolve_file_references.py --manifest-path C:/ClonedProject/{{ buildProject[1].manifestPath }}
# Modify the external project's manifest to use the local N4E package from current branch on which this Yamato job is running. (requires python that should be preinstalled in the image)
- python Tools/scripts/BuildAutomation/manifest_update.py --manifest-path {{ ClonedProjectRoot }}/{{ buildProject[1].manifestPath }} --package-name {{ buildProject[1].localPackageName }} --local-package-path %YAMATO_SOURCE_DIR%/{{ buildProject[1].localPackagePath }}{% if buildProject[1].remove %} --remove-folder {{ buildProject[1].remove }}{% endif %} --cloned-project-root {{ ClonedProjectRoot }}
# Run python script to update ProjectSettings.asset in order to connect the project to Unity Services/set proper values.
# Notice that if a project has this already set up then in theory we don't need to run this script.
- python Tools/scripts/BuildAutomation/connect_services.py --project-settings-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }}/ProjectSettings/ProjectSettings.asset
# Enable or disable Burst compilation. This step is specific to Netcode package (or any package that uses Burst)
- IF "%BURST_ON_OFF%"=="on" (python Tools/scripts/BuildAutomation/disable-enable-burst.py --enable-burst --project-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }})
ELSE (python Tools/scripts/BuildAutomation/disable-enable-burst.py --disable-burst --project-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }})
# Download the Unity Editor version specified in the UNITY_VERSION variable. Il2cpp component is downloaded only if the SCRIPTING_BACKEND_IL2CPP_MONO is set to "il2cpp".
# TODO: we could download components only if needed
- unity-downloader-cli --fast --wait -u %UNITY_VERSION% -p C:/TestingEditor -c Editor -c il2cpp -c Android -c macOS
# Add BuilderScript.cs to the project so we can modify and build the project using Unity Editor.
# This requires proper assembly definition in order for those scripts to compile properly.
- python Tools/scripts/BuildAutomation/setup_build_scripts.py --project-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }} --source-dir %YAMATO_SOURCE_DIR%
# Build the project using Unity Editor. This calls the appropriate static BuilderScripts method.
- python Tools/scripts/BuildAutomation/get_build_method.py --project-path {{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }}
# Print manifest dependencies after Unity Editor has processed the manifest to verify package overrides.
- python Tools/scripts/BuildAutomation/print_manifest_info.py --manifest-path {{ ClonedProjectRoot }}/{{ buildProject[1].manifestPath }}
# Copy build artifacts to source directory for Yamato artifact collection.
# TODO: This can be omitted if building directly in YAMATO_SOURCE_DIR instead of ClonedProjectRoot
- python -c "import os, shutil; os.makedirs('./build', exist_ok=True); shutil.copytree('{{ ClonedProjectRoot }}/{{ buildProject[1].projectPath }}/build', './build', dirs_exist_ok=True)"
artifacts:
logs:
paths:
- '*.log'
- '*.xml'
- artifacts/**/*
players:
paths:
- build/**/*
{% endfor -%}