unity-test-runner/action.yml

67 lines
2.2 KiB
YAML
Raw Normal View History

2019-11-30 15:36:27 +00:00
name: 'Unity - Test runner'
author: Webber Takken <webber@takken.io>
description: 'Run tests for any Unity project.'
2020-01-29 20:49:35 +00:00
inputs:
unityVersion:
required: false
default: 'auto'
description: 'Version of unity to use for testing the project. Use "auto" to get from your ProjectSettings/ProjectVersion.txt'
2020-11-26 08:17:42 +00:00
customImage:
required: false
default: ''
description: 'Specific docker image that should be used for testing the project'
projectPath:
required: false
description: 'Path to the Unity project to be tested.'
2022-01-01 20:38:47 +00:00
customParameters:
required: false
description: 'Extra parameters to configure the Unity editor run.'
testMode:
required: false
default: 'all'
description: 'The type of tests to be run by the test runner.'
coverageOptions:
required: false
default: 'generateAdditionalMetrics;generateHtmlReport;generateBadgeReport'
description: 'Optional coverage parameters for the -coverageOptions argument.'
artifactsPath:
required: false
default: 'artifacts'
2020-11-10 17:18:00 +00:00
description: 'Path where test artifacts should be stored.'
useHostNetwork:
required: false
default: false
2022-01-01 20:38:47 +00:00
description: 'Initialises Docker using the host network.'
sshAgent:
required: false
default: ''
2022-01-01 20:38:47 +00:00
description: 'SSH Agent path to forward to the container.'
gitPrivateToken:
required: false
default: ''
2022-01-01 20:38:47 +00:00
description: 'GitHub Private Access Token (PAT) to pull from GitHub.'
githubToken:
2021-02-27 18:13:19 +00:00
required: false
default: ''
description: 'Token to authorize access to the GitHub REST API. If provided, a check run will be created with the test results.'
2021-02-27 18:13:19 +00:00
checkName:
required: false
default: 'Test Results'
description: 'Name for the check run that is created when a github token is provided.'
chownFilesTo:
required: false
default: ''
description: 'User and optionally group (user or user:group or uid:gid) to give ownership of the resulting build artifacts'
2019-11-30 15:36:27 +00:00
outputs:
artifactsPath:
description: 'Path where the artifacts are stored.'
coveragePath:
description: 'Path where the code coverage results are stored.'
2019-11-30 15:36:27 +00:00
branding:
icon: 'box'
color: 'gray-dark'
2020-01-29 20:49:35 +00:00
runs:
using: 'node16'
feat: ensure cleanup of docker containers (#198) Cancelled or timeouted workflow would keep the docker container running. Closes game-ci/unity-test-runner#197 This has two parts: Part one. The entrypoints. `runs.post`: GitHub Action metadata allow running something after the action (regardless of a failure, crash, timeout, ...). https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#runspost However, it needs to be a `.js` file and it can't be configured to pass any arguments. There already was `index.js` used as the main entrypoint. The build process of this file uses typescript compiler and ncc to pack all dependencies into one .js file. And ncc has no way of generating multiple files in one go, so the only solution would be to run ncc twice and generate two independent files. That would be quite unfortunate, wasting time and storage. So I rather came up with a new entrypoint that symlinked from two locations. And this new entrypoint understands how it was executed, so it can run the correct behaviour. This makes it easy to add `runs.pre` if needed. This new entrypoint is in `index.ts`. The original `index.ts` is now in `main.ts`. Part two. The signals. I've tried: * try/catch/finally around the `await Docker.run`. Catch and finally are not executed when process receives SIGINT. See the discussion in: https://github.com/nodejs/node/discussions/29480 * New AbortController and AbortSignal. Great concept, but the action.exec does not support it. So it can't be aborted. * Doing cleanup on `process.on('exit')`. Unfortunately you can't really do async stuff from there, so can't really run the docker rm command to delete the container. * Using `process.on('SIGINT')`. For some reason that wasn't really executing for me. I'd not put my hand in fire for this, but I assume because it was in the signal handler it does something special, or would heed to be scheduled for later with `setTimeout(0)`. Evaluating all these I came to a conclusion that it is fragile and just relying on a `runs.post` is much better and safer. `
2022-11-03 18:14:51 +00:00
main: 'dist/main.js'
post: 'dist/post.js'