Compare commits

..

8 Commits

Author SHA1 Message Date
David Finol
f61055d56f Fix docs link (#153) 2021-12-13 09:46:23 -06:00
Webber Takken
79e50e3e4f allow space in between words of project name (#151)
Co-authored-by: David Finol <davidmfinol@gmail.com>
2021-11-10 13:30:58 +01:00
Robin
576ef39bb6 add private github package support using personal access token (#152)
* add private github package support using pat

* add index.js after yarn build

* shift gitcrediental step before run_tests
2021-11-03 10:25:06 +01:00
Michal Cichra
a2b1ed6631 show console output in the GitHub Check annotations (#149)
The annotation raw details now include console output (if available) and stack trace.
2021-10-21 15:53:41 -05:00
dependabot[bot]
3e969f16b2 Bump ansi-regex from 5.0.0 to 5.0.1 (#147)
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v5.0.0...v5.0.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-25 22:39:15 +03:00
dependabot[bot]
20387ae1e0 Bump tmpl from 1.0.4 to 1.0.5 (#145)
Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/daaku/nodejs-tmpl/releases)
- [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5)

---
updated-dependencies:
- dependency-name: tmpl
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-25 22:36:55 +03:00
dependabot[bot]
e13aeebe33 Bump semver-regex from 3.1.2 to 3.1.3 (#144)
Bumps [semver-regex](https://github.com/sindresorhus/semver-regex) from 3.1.2 to 3.1.3.
- [Release notes](https://github.com/sindresorhus/semver-regex/releases)
- [Commits](https://github.com/sindresorhus/semver-regex/commits)

---
updated-dependencies:
- dependency-name: semver-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-09-25 22:36:43 +03:00
Paul Pacheco
02c0e7b60c fix unary operator expected error (#146)
* fix unary operator expected error

The if comparisons can sometimes compare an empty variable, which gives errors like this:
```
/steps/run_tests.sh: line 71: [: =: unary operator expected
```

This PR should fix the script to address that problem. 
See an explanation of why this error happens here:
https://codefather.tech/blog/bash-unary-operator-expected/

* fix missing quote

* Posix shell compliance

Posix shell does not do ==,  it only does one =

* consistent spaces
2021-09-25 22:36:17 +03:00
12 changed files with 97 additions and 22 deletions

View File

@@ -19,7 +19,7 @@ When fixing a bug it is fine to submit a pull request right away.
Steps to be performed to submit a pull request:
1. Fork the repository and create your branch from `master`.
1. Fork the repository and create your branch from `main`.
2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Fill out the description, link any related issues and submit your pull request.

View File

@@ -32,6 +32,11 @@ inputs:
required: false
default: ''
description: 'SSH Agent path to forward to the container'
gitPrivateToken:
required: false
default: ''
description: >
Github private token to pull from github
githubToken:
required: false
default: ''

View File

@@ -12,6 +12,7 @@ mkdir -p "$ACTIVATE_LICENSE_PATH"
#
source /steps/activate.sh
source /steps/set_gitcredential.sh
source /steps/run_tests.sh
source /steps/return_license.sh

File diff suppressed because one or more lines are too long

View File

@@ -86,7 +86,7 @@ else
#
echo "License activation strategy could not be determined."
echo ""
echo "Visit https://github.com/webbertakken/unity-builder#usage for more"
echo "Visit https://game.ci/docs/github/getting-started for more"
echo "details on how to set up one of the possible activation strategies."
# Immediately exit as no UNITY_EXIT_CODE can be derived.

View File

@@ -67,8 +67,8 @@ ls -alh $UNITY_PROJECT_PATH
#
# Testing in EditMode
#
if [ $EDIT_MODE = true ]; then
EDIT_MODE_EXIT_CODE=0
if [ "$EDIT_MODE" = "true" ]; then
echo ""
echo "###########################"
echo "# Testing in EditMode #"
@@ -104,8 +104,8 @@ fi
#
# Testing in PlayMode
#
if [ $PLAY_MODE = true ]; then
PLAY_MODE_EXIT_CODE=0
if [ "$PLAY_MODE" = "true" ]; then
echo ""
echo "###########################"
echo "# Testing in PlayMode #"
@@ -149,7 +149,7 @@ echo "###########################"
echo ""
ls -alh $UNITY_PROJECT_PATH
if [ $EDIT_MODE = true ]; then
if [ "$EDIT_MODE" = "true" ]; then
echo ""
echo "###########################"
echo "# Edit Mode Results #"
@@ -159,7 +159,7 @@ if [ $EDIT_MODE = true ]; then
cat "$FULL_ARTIFACTS_PATH/editmode-results.xml" | grep test-run | grep Passed
fi
if [ $PLAY_MODE = true ]; then
if [ "$PLAY_MODE" = "true" ]; then
echo ""
echo "###########################"
echo "# Play Mode Results #"

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
if [ -z "${GIT_PRIVATE_TOKEN}" ]
then
echo "GIT_PRIVATE_TOKEN unset skipping"
else
echo "GIT_PRIVATE_TOKEN is set configuring git credentials"
git config --global credential.helper store
git config --global --replace-all url.https://github.com/.insteadOf ssh://git@github.com/
git config --global --add url.https://github.com/.insteadOf git@github.com
git config --global url."https://token:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "https://github.com/"
git config --global url."https://ssh:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "ssh://git@github.com/"
git config --global url."https://git:$GIT_PRIVATE_TOKEN@github.com/".insteadOf "git@github.com:"
fi
echo "---------- git config --list -------------"
git config --list
echo "---------- git config --list --show-origin -------------"
git config --list --show-origin

View File

@@ -28,6 +28,7 @@ class Docker {
customParameters,
sshAgent,
githubToken,
gitPrivateToken,
} = parameters;
const command = `docker run \
@@ -58,6 +59,7 @@ class Docker {
--env RUNNER_TOOL_CACHE \
--env RUNNER_TEMP \
--env RUNNER_WORKSPACE \
--env GIT_PRIVATE_TOKEN="${gitPrivateToken}" \
${sshAgent ? '--env SSH_AUTH_SOCK=/ssh-agent' : ''} \
--volume "/var/run/docker.sock":"/var/run/docker.sock" \
--volume "/home/runner/work/_temp/_github_home":"/root" \

View File

@@ -8,7 +8,7 @@ class Input {
}
static isValidFolderName(folderName) {
const validFolderName = new RegExp(/^(\.|\.\/)?(\.?[\w~]+([_-]?[\w~]+)*\/?)*$/);
const validFolderName = new RegExp(/^(\.|\.\/)?(\.?[\w~]+([ _-]?[\w~]+)*\/?)*$/);
return validFolderName.test(folderName);
}
@@ -25,6 +25,7 @@ class Input {
const sshAgent = getInput('sshAgent') || '';
const githubToken = getInput('githubToken') || '';
const checkName = getInput('checkName') || 'Test Results';
const gitPrivateToken = getInput('gitPrivateToken') || '';
// Validate input
if (!includes(this.testModes, testMode)) {
@@ -62,6 +63,7 @@ class Input {
sshAgent,
githubToken,
checkName,
gitPrivateToken,
};
}
}

View File

@@ -72,7 +72,7 @@ class ResultsParser {
}
static convertTestCase(suite, testCase) {
const { _attributes, failure } = testCase;
const { _attributes, failure, output } = testCase;
const { name, fullname, result, duration } = _attributes;
const testMeta = new TestMeta(suite, name);
testMeta.result = result;
@@ -96,6 +96,14 @@ class ResultsParser {
return testMeta;
}
const rawDetails = [trace];
if (output && output._cdata) {
rawDetails.unshift(output._cdata);
} else {
core.debug(`No console output for test case: ${fullname}`);
}
testMeta.annotation = {
path: point.path,
start_line: point.line,
@@ -103,7 +111,7 @@ class ResultsParser {
annotation_level: 'failure',
title: fullname,
message: failure.message._cdata ? failure.message._cdata : 'Test Failed!',
raw_details: trace,
raw_details: rawDetails.join('\n'),
};
core.info(
`- ${testMeta.annotation.path}:${testMeta.annotation.start_line} - ${testMeta.annotation.title}`,

View File

@@ -149,7 +149,7 @@ describe('ResultsParser', () => {
expect(result.annotation).toBeUndefined();
});
test('prepare annotation', () => {
test('prepare annotation without console output', () => {
const result = ResultsParser.convertTestCase('Test Suite', {
_attributes: {
name: 'Test Name',
@@ -179,6 +179,40 @@ describe('ResultsParser', () => {
title: 'Test Full Name',
});
});
test('prepare annotation with console output', () => {
const result = ResultsParser.convertTestCase('Test Suite', {
_attributes: {
name: 'Test Name',
fullname: 'Test Full Name',
duration: '3.14',
},
output: {
_cdata: '[Warning] This is a warning',
},
failure: {
message: { _cdata: 'Message CDATA' },
'stack-trace': {
_cdata:
'at Tests.SetupFailedTest.SetUp () [0x00000] in /github/workspace/unity-project/Assets/Tests/SetupFailedTest.cs:10',
},
},
});
expect(result.suite).toBe('Test Suite');
expect(result.title).toBe('Test Name');
expect(result.duration).toBe(3.14);
expect(result.annotation).toMatchObject({
annotation_level: 'failure',
end_line: 10,
message: 'Message CDATA',
path: '/github/workspace/unity-project/Assets/Tests/SetupFailedTest.cs',
raw_details:
'[Warning] This is a warning\nat Tests.SetupFailedTest.SetUp () [0x00000] in /github/workspace/unity-project/Assets/Tests/SetupFailedTest.cs:10',
start_line: 10,
title: 'Test Full Name',
});
});
});
describe('findAnnotationPoint', () => {

View File

@@ -1589,9 +1589,9 @@ ansi-escapes@^4.2.1, ansi-escapes@^4.3.0:
type-fest "^0.11.0"
ansi-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
ansi-styles@^3.2.1:
version "3.2.1"
@@ -5304,9 +5304,9 @@ semver-compare@^1.0.0:
integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w=
semver-regex@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.2.tgz#34b4c0d361eef262e07199dbef316d0f2ab11807"
integrity sha512-bXWyL6EAKOJa81XG1OZ/Yyuq+oT0b2YLlxx7c+mrdYPaPbnj6WgVULXhinMIeZGufuUBu/eVRqXEhiv4imfwxA==
version "3.1.3"
resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-3.1.3.tgz#b2bcc6f97f63269f286994e297e229b6245d0dc3"
integrity sha512-Aqi54Mk9uYTjVexLnR67rTyBusmwd04cLkHy9hNvk3+G3nT2Oyg7E0l4XVbOaNwIvQ3hHeYxGcyEy+mKreyBFQ==
"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.6.0:
version "5.7.1"
@@ -5737,9 +5737,9 @@ through@^2.3.8:
integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=
tmpl@1.0.x:
version "1.0.4"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=
version "1.0.5"
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc"
integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==
to-fast-properties@^2.0.0:
version "2.0.0"