Add custom parameters
parent
686f633329
commit
3ccd77fd44
22
README.md
22
README.md
|
@ -1,4 +1,5 @@
|
|||
# Unity - Test runner
|
||||
|
||||
[](https://github.com/webbertakken/unity-test-runner/actions?query=branch%3Amaster+workflow%3A%22Actions+%F0%9F%98%8E%22)
|
||||
|
||||
---
|
||||
|
@ -66,6 +67,27 @@ You use the id to **upload the artifacts** like so:
|
|||
path: ${{ steps.myTestStep.outputs.artifactsPath }}
|
||||
```
|
||||
|
||||
#### customParameters
|
||||
|
||||
Custom parameters to configure the test run.
|
||||
|
||||
Parameters must start with a hyphen (`-`) and may be followed by a value (without hyphen).
|
||||
|
||||
Parameters without a value will be considered booleans (with a value of true).
|
||||
|
||||
_**example:**_
|
||||
|
||||
```yaml
|
||||
- uses: webbertakken/unity-test-runner@master
|
||||
with:
|
||||
customParameters: -profile SomeProfile -someBoolean -someValue exampleValue
|
||||
```
|
||||
|
||||
_**required:** `false`_
|
||||
_**default:** ""_
|
||||
|
||||
#### Save your workflow
|
||||
|
||||
Commit and push your workflow definition.
|
||||
|
||||
## More actions
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -14,6 +14,11 @@ echo "Using project path \"$UNITY_PROJECT_PATH\"."
|
|||
echo "Using build path \"$ARTIFACTS_PATH\" to save test results."
|
||||
FULL_ARTIFACTS_PATH=$GITHUB_WORKSPACE/$ARTIFACTS_PATH
|
||||
|
||||
#
|
||||
# Display custom parameters
|
||||
#
|
||||
echo "Using custom parameters \"$CUSTOM_PARAMETERS\"."
|
||||
|
||||
# Set the modes for testing
|
||||
case $TEST_MODE in
|
||||
editmode)
|
||||
|
@ -76,7 +81,8 @@ if [ $EDIT_MODE = true ]; then
|
|||
-projectPath "$UNITY_PROJECT_PATH" \
|
||||
-runTests \
|
||||
-testPlatform editmode \
|
||||
-testResults "$FULL_ARTIFACTS_PATH/editmode-results.xml"
|
||||
-testResults "$FULL_ARTIFACTS_PATH/editmode-results.xml" \
|
||||
"$CUSTOM_PARAMETERS"
|
||||
|
||||
# Catch exit code
|
||||
EDIT_MODE_EXIT_CODE=$?
|
||||
|
|
10
src/index.js
10
src/index.js
|
@ -5,14 +5,20 @@ async function action() {
|
|||
Action.checkCompatibility();
|
||||
|
||||
const { dockerfile, workspace, actionFolder } = Action;
|
||||
const { unityVersion, projectPath, artifactsPath } = Input.getFromUser();
|
||||
const { unityVersion, projectPath, artifactsPath, customParameters } = Input.getFromUser();
|
||||
const baseImage = ImageTag.createForBase(unityVersion);
|
||||
|
||||
// Build docker image
|
||||
const actionImage = await Docker.build({ path: actionFolder, dockerfile, baseImage });
|
||||
|
||||
// Run docker image
|
||||
await Docker.run(actionImage, { workspace, unityVersion, projectPath, artifactsPath });
|
||||
await Docker.run(actionImage, {
|
||||
workspace,
|
||||
unityVersion,
|
||||
projectPath,
|
||||
artifactsPath,
|
||||
customParameters,
|
||||
});
|
||||
|
||||
// Set output
|
||||
await Output.setArtifactsPath(artifactsPath);
|
||||
|
|
|
@ -18,7 +18,7 @@ class Docker {
|
|||
}
|
||||
|
||||
static async run(image, parameters, silent = false) {
|
||||
const { unityVersion, workspace, projectPath, artifactsPath } = parameters;
|
||||
const { unityVersion, workspace, projectPath, artifactsPath, customParameters } = parameters;
|
||||
|
||||
const command = `docker run \
|
||||
--workdir /github/workspace \
|
||||
|
@ -29,7 +29,8 @@ class Docker {
|
|||
--env UNITY_SERIAL \
|
||||
--env UNITY_VERSION=${unityVersion} \
|
||||
--env PROJECT_PATH=${projectPath} \
|
||||
--env ARTIFACTS_PATH=${artifactsPath}
|
||||
--env ARTIFACTS_PATH=${artifactsPath} \
|
||||
--env CUSTOM_PARAMETERS=${customParameters} \
|
||||
--env HOME=/github/home \
|
||||
--env GITHUB_REF \
|
||||
--env GITHUB_SHA \
|
||||
|
|
|
@ -18,6 +18,7 @@ class Input {
|
|||
const testMode = getInput('testMode') || 'all';
|
||||
const rawProjectPath = getInput('testMode') || '.';
|
||||
const rawArtifactsPath = getInput('testMode') || 'artifacts';
|
||||
const customParameters = getInput('customParameters') || '';
|
||||
|
||||
// Validate input
|
||||
if (!includes(this.testModes, testMode)) {
|
||||
|
@ -42,6 +43,7 @@ class Input {
|
|||
projectPath,
|
||||
testMode,
|
||||
artifactsPath,
|
||||
customParameters,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue