Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport AcademyStepper fix in #4532 to verified branch #4637

Merged
merged 6 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/setup-python@v2
with:
python-version: 3.7.x
- uses: actions/setup-ruby@v1
with:
ruby-version: '2.6'
Expand Down
11 changes: 9 additions & 2 deletions .yamato/com.unity.ml-agents-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,25 @@ test_editors:
# 2018.4 doesn't support code-coverage
coverageOptions:
minCoveragePct: 0
# We want some scene tests to run in the DevProject, but packages there only support 2019+
testProject: Project
- version: 2019.3
coverageOptions: --enable-code-coverage --code-coverage-options 'generateHtmlReport;assemblyFilters:+Unity.ML-Agents'
minCoveragePct: 72
testProject: DevProject
- version: 2020.1
coverageOptions: --enable-code-coverage --code-coverage-options 'generateHtmlReport;assemblyFilters:+Unity.ML-Agents'
minCoveragePct: 72
testProject: DevProject
- version: 2020.2
coverageOptions: --enable-code-coverage --code-coverage-options 'generateHtmlReport;assemblyFilters:+Unity.ML-Agents'
minCoveragePct: 72
testProject: DevProject
trunk_editor:
- version: trunk
coverageOptions: --enable-code-coverage --code-coverage-options 'generateHtmlReport;assemblyFilters:+Unity.ML-Agents'
minCoveragePct: 72
testProject: DevProject
test_platforms:
- name: win
type: Unity::VM
Expand Down Expand Up @@ -61,7 +67,7 @@ test_{{ platform.name }}_{{ editor.version }}:
flavor: {{ platform.flavor}}
commands:
- npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm
- upm-ci package test -u {{ editor.version }} --package-path com.unity.ml-agents {{ editor.coverageOptions }}
- upm-ci project test -u {{ editor.version }} --project-path {{ editor.testProject }} {{ editor.coverageOptions }} --extra-utr-arg "reruncount=2"
- python3 ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ editor.minCoveragePct }}
artifacts:
logs:
Expand All @@ -75,6 +81,7 @@ test_{{ platform.name }}_{{ editor.version }}:
changes:
only:
- "com.unity.ml-agents/**"
- "{{ editor.testProject }}/**"
- "ml-agents/tests/yamato/**"
- ".yamato/com.unity.ml-agents-test.yml"
{% endif %}
Expand All @@ -96,7 +103,7 @@ test_{{ platform.name }}_trunk:
{% if platform.name == "win" %}
- upm-ci package test -u "C:\build\output\Unity-Technologies\ml-agents\.Editor" --package-path com.unity.ml-agents {{ editor.coverageOptions }}
{% else %}
- upm-ci package test -u {{ editor.version }} --package-path com.unity.ml-agents {{ editor.coverageOptions }}
- upm-ci project test -u {{ editor.version }} --project-path {{ editor.testProject }} {{ editor.coverageOptions }} --extra-utr-arg "reruncount=2"
{% endif %}
- python3 ml-agents/tests/yamato/check_coverage_percent.py upm-ci~/test-results/ {{ editor.minCoveragePct }}
artifacts:
Expand Down
8 changes: 8 additions & 0 deletions DevProject/Assets/ML-Agents.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions DevProject/Assets/ML-Agents/Scripts.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions DevProject/Assets/ML-Agents/Scripts/Tests.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions DevProject/Assets/ML-Agents/Scripts/Tests/Runtime.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections;
using NUnit.Framework;
using UnityEngine.TestTools;
using UnityEngine;
using UnityEngine.SceneManagement;
using Unity.MLAgents;
#if UNITY_EDITOR
using UnityEditor.SceneManagement;
#endif

namespace Tests
{
public class AcademyStepperTest
{
[SetUp]
public void Setup()
{
SceneManager.LoadScene("ML-Agents/Scripts/Tests/Runtime/AcademyTest/AcademyStepperTestScene");
}

/// <summary>
/// Verify in each update, the Academy is only stepped once.
/// </summary>
[UnityTest]
public IEnumerator AcademyStepperCleanupPasses()
{
var academy = Academy.Instance;
int initStepCount = academy.TotalStepCount;
for (var i = 0; i < 5; i++)
{
yield return new WaitForFixedUpdate();
Assert.True(academy.TotalStepCount - initStepCount == i + 1);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading