Skip to content

Commit

Permalink
Release v1.0.0-beta.4
Browse files Browse the repository at this point in the history
  • Loading branch information
operate-services-sdk-bot committed Apr 24, 2023
1 parent ef12dd4 commit 71db5ff
Show file tree
Hide file tree
Showing 200 changed files with 5,865 additions and 2,198 deletions.
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,29 @@ All notable changes to UGS CLI will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.0-beta.4] - 2023-04-24

### Added

- npm distribution. Install the CLI by running `npm install -g ugs`.
- new-file command for economy
- `ugs fetch` now supports cloud code scripts.
- Get player command in Player Module. Run `ugs player get -h` to show usage.
- List player command in Player Module. Run `ugs player list -h` to show usage.

### Changed

- **[Breaking Change]** CLI binary release assets are no longer zipped (use `chmod +x <path_to_executable>` on macos and linux to mark it as executable after downloading, or use `npm install -g ugs` to install).
- **[Breaking Change]** Replace Jint with Node.js for cloud code javascript parameter parsing. User will need to install Node.js with
version > 14.0.0 to parse cloud code javascript.
- Updated Diagnostics to use UnityAnalyticSender instead of TelemetrySender

### Fixed

- Cloud Code script with invalid parameter will fail to deploy and show in deploy result in failed catagory.
- Deploying Cloud Code C# Modules that are empty or over the size limit of 10 MB doesn't fail silently anymore.
- `ugs fetch` with `--reconcile` on empty folder with Remote Config contents now will not show `Object reference not set to an instance` error.

## [1.0.0-beta.3] - 2023-03-17

### Added
Expand All @@ -20,6 +43,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed

- Updated environment name validation to prevent using uppercase

- Documentation is now hosted on https://services.docs.unity.com/guides/ugs-cli/latest/general/overview
- Tweaked memory and cpu usage restrictions for Cloud Code parsing related commands

Expand All @@ -31,8 +55,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Deploy Module with `fetch` command to fetch files from all services that implement `IFetchService`
- Currently supports RemoteConfig only
- Command metrics tracking

### Changed

- Subcommands are now sorted in alphabetical order

### Fixed
Expand All @@ -45,6 +70,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
## [1.0.0-beta.1] - 2023-01-16

### Added

- CLI Core Module: Configuration, Service Account Authentication Commands.
- Cloud Code Service commands
- Deploy command supporting Cloud Code and Remote Config services.
Expand Down
4 changes: 2 additions & 2 deletions License.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Unity Gaming Services Command-line Interface (UGS CLI) copyright © 2022 Unity Technologies.

This software is subject to, and made available under, the terms of service for Unity Gaming Services Command-line Interface (UGS CLI)(see https://unity.com/legal). Your use of this software constitutes your acceptance of such terms.
This software is subject to, and made available under, the Unity Terms of Service (see https://unity.com/legal). Your use of this software constitutes your acceptance of such terms.

Unless expressly provided otherwise, the software under this license is made available strictly on an AS IS BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the terms of service for details on these and other terms and conditions.
Unless expressly provided otherwise, the software under this license is made available strictly on an "AS IS" BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the terms of service for details on these and other terms and conditions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ For installing the UGS CLI and getting started, see [Getting Started](https://se

The source code project is for reference only. You may not be able to build it due to lack of access to internal dependencies.

## Installation

### With npm
Install the CLI with npm by calling `npm install -g ugs` in your command line.

### With GitHub
Download the executable directly from the [GitHub releases](https://github.com/Unity-Technologies/unity-gaming-services-cli/releases).

On macos and linux, use `chmod +x <path_to_executable>` to mark the file as executable.

## Documentation
To see the full list of services and commands available in the UGS CLI, visit the documentation on https://services.docs.unity.com/guides/ugs-cli/latest/general/overview

Expand Down
21 changes: 0 additions & 21 deletions Third Party Notices.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,27 +183,6 @@ SOFTWARE.

<hr>

Component Name: Jint

License Type: BSD 2-Clause "Simplified" License

Copyright (c) 2013, Sebastien Ros
All rights reserved.

https://github.com/sebastienros/jint/blob/main/LICENSE.txt

BSD 2-Clause License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

<hr>

Component Name: Husky

License Type: MIT
Expand Down
2 changes: 1 addition & 1 deletion Unity.Services.Cli/.run/Cli.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<configuration default="false" name="Cli" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Unity.Services.Cli/bin/Debug/net6.0/ugs" />
<option name="PROGRAM_PARAMETERS" value="-h" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/Unity.Services.Cli/bin/Debug/net6.0" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/.." />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="USE_MONO" value="0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<PackageReference Include="Unity.Services.Gateway.AccessApiV1.Generated" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="YamlDotNet" Version="13.0.1" />
<PackageReference Include="YamlDotNet" Version="13.0.2" />
</ItemGroup>
<PropertyGroup>
<DefineConstants Condition=" '$(ExtraDefineConstants)' != '' ">$(DefineConstants);$(ExtraDefineConstants)</DefineConstants>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Unity.Services.Cli.Authoring.Handlers;
using Unity.Services.Cli.Authoring.Input;
using Unity.Services.Cli.Authoring.Templates;
using Unity.Services.Cli.TestUtils;

namespace Unity.Services.Cli.Authoring.UnitTest.Handlers;

Expand All @@ -17,15 +18,20 @@ public class NewFileHandlerTests
Mock<IFileTemplate>? m_MockTemplate;
Mock<ILogger>? m_MockLogger;
CancellationToken m_CancellationToken;
const string k_FileExtension = ".test";
const string k_FileName = "test";
const string k_ExistingFileName = "test_exists";

[SetUp]
public void SetUp()
{
m_MockFile = new Mock<IFile>();
m_MockTemplate = new Mock<IFileTemplate>();
m_MockTemplate.SetupGet(template => template.Extension).Returns(".test");
m_MockTemplate.SetupGet(template => template.Extension).Returns(k_FileExtension);
m_MockLogger = new Mock<ILogger>();
m_CancellationToken = CancellationToken.None;

m_MockFile!.Setup(e => e.Exists(k_ExistingFileName + k_FileExtension)).Returns(true);
}

[Test]
Expand All @@ -36,16 +42,23 @@ public async Task NewFile_WithInvalidExtension_ReplacedWithValid()
File = "test.txt"
};
await NewFileHandler.NewFileAsync(input, m_MockFile!.Object, m_MockTemplate!.Object, m_MockLogger!.Object, m_CancellationToken);
Assert.That(Path.GetExtension(input.File), Is.EqualTo(".test"));
Assert.That(Path.GetExtension(input.File), Is.EqualTo(k_FileExtension));
}

[Test]
public async Task NewFile_CallsWriteAllText()
{
var file = "test";

await NewFileHandler.NewFileAsync(new NewFileInput { File = file }, m_MockFile!.Object, m_MockTemplate!.Object, m_MockLogger!.Object, m_CancellationToken);
await NewFileHandler.NewFileAsync(new NewFileInput { File = k_FileName }, m_MockFile!.Object, m_MockTemplate!.Object, m_MockLogger!.Object, m_CancellationToken);

m_MockFile.Verify(f => f.WriteAllTextAsync(It.IsAny<string>(), It.IsAny<string>(), CancellationToken.None), Times.Once);
}

[Test]
public async Task NewFile_ErrorsOutIfFileExists()
{
await NewFileHandler.NewFileAsync(new NewFileInput { File = k_ExistingFileName }, m_MockFile!.Object, m_MockTemplate!.Object, m_MockLogger!.Object, m_CancellationToken);

m_MockFile.Verify(f => f.WriteAllTextAsync(It.IsAny<string>(), It.IsAny<string>(), CancellationToken.None), Times.Never);
TestsHelper.VerifyLoggerWasCalled(m_MockLogger, LogLevel.Error);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Unity.Services.Cli.Authoring.Model;

Expand All @@ -25,16 +25,24 @@ public class FetchResultTests
"thing4"
};

static readonly IReadOnlyList<string> k_Fetched= new[]
static readonly IReadOnlyList<string> k_Fetched = new[]
{
"thing1"
};

static readonly IReadOnlyList<string> k_Failed= new[]
static readonly IReadOnlyList<string> k_Failed = new[]
{
"thing2"
};

static readonly List<TestCaseData> k_AppendResultTestData = new()
{
new TestCaseData(k_Updated, FetchResult.UpdatedHeader),
new TestCaseData(k_Created, FetchResult.CreatedHeader),
new TestCaseData(k_Deleted, FetchResult.DeletedHeader),
new TestCaseData(k_Failed, FetchResult.FailedHeader),
new TestCaseData(k_Fetched, FetchResult.FetchedHeader),
};

[Test]
public void ToStringFormatsFetchedAndFailedResults()
Expand All @@ -47,18 +55,19 @@ public void ToStringFormatsFetchedAndFailedResults()
k_Failed);
var result = fetchResult.ToString();

Assert.IsTrue(result.Contains($"Successfully fetched into the following files:{System.Environment.NewLine} {k_Fetched[0]}"));
foreach (var fetchedFile in k_Failed)
{
var expected = $"Failed to fetch:{System.Environment.NewLine} '{fetchedFile}'";
Assert.IsTrue(result.Contains(expected),
$"Missing or incorrect log for '{fetchedFile}'") ;
}
Assert.Multiple(
() =>
{
AssertStringifiedResult(result, k_Updated, FetchResult.UpdatedHeader);
AssertStringifiedResult(result, k_Created, FetchResult.CreatedHeader);
AssertStringifiedResult(result, k_Deleted, FetchResult.DeletedHeader);
AssertStringifiedResult(result, k_Failed, FetchResult.FailedHeader);
AssertStringifiedResult(result, k_Fetched, FetchResult.FetchedHeader);
});
}


[Test]
public void ToStringFormatsNoContentDeployed()
public void ToStringFormatsNoContentFetched()
{
var fetchResult = new FetchResult(
Array.Empty<string>(),
Expand All @@ -68,7 +77,27 @@ public void ToStringFormatsNoContentDeployed()
Array.Empty<string>());
var result = fetchResult.ToString();

Assert.IsFalse(result.Contains($"Successfully fetched the following contents:{System.Environment.NewLine}"));
Assert.IsTrue(result.Contains("No content fetched"));
Assert.IsFalse(result.Contains(FetchResult.FetchedHeader));
Assert.IsTrue(result.Contains(FetchResult.EmptyFetchMessage));
}

[TestCaseSource(nameof(k_AppendResultTestData))]
public void AppendResultBuildsResultAsExpected(ICollection<string> results, string header)
{
var builder = new StringBuilder();

FetchResult.AppendResult(builder, results, header);

var stringifiedResult = builder.ToString();
Assert.Multiple(() => AssertStringifiedResult(stringifiedResult, results, header));
}

static void AssertStringifiedResult(string stringifiedResult, IEnumerable<string> results, string header)
{
Assert.That(stringifiedResult, Contains.Substring(header));
foreach (var result in results)
{
Assert.That(stringifiedResult, Contains.Substring($" {result}"));
}
}
}
Loading

0 comments on commit 71db5ff

Please sign in to comment.