Run tests for any Unity project
 
 
 
 
 
Go to file
Michal Cichra 698c08cf4e
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 19:14:51 +01:00
.github Update FUNDING.yml (#192) 2022-09-17 13:50:07 -04:00
.husky feat: upgrade to images of version 1 (rolling tag) (#179) 2022-04-03 17:59:11 +02:00
artifacts Small results-check refactor for debugging (#104) 2021-03-06 00:55:03 -06:00
dist feat: ensure cleanup of docker containers (#198) 2022-11-03 19:14:51 +01:00
media remove anything recognizable as Unity (#82) 2020-12-06 17:45:57 +01:00
src feat: ensure cleanup of docker containers (#198) 2022-11-03 19:14:51 +01:00
unity-project-with-correct-tests Changed eableCyclomaticComplexity to generateAdditionalMetrics (#183) 2022-04-22 01:08:44 +02:00
.dockerignore Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
.editorconfig Add meta files 2020-01-31 01:15:59 +01:00
.eslintignore Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
.eslintrc.json Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
.gitattributes Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
.gitignore Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
.prettierignore Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
.prettierrc.json Dependency bump (#88) 2021-01-11 01:05:18 +01:00
.yarnrc Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
CODE_OF_CONDUCT.md Add meta files 2020-01-31 01:15:59 +01:00
CONTRIBUTING.md add private github package support using personal access token (#152) 2021-11-03 10:25:06 +01:00
LICENSE Add license (MIT) 2019-11-30 15:47:07 +01:00
README.md Indicate how to support us (#134) 2021-07-12 19:28:06 +02:00
action.yml feat: ensure cleanup of docker containers (#198) 2022-11-03 19:14:51 +01:00
jest.config.js Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
package.json feat: ensure cleanup of docker containers (#198) 2022-11-03 19:14:51 +01:00
tsconfig.json Refactor to typescript (#158) 2022-01-11 05:52:29 -06:00
yarn.lock upgrade actions/core to 1.10.0 (#194) 2022-10-13 23:17:35 +02:00

README.md

Unity - Test runner

(Not affiliated with Unity Technologies)

GitHub Action to run tests for any Unity project.

Part of the GameCI open source project.

Actions status

How to use

Find the docs on the GameCI documentation website.

Visit the GameCI Unity Actions status repository for related Actions.

Community

Feel free to join us on Discord and engage with the community.

Contributing

To help improve the documentation, please find the docs repository.

To contribute to this project, kindly read the contribution guide.

Support us

GameCI is free for everyone forever.

You can support us at OpenCollective.

Licence

This repository is MIT licensed.

This includes all contributions from the community.