Skip to content

Commit 726b77f

Browse files
authored
ci: Update yamato templates (#401)
Our custom CI configuration started failing after a change in the upm-ci tool. This change updates the CI configuration to use the standard templates for multi-package repositories. As a side effect, it also introduces a test/sample/gym project where we can exercise the packages and put tests we don't want to ship with the packages themselves. Tests run against 2020.1 and trunk, on windows, mac, and ubuntu Pull Requests to "develop" automatically trigger pack, test, and validation of the mlapi package
1 parent ab93f0b commit 726b77f

45 files changed

Lines changed: 2503 additions & 119 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@ PublishScripts/
153153
*.nupkg
154154
# The packages folder can be ignored because of Package Restore
155155
**/packages/*
156+
# Except Unity testproject Packages
157+
!/testproject/Packages/**
156158
# except build/, which is used as an MSBuild target.
157159
!**/packages/build/
158160
# Uncomment if necessary however generally it will be regenerated when needed
@@ -184,7 +186,6 @@ _pkginfo.txt
184186
# Others
185187
ClientBin/
186188
~$*
187-
*~
188189
*.dbmdl
189190
*.dbproj.schemaview
190191
*.jfm
@@ -259,4 +260,7 @@ __pycache__/
259260
*.pyc
260261

261262
# Docs
262-
docs/LastBuild.log
263+
docs/LastBuild.log
264+
265+
# Unity Package Manager CI output
266+
upm-ci~

.yamato/project-pack.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% metadata_file .yamato/project.metafile %}
2+
---
3+
{% for project in projects -%}
4+
pack_{{ project.name }}:
5+
name: Pack {{ project.name }}
6+
agent:
7+
type: Unity::VM
8+
image: package-ci/ubuntu:stable
9+
flavor: b1.small
10+
commands:
11+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
12+
- upm-ci project pack --project-path {{ project.path }}
13+
artifacts:
14+
packages:
15+
paths:
16+
- "upm-ci~/packages/**/*"
17+
{% endfor -%}

.yamato/project-promotion.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{% metadata_file .yamato/project.metafile %}
2+
---
3+
{% for project in projects -%}
4+
{% for package in project.packages -%}
5+
# Validation job for package {{ package.name }}, only using the first entry in the
6+
# platform and editor meta data
7+
promotion_validate_{{ project.name }}_{{ package.name }}_{{ test_platforms.first.name }}_{{ test_editors.first }}:
8+
name : Validate Project {{ project.name }} - Package {{ package.name }} - {{ test_editors.first }} on {{ test_platforms.first.name }}
9+
agent:
10+
type: {{ test_platforms.first.type }}
11+
image: {{ test_platforms.first.image }}
12+
flavor: {{ test_platforms.first.flavor}}
13+
variables:
14+
UPMCI_PROMOTION: 1
15+
commands:
16+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
17+
- upm-ci project test -u {{ test_editors.first }} --project-path {{ project.path }} --type vetting-tests --package-filter {{ package.name }}
18+
artifacts:
19+
logs:
20+
paths:
21+
- "upm-ci~/test-results/**/*"
22+
dependencies:
23+
- .yamato/project-pack.yml#pack_{{ project.name }}
24+
25+
promote_{{ project.name }}_{{ package.name }}:
26+
name: Promote Project {{ project.name }} - Package {{ package.name }} to Production
27+
agent:
28+
type: Unity::VM
29+
image: package-ci/win10:stable
30+
flavor: b1.small
31+
variables:
32+
UPMCI_PROMOTION: 1
33+
commands:
34+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
35+
- upm-ci package promote --package-path {{ package.path }}
36+
artifacts:
37+
artifacts:
38+
paths:
39+
- "upm-ci~/packages/*.tgz"
40+
dependencies:
41+
- .yamato/project-pack.yml#pack_{{ project.name }}
42+
- .yamato/project-promotion.yml#promotion_validate_{{ project.name }}_{{ package.name }}_{{ test_platforms.first.name }}_{{ test_editors.first }}
43+
44+
{% endfor -%}
45+
46+
promote_{{ project.name }}:
47+
name: Promote ALL {{ project.name }} packages to Production
48+
agent:
49+
type: Unity::VM
50+
image: package-ci/win10:stable
51+
flavor: b1.small
52+
variables:
53+
UPMCI_PROMOTION: 1
54+
commands:
55+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
56+
- upm-ci project promote --project-path {{ project.path }}
57+
artifacts:
58+
artifacts:
59+
paths:
60+
- "upm-ci~/packages/*.tgz"
61+
dependencies:
62+
- .yamato/project-pack.yml#pack_{{ project.name }}
63+
{% for package in packages -%}
64+
- .yamato/project-promotion.yml#promotion_validate_{{ package.name }}_{{ test_platforms.first.name }}_{{ test_editors.first }}
65+
{% endfor -%}
66+
{% endfor -%}

.yamato/project-publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{% metadata_file .yamato/project.metafile %}
2+
---
3+
{% for project in projects -%}
4+
{% for package in project.packages -%}
5+
publish_{{ project.name }}_{{ package.name }}:
6+
name: Publish Project {{project.name }} - Package {{ package.name }} to Internal Registry
7+
agent:
8+
type: Unity::VM
9+
image: package-ci/win10:stable
10+
flavor: b1.large
11+
commands:
12+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
13+
- upm-ci package publish --package-path {{ package.path }} --dry-run
14+
artifacts:
15+
artifacts:
16+
paths:
17+
- "upm-ci~/packages/*.tgz"
18+
dependencies:
19+
- .yamato/project-pack.yml#pack_{{ project.name }}
20+
- .yamato/project-test.yml#validate_{{ project.name }}_{{ package.name }}_{{ test_platforms.first.name }}_{{ test_editors.first }}
21+
{% for editor in test_editors -%}
22+
{% for platform in test_platforms -%}
23+
- .yamato/project-test.yml#test_{{ project.name }}_{{ package.name }}_{{ platform.name }}_{{ editor }}
24+
{% endfor -%}
25+
{% endfor -%}
26+
27+
{% endfor -%}
28+
29+
publish_{{ project.name }}:
30+
name: Publish ALL {{ project.name }} packages to Internal Registry
31+
agent:
32+
type: Unity::VM
33+
image: package-ci/win10:stable
34+
flavor: b1.large
35+
commands:
36+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
37+
- upm-ci project publish --project-path {{ project.path }}
38+
artifacts:
39+
artifacts:
40+
paths:
41+
- "upm-ci~/packages/*.tgz"
42+
dependencies:
43+
- .yamato/project-pack.yml#pack_{{ project.name }}
44+
- .yamato/project-test.yml#all_tests_trigger
45+
46+
{% endfor -%}

.yamato/project-test.yml

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
{% metadata_file .yamato/project.metafile %}
2+
---
3+
# Go through all platforms, editors and packages in the metadata
4+
# to generate its independent package tests and validation tests.
5+
# The idea is to only run validation once per package and not mix.
6+
# the results with package tests
7+
{% for package in projects.first.packages -%}
8+
{% for editor in test_editors -%}
9+
{% for platform in test_platforms -%}
10+
test_{{ projects.first.name}}_{{ package.name }}_{{ platform.name }}_{{ editor }}:
11+
name : Test Project {{ projects.first.name }} - Package {{ package.name }} - {{ editor }} on {{ platform.name }}
12+
agent:
13+
type: {{ platform.type }}
14+
image: {{ platform.image }}
15+
flavor: {{ platform.flavor}}
16+
commands:
17+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
18+
- {% if platform.name == "centos" %}DISPLAY=:0 {% endif %}upm-ci project test -u {{ editor }} --project-path {{ projects.first.path }} --type package-tests --package-filter {{ package.name }}
19+
artifacts:
20+
logs:
21+
paths:
22+
- "upm-ci~/test-results/**/*"
23+
dependencies:
24+
- .yamato/project-pack.yml#pack_{{ projects.first.name }}
25+
26+
{% endfor -%}
27+
{% endfor -%}
28+
29+
# Validation job for package {{ package.name }}, only using the first entry in the
30+
# platform and editor meta data
31+
# Validation only occurs in editmode.
32+
validate_{{ projects.first.name }}_{{ package.name }}_{{ test_platforms.first.name }}_{{ test_editors.first }}:
33+
name : Validate Project {{ projects.first.name }} - Package {{ package.name }} - {{ test_editors.first }} on {{ test_platforms.first.name }}
34+
agent:
35+
type: {{ test_platforms.first.type }}
36+
image: {{ test_platforms.first.image }}
37+
flavor: {{ test_platforms.first.flavor}}
38+
commands:
39+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
40+
- {% if platform.name == "centos" %}DISPLAY=:0 {% endif %}upm-ci project test -u {{ test_editors.first }} --project-path {{ projects.first.path }} --type vetting-tests --package-filter {{ package.name }} --platform editmode
41+
artifacts:
42+
logs:
43+
paths:
44+
- "upm-ci~/test-results/**/*"
45+
dependencies:
46+
- .yamato/project-pack.yml#pack_{{ projects.first.name }}
47+
{% endfor -%}
48+
49+
# For every platform and editor version, run its project tests without
50+
# running package tests too since they are handled on their respective
51+
# jobs
52+
{% for project in projects -%}
53+
{% for editor in test_editors -%}
54+
{% for platform in test_platforms -%}
55+
test_{{ project.name }}_{{ editor }}_{{ platform.name }}:
56+
name : Test Project {{ project.name }} - {{ editor }} on {{ platform.name }}
57+
agent:
58+
type: {{ platform.type }}
59+
image: {{ platform.image }}
60+
flavor: {{ platform.flavor}}
61+
commands:
62+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
63+
- {% if platform.name == "centos" %}DISPLAY=:0 {% endif %}upm-ci project test -u {{ editor }} --project-path {{ project.path }} --type project-tests
64+
artifacts:
65+
logs:
66+
paths:
67+
- "upm-ci~/test-results/**/*"
68+
dependencies:
69+
- .yamato/project-pack.yml#pack_{{ project.name }}
70+
71+
{% endfor -%}
72+
{% endfor -%}
73+
{% endfor -%}
74+
75+
# Currently, we need to have a trigger to updated badges
76+
# Only package badges currently exist
77+
badges_test_trigger:
78+
name: Badges Tests Trigger
79+
agent:
80+
type: Unity::VM
81+
image: package-ci/ubuntu:stable
82+
flavor: b1.small
83+
commands:
84+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
85+
- upm-ci package izon -t
86+
artifacts:
87+
logs:
88+
paths:
89+
- "upm-ci~/test-results/**/*"
90+
packages:
91+
paths:
92+
- "upm-ci~/packages/**/*"
93+
dependencies:
94+
{% for project in projects -%}
95+
{% for package in projects.first.packages -%}
96+
- .yamato/project-test.yml#validate_{{ projects.first.name }}_{{ package.name }}_{{ test_platforms.first.name }}_{{ test_editors.first }}
97+
{% for editor in test_editors -%}
98+
{% for platform in test_platforms -%}
99+
- .yamato/project-test.yml#test_{{ projects.first.name }}_{{ package.name }}_{{ platform.name }}_{{ editor }}
100+
{% endfor -%}
101+
{% endfor -%}
102+
{% endfor -%}
103+
{% endfor -%}
104+
105+
all_tests_trigger:
106+
name: Repository Tests Trigger
107+
dependencies:
108+
# Pull in package and validate jobs through the badges job
109+
- .yamato/project-test.yml#badges_test_trigger
110+
{% for editor in test_editors -%}
111+
{% for platform in test_platforms -%}
112+
{% for project in projects -%}
113+
- .yamato/project-test.yml#test_{{ project.name }}_{{ editor }}_{{ platform.name }}
114+
{% endfor -%}
115+
{% endfor -%}
116+
{% endfor -%}
117+
118+
# Run all relevant tasks when a pull request targeting the develop
119+
# branch is created or updated. Currently only mlapi package tests are
120+
# enabled, since the others are missing test coverage and will fail CI.
121+
develop_pull_request_trigger:
122+
name: Develop Branch Triggers
123+
dependencies:
124+
- .yamato/project-test.yml#validate_{{ projects.first.name }}_com.unity.multiplayer.mlapi_{{ test_platforms.first.name }}_{{ test_editors.first }}
125+
{% for editor in test_editors -%}
126+
{% for platform in test_platforms -%}
127+
- .yamato/project-test.yml#test_{{ projects.first.name }}_com.unity.multiplayer.mlapi_{{ platform.name }}_{{ editor }}
128+
{% endfor -%}
129+
{% endfor -%}
130+
triggers:
131+
cancel_old_ci: true
132+
pull_requests:
133+
- targets:
134+
only:
135+
- "develop"
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{% metadata_file .yamato/project.metafile %}
2+
---
3+
# Go through all platforms, editors and packages in the metadata
4+
# to generate its independent package tests and validation tests.
5+
# The idea is to only run validation once per package and not mix.
6+
# the results with package tests
7+
{% for package in projects.first.packages -%}
8+
{% for editor in test_editors -%}
9+
{% for platform in test_platforms -%}
10+
dependency_{{ projects.first.name }}_{{ package.name }}_{{ platform.name }}_{{ editor }}:
11+
name : Dependency Test of Project {{ projects.first.name }} - Package {{ package.name }} - {{ editor }} on {{ platform.name }}
12+
agent:
13+
type: {{ platform.type }}
14+
image: {{ platform.image }}
15+
flavor: {{ platform.flavor}}
16+
commands:
17+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
18+
- upm-ci project test -u {{ editor }} --project-path {{ projects.first.path }} --type updated-dependencies-tests --package-filter {{ package.name }}
19+
artifacts:
20+
logs:
21+
paths:
22+
- "upm-ci~/test-results/**/*"
23+
triggers:
24+
recurring:
25+
- branch: master
26+
frequency: 20 * * ?
27+
dependencies:
28+
- path: .yamato/project-pack.yml#pack_{{ projects.first.name }}
29+
rerun: always
30+
31+
{% endfor -%}
32+
{% endfor -%}
33+
{% endfor -%}
34+
35+
dependency_test_trigger_{{ projects.first.name }}:
36+
name: Project {{ projects.first.name }} Dependency Tests Trigger
37+
agent:
38+
type: Unity::VM
39+
image: package-ci/ubuntu:stable
40+
flavor: b1.small
41+
commands:
42+
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
43+
- upm-ci project izon -d --project-path {{ projects.first.path }}
44+
artifacts:
45+
logs:
46+
paths:
47+
- "upm-ci~/test-results/**/*"
48+
triggers:
49+
recurring:
50+
- branch: master
51+
frequency: 22 * * ?
52+
dependencies:
53+
{% for package in projects.first.packages -%}
54+
{% for editor in test_editors -%}
55+
{% for platform in test_platforms -%}
56+
- .yamato/project-updated-dependencies-test.yml#dependency_{{ projects.first.name }}_{{ package.name }}_{{ platform.name }}_{{ editor }}
57+
{% endfor -%}
58+
{% endfor -%}
59+
{% endfor -%}

.yamato/project.metafile

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Editors where tests will happen. The first entry of this array is also used
2+
# for validation
3+
test_editors:
4+
- 2020.1
5+
- trunk
6+
7+
# Platforms that will be tested. The first entry in this array will also
8+
# be used for validation
9+
test_platforms:
10+
- name: win
11+
type: Unity::VM
12+
image: package-ci/win10:stable
13+
flavor: b1.large
14+
- name: mac
15+
type: Unity::VM::osx
16+
image: package-ci/mac:stable
17+
flavor: m1.mac
18+
- name: ubuntu
19+
type: Unity::VM
20+
image: package-ci/ubuntu:stable
21+
flavor: b1.large
22+
23+
# Projects within the repository that will be tested. Name will be used
24+
# for job ids, so it should not contain spaces/non-supported characters
25+
projects:
26+
- name: project
27+
path: testproject
28+
# Packages within a project that will be tested
29+
packages:
30+
- name: com.unity.multiplayer.mlapi
31+
path: com.unity.multiplayer.mlapi
32+
- name: com.unity.multiplayer.transport.enet
33+
name: com.unity.multiplayer.transport.enet
34+
- name: com.unity.multiplayer.transport.utp
35+
path: com.unity.multiplayer.transport.utp

0 commit comments

Comments
 (0)