2020-01-29 20:49:35 +00:00
|
|
|
{
|
|
|
|
"name": "unity-test-runner",
|
2022-01-11 11:52:29 +00:00
|
|
|
"version": "2.0.0",
|
2020-01-29 20:49:35 +00:00
|
|
|
"description": "Run tests for any Unity project.",
|
2022-01-11 11:52:29 +00:00
|
|
|
"main": "dist/index.js",
|
|
|
|
"repository": "git@github.com:game-ci/unity-test-runner.git",
|
2020-01-29 20:49:35 +00:00
|
|
|
"author": "Webber <webber@takken.io>",
|
|
|
|
"license": "MIT",
|
|
|
|
"scripts": {
|
2020-03-09 22:58:40 +00:00
|
|
|
"prebuild": "yarn",
|
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
|
|
|
"build": "tsc && ncc build lib/index.js --source-map --license licenses.txt",
|
2022-01-11 11:52:29 +00:00
|
|
|
"lint": "prettier --check \"src/**/*.{js,ts}\" && eslint src/**/*.ts",
|
|
|
|
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
|
|
|
"test": "jest",
|
|
|
|
"prepare": "husky install"
|
2020-01-29 20:49:35 +00:00
|
|
|
},
|
|
|
|
"dependencies": {
|
2022-10-13 21:17:35 +00:00
|
|
|
"@actions/core": "^1.10.0",
|
2022-01-11 13:44:47 +00:00
|
|
|
"@actions/exec": "^1.1.0",
|
|
|
|
"@actions/github": "^5.0.0",
|
2022-01-11 11:52:29 +00:00
|
|
|
"@octokit/openapi-types": "^11.2.0",
|
|
|
|
"handlebars": "^4.7.7",
|
|
|
|
"xml-js": "^1.6.11"
|
2020-01-29 20:49:35 +00:00
|
|
|
},
|
|
|
|
"devDependencies": {
|
2022-01-11 11:52:29 +00:00
|
|
|
"@types/jest": "^26.0.15",
|
|
|
|
"@types/node": "^14.14.9",
|
|
|
|
"@types/semver": "^7.3.5",
|
|
|
|
"@typescript-eslint/parser": "^5.9.0",
|
|
|
|
"@vercel/ncc": "^0.33.1",
|
|
|
|
"eslint": "^8.6.0",
|
|
|
|
"eslint-config-prettier": "^8.1.0",
|
|
|
|
"eslint-plugin-github": "^4.3.5",
|
|
|
|
"eslint-plugin-jest": "^25.3.4",
|
|
|
|
"eslint-plugin-prettier": "^4.0.0",
|
|
|
|
"eslint-plugin-unicorn": "^40.0.0",
|
|
|
|
"husky": "^7.0.4",
|
|
|
|
"jest": "^26.6.3",
|
|
|
|
"jest-circus": "^26.6.3",
|
|
|
|
"js-yaml": "^3.14.0",
|
|
|
|
"lint-staged": "^12.1.2",
|
|
|
|
"prettier": "^2.2.1",
|
|
|
|
"ts-jest": "^26.4.4",
|
2021-02-27 18:13:19 +00:00
|
|
|
"typescript": "^4.1.5"
|
2020-01-29 20:49:35 +00:00
|
|
|
},
|
|
|
|
"lint-staged": {
|
2022-01-11 11:52:29 +00:00
|
|
|
"*.{js,jsx,ts,tsx}": [
|
2020-01-29 20:49:35 +00:00
|
|
|
"prettier --write",
|
|
|
|
"eslint",
|
|
|
|
"jest --findRelatedTests"
|
|
|
|
],
|
|
|
|
"*.{json,md,yaml,yml}": [
|
2022-01-11 11:52:29 +00:00
|
|
|
"prettier --write"
|
2020-01-29 20:49:35 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|