Compare commits

..

No commits in common. "bb5664383c049fdd7cda33425c2364acdccd8c02" and "cce39442ef77411b28079afadd71d27581ac776d" have entirely different histories.

24 changed files with 37526 additions and 45765 deletions

48323
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

98
dist/licenses.txt generated vendored
View File

@ -83,6 +83,28 @@ The above copyright notice and this permission notice shall be included in all c
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@fastify/busboy
MIT
Copyright Brian White. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
@octokit/auth-token
MIT
The MIT License
@ -460,6 +482,25 @@ Apache-2.0
limitations under the License.
deprecation
ISC
The ISC License
Copyright (c) Gregor Martynus and contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
docker-compose
MIT
MIT License
@ -485,32 +526,24 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
fast-content-type-parse
MIT
MIT License
once
ISC
The ISC License
Copyright (c) 2023 The Fastify Team
Copyright (c) Isaac Z. Schlueter and Contributors
The Fastify team members are listed at https://github.com/fastify/fastify#team
and in the README file.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
semver
ISC
@ -585,13 +618,32 @@ universal-user-agent
ISC
# [ISC License](https://spdx.org/licenses/ISC)
Copyright (c) 2018-2021, Gregor Martynus (https://github.com/gr2m)
Copyright (c) 2018, Gregor Martynus (https://github.com/gr2m)
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
wrappy
ISC
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
yaml
ISC
Copyright Eemeli Aro <eemeli@gmail.com>

3
dist/package.json generated vendored
View File

@ -1,3 +0,0 @@
{
"type": "module"
}

33607
dist/post.js generated vendored

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
import tsDevToolsCore from "@ts-dev-tools/core/dist/eslint-plugin-ts-dev-tools/index.js";
import { default as tsDevToolsCore } from "@ts-dev-tools/core/dist/eslint-plugin-ts-dev-tools/index.js";
export default tsDevToolsCore.default;

436
package-lock.json generated
View File

@ -9,11 +9,11 @@
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^3.0.0",
"@actions/github": "^9.0.0",
"@actions/tool-cache": "^4.0.0",
"@actions/core": "^2.0.2",
"@actions/github": "^7.0.0",
"@actions/tool-cache": "^3.0.0",
"@octokit/action": "^8.0.4",
"docker-compose": "^1.3.1"
"docker-compose": "^1.3.0"
},
"devDependencies": {
"@ts-dev-tools/core": "^1.9.14",
@ -35,86 +35,75 @@
}
},
"node_modules/@actions/core": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-3.0.0.tgz",
"integrity": "sha512-zYt6cz+ivnTmiT/ksRVriMBOiuoUpDCJJlZ5KPl2/FRdvwU3f7MPh9qftvbkXJThragzUZieit2nyHUyw53Seg==",
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-2.0.2.tgz",
"integrity": "sha512-Ast1V7yHbGAhplAsuVlnb/5J8Mtr/Zl6byPPL+Qjq3lmfIgWF1ak1iYfF/079cRERiuTALTXkSuEUdZeDCfGtA==",
"license": "MIT",
"dependencies": {
"@actions/exec": "^3.0.0",
"@actions/http-client": "^4.0.0"
}
},
"node_modules/@actions/core/node_modules/@actions/http-client": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz",
"integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==",
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^6.23.0"
"@actions/exec": "^2.0.0",
"@actions/http-client": "^3.0.1"
}
},
"node_modules/@actions/exec": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-3.0.0.tgz",
"integrity": "sha512-6xH/puSoNBXb72VPlZVm7vQ+svQpFyA96qdDBvhB8eNZOE8LtPf9L4oAsfzK/crCL8YZ+19fKYVnM63Sl+Xzlw==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-2.0.0.tgz",
"integrity": "sha512-k8ngrX2voJ/RIN6r9xB82NVqKpnMRtxDoiO+g3olkIUpQNqjArXrCQceduQZCQj3P3xm32pChRLqRrtXTlqhIw==",
"license": "MIT",
"dependencies": {
"@actions/io": "^3.0.2"
"@actions/io": "^2.0.0"
}
},
"node_modules/@actions/github": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-9.0.0.tgz",
"integrity": "sha512-yJ0RoswsAaKcvkmpCE4XxBRiy/whH2SdTBHWzs0gi4wkqTDhXMChjSdqBz/F4AeiDlP28rQqL33iHb+kjAMX6w==",
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/@actions/github/-/github-7.0.0.tgz",
"integrity": "sha512-PyGODO938aoBTZd/IfN/+e+Pd5hUcVpyf+thm4CPESLeqhdSkq5QwMTGX9v84XHE1ifmHWBQ60KB8kIgm96opw==",
"license": "MIT",
"dependencies": {
"@actions/http-client": "^3.0.2",
"@octokit/core": "^7.0.6",
"@octokit/plugin-paginate-rest": "^14.0.0",
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
"@octokit/request": "^10.0.7",
"@octokit/request-error": "^7.1.0",
"undici": "^6.23.0"
"@actions/http-client": "^3.0.1",
"@octokit/core": "^5.0.1",
"@octokit/plugin-paginate-rest": "^9.2.2",
"@octokit/plugin-rest-endpoint-methods": "^10.4.0",
"@octokit/request": "^8.4.1",
"@octokit/request-error": "^5.1.1",
"undici": "^5.28.5"
}
},
"node_modules/@actions/http-client": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.2.tgz",
"integrity": "sha512-JP38FYYpyqvUsz+Igqlc/JG6YO9PaKuvqjM3iGvaLqFnJ7TFmcLyy2IDrY0bI0qCQug8E9K+elv5ZNfw62ZJzA==",
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-3.0.1.tgz",
"integrity": "sha512-SbGS8c/vySbNO3kjFgSW77n83C4MQx/Yoe+b1hAdpuvfHxnkHzDq2pWljUpAA56Si1Gae/7zjeZsV0CYjmLo/w==",
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^6.23.0"
"undici": "^5.28.5"
}
},
"node_modules/@actions/io": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-3.0.2.tgz",
"integrity": "sha512-nRBchcMM+QK1pdjO7/idu86rbJI5YHUKCvKs0KxnSYbVe3F51UfGxuZX4Qy/fWlp6l7gWFwIkrOzN+oUK03kfw==",
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-2.0.0.tgz",
"integrity": "sha512-Jv33IN09XLO+0HS79aaODsvIRyduiF7NY/F6LYeK5oeUmrsz7aFdRphQjFoESF4jS7lMauDOttKALcpapVDIAg==",
"license": "MIT"
},
"node_modules/@actions/tool-cache": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-4.0.0.tgz",
"integrity": "sha512-L8P9HbXvpvqjZDveb/fdsa55IVC0trfPgQ4ZwGo6r5af6YDVdM9vMGPZ7rgY2fAT9gGj4PSYd6bYlg3p3jD78A==",
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-3.0.0.tgz",
"integrity": "sha512-JBx8gEWuu8Lqaqx/hEnL6QdKvF06suBR4y+dBDi9vJbHx1r+p6QtmBKhQYhiKjDUYIoDX1bUrbyAYPChoPK+XA==",
"license": "MIT",
"dependencies": {
"@actions/core": "^3.0.0",
"@actions/exec": "^3.0.0",
"@actions/http-client": "^4.0.0",
"@actions/io": "^3.0.0",
"semver": "^7.7.3"
"@actions/core": "^2.0.1",
"@actions/exec": "^2.0.0",
"@actions/http-client": "^3.0.1",
"@actions/io": "^2.0.0",
"semver": "^6.1.0"
}
},
"node_modules/@actions/tool-cache/node_modules/@actions/http-client": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-4.0.0.tgz",
"integrity": "sha512-QuwPsgVMsD6qaPD57GLZi9sqzAZCtiJT8kVBCDpLtxhL5MydQ4gS+DrejtZZPdIYyB1e95uCK9Luyds7ybHI3g==",
"license": "MIT",
"dependencies": {
"tunnel": "^0.0.6",
"undici": "^6.23.0"
"node_modules/@actions/tool-cache/node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
}
},
"node_modules/@ampproject/remapping": {
@ -1242,6 +1231,14 @@
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
}
},
"node_modules/@fastify/busboy": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
"integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
"engines": {
"node": ">=14"
}
},
"node_modules/@github/browserslist-config": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@github/browserslist-config/-/browserslist-config-1.0.0.tgz",
@ -1997,29 +1994,7 @@
"node": ">= 20"
}
},
"node_modules/@octokit/action/node_modules/undici": {
"version": "7.19.2",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.19.2.tgz",
"integrity": "sha512-4VQSpGEGsWzk0VYxyB/wVX/Q7qf9t5znLRgs0dzszr9w9Fej/8RVNQ+S20vdXSAyra/bJ7ZQfGv6ZMj7UEbzSg==",
"license": "MIT",
"engines": {
"node": ">=20.18.1"
}
},
"node_modules/@octokit/auth-action": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@octokit/auth-action/-/auth-action-6.0.2.tgz",
"integrity": "sha512-gEBsz0QioHOMoEU7u2VMr2FfOvfJCrGc42K9rliS7LnlZJLcEMFccIiCiPpPNH+yXs7YYNKQ7lOX67ZTWn6Ysg==",
"license": "MIT",
"dependencies": {
"@octokit/auth-token": "^6.0.0",
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/auth-token": {
"node_modules/@octokit/action/node_modules/@octokit/auth-token": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
"integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==",
@ -2028,7 +2003,7 @@
"node": ">= 20"
}
},
"node_modules/@octokit/core": {
"node_modules/@octokit/action/node_modules/@octokit/core": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz",
"integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==",
@ -2047,7 +2022,7 @@
"node": ">= 20"
}
},
"node_modules/@octokit/endpoint": {
"node_modules/@octokit/action/node_modules/@octokit/endpoint": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.2.tgz",
"integrity": "sha512-4zCpzP1fWc7QlqunZ5bSEjxc6yLAlRTnDwKtgXfcI/FxxGoqedDG8V2+xJ60bV2kODqcGB+nATdtap/XYq2NZQ==",
@ -2060,7 +2035,7 @@
"node": ">= 20"
}
},
"node_modules/@octokit/graphql": {
"node_modules/@octokit/action/node_modules/@octokit/graphql": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.3.tgz",
"integrity": "sha512-grAEuupr/C1rALFnXTv6ZQhFuL1D8G5y8CN04RgrO4FIPMrtm+mcZzFG7dcBm+nq+1ppNixu+Jd78aeJOYxlGA==",
@ -2074,13 +2049,13 @@
"node": ">= 20"
}
},
"node_modules/@octokit/openapi-types": {
"node_modules/@octokit/action/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@octokit/plugin-paginate-rest": {
"node_modules/@octokit/action/node_modules/@octokit/plugin-paginate-rest": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-14.0.0.tgz",
"integrity": "sha512-fNVRE7ufJiAA3XUrha2omTA39M6IXIc6GIZLvlbsm8QOQCYvpq/LkMNGyFlB1d8hTDzsAXa3OKtybdMAYsV/fw==",
@ -2095,7 +2070,7 @@
"@octokit/core": ">=6"
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods": {
"node_modules/@octokit/action/node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "17.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-17.0.0.tgz",
"integrity": "sha512-B5yCyIlOJFPqUUeiD0cnBJwWJO8lkJs5d8+ze9QDP6SvfiXSz1BF+91+0MeI1d2yxgOhU/O+CvtiZ9jSkHhFAw==",
@ -2110,10 +2085,10 @@
"@octokit/core": ">=6"
}
},
"node_modules/@octokit/request": {
"version": "10.0.7",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.7.tgz",
"integrity": "sha512-v93h0i1yu4idj8qFPZwjehoJx4j3Ntn+JhXsdJrG9pYaX6j/XRz2RmasMUHtNgQD39nrv/VwTWSqK0RNXR8upA==",
"node_modules/@octokit/action/node_modules/@octokit/request": {
"version": "10.0.6",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.6.tgz",
"integrity": "sha512-FO+UgZCUu+pPnZAR+iKdUt64kPE7QW7ciqpldaMXaNzixz5Jld8dJ31LAUewk0cfSRkNSRKyqG438ba9c/qDlQ==",
"license": "MIT",
"dependencies": {
"@octokit/endpoint": "^11.0.2",
@ -2126,10 +2101,10 @@
"node": ">= 20"
}
},
"node_modules/@octokit/request-error": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.0.tgz",
"integrity": "sha512-KMQIfq5sOPpkQYajXHwnhjCC0slzCNScLHs9JafXc4RAJI+9f+jNDlBNaIMTvazOPLgb4BnlhGJOTbnN0wIjPw==",
"node_modules/@octokit/action/node_modules/@octokit/request-error": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.0.2.tgz",
"integrity": "sha512-U8piOROoQQUyExw5c6dTkU3GKxts5/ERRThIauNL7yaRoeXW0q/5bgHWT7JfWBw1UyrbK8ERId2wVkcB32n0uQ==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^16.0.0"
@ -2138,7 +2113,7 @@
"node": ">= 20"
}
},
"node_modules/@octokit/types": {
"node_modules/@octokit/action/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
@ -2147,6 +2122,232 @@
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@octokit/action/node_modules/before-after-hook": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz",
"integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==",
"license": "Apache-2.0"
},
"node_modules/@octokit/action/node_modules/undici": {
"version": "7.16.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-7.16.0.tgz",
"integrity": "sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==",
"license": "MIT",
"engines": {
"node": ">=20.18.1"
}
},
"node_modules/@octokit/action/node_modules/universal-user-agent": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
"integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
"license": "ISC"
},
"node_modules/@octokit/auth-action": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/@octokit/auth-action/-/auth-action-6.0.2.tgz",
"integrity": "sha512-gEBsz0QioHOMoEU7u2VMr2FfOvfJCrGc42K9rliS7LnlZJLcEMFccIiCiPpPNH+yXs7YYNKQ7lOX67ZTWn6Ysg==",
"license": "MIT",
"dependencies": {
"@octokit/auth-token": "^6.0.0",
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/auth-action/node_modules/@octokit/auth-token": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
"integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==",
"license": "MIT",
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/auth-action/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@octokit/auth-action/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@octokit/auth-token": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz",
"integrity": "sha512-tY/msAuJo6ARbK6SPIxZrPBms3xPbfwBrulZe0Wtr/DIY9lje2HeV1uoebShn6mx7SjCHif6EjMvoREj+gZ+SA==",
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/core": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-5.1.0.tgz",
"integrity": "sha512-BDa2VAMLSh3otEiaMJ/3Y36GU4qf6GI+VivQ/P41NC6GHcdxpKlqV0ikSZ5gdQsmS3ojXeRx5vasgNTinF0Q4g==",
"peer": true,
"dependencies": {
"@octokit/auth-token": "^4.0.0",
"@octokit/graphql": "^7.0.0",
"@octokit/request": "^8.0.2",
"@octokit/request-error": "^5.0.0",
"@octokit/types": "^12.0.0",
"before-after-hook": "^2.2.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/endpoint": {
"version": "9.0.6",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.6.tgz",
"integrity": "sha512-H1fNTMA57HbkFESSt3Y9+FBICv+0jFceJFPWDePYlR/iMGrwM5ph+Dd4XRQs+8X+PUFURLQgX9ChPfhJ/1uNQw==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^13.1.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/endpoint/node_modules/@octokit/openapi-types": {
"version": "24.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
"integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
"license": "MIT"
},
"node_modules/@octokit/endpoint/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
"integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^24.2.0"
}
},
"node_modules/@octokit/graphql": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-7.0.2.tgz",
"integrity": "sha512-OJ2iGMtj5Tg3s6RaXH22cJcxXRi7Y3EBqbHTBRq+PQAqfaS8f/236fUrWhfSn8P4jovyzqucxme7/vWSSZBX2Q==",
"dependencies": {
"@octokit/request": "^8.0.1",
"@octokit/types": "^12.0.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/openapi-types": {
"version": "20.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-20.0.0.tgz",
"integrity": "sha512-EtqRBEjp1dL/15V7WiX5LJMIxxkdiGJnabzYx5Apx4FkQIFgAfKumXeYAqqJCj1s+BMX4cPFIFC4OLCR6stlnA=="
},
"node_modules/@octokit/plugin-paginate-rest": {
"version": "9.2.2",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-9.2.2.tgz",
"integrity": "sha512-u3KYkGF7GcZnSD/3UP0S7K5XUFT2FkOQdcfXZGZQPGv3lm4F2Xbf71lvjldr8c1H3nNbF+33cLEkWYbokGWqiQ==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^12.6.0"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": "5"
}
},
"node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "10.4.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-10.4.1.tgz",
"integrity": "sha512-xV1b+ceKV9KytQe3zCVqjg+8GTGfDYwaT1ATU5isiUyVtlVAO3HNdzpS4sr4GBx4hxQ46s7ITtZrAsxG22+rVg==",
"dependencies": {
"@octokit/types": "^12.6.0"
},
"engines": {
"node": ">= 18"
},
"peerDependencies": {
"@octokit/core": "5"
}
},
"node_modules/@octokit/request": {
"version": "8.4.1",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.1.tgz",
"integrity": "sha512-qnB2+SY3hkCmBxZsR/MPCybNmbJe4KAlfWErXq+rBKkQJlbjdJeS85VI9r8UqeLYLvnAenU8Q1okM/0MBsAGXw==",
"license": "MIT",
"dependencies": {
"@octokit/endpoint": "^9.0.6",
"@octokit/request-error": "^5.1.1",
"@octokit/types": "^13.1.0",
"universal-user-agent": "^6.0.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/request-error": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.1.tgz",
"integrity": "sha512-v9iyEQJH6ZntoENr9/yXxjuezh4My67CBSu9r6Ve/05Iu5gNgnisNWOsoJHTP6k0Rr0+HQIpnH+kyammu90q/g==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^13.1.0",
"deprecation": "^2.0.0",
"once": "^1.4.0"
},
"engines": {
"node": ">= 18"
}
},
"node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": {
"version": "24.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
"integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
"license": "MIT"
},
"node_modules/@octokit/request-error/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
"integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^24.2.0"
}
},
"node_modules/@octokit/request/node_modules/@octokit/openapi-types": {
"version": "24.2.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-24.2.0.tgz",
"integrity": "sha512-9sIH3nSUttelJSXUrmGzl7QUBFul0/mB8HRYl3fOlgHbIWG+WnYDXU3v/2zMtAvuzZ/ed00Ei6on975FhBfzrg==",
"license": "MIT"
},
"node_modules/@octokit/request/node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
"integrity": "sha512-ifLaO34EbbPj0Xgro4G5lP5asESjwHracYJvVaPIyXMuiuXLlhic3S47cBdTb+jfODkTE5YtGCLt3Ay3+J97sA==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^24.2.0"
}
},
"node_modules/@octokit/types": {
"version": "12.6.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-12.6.0.tgz",
"integrity": "sha512-1rhSOfRa6H9w4YwK0yrf5faDaDTb+yLyBUKOCV4xtCDB5VmIPqd/v9yr9o6SAzOAlRxMiRiCic6JVM1/kunVkw==",
"dependencies": {
"@octokit/openapi-types": "^20.0.0"
}
},
"node_modules/@oxc-parser/binding-android-arm64": {
"version": "0.99.0",
"resolved": "https://registry.npmjs.org/@oxc-parser/binding-android-arm64/-/binding-android-arm64-0.99.0.tgz",
@ -4994,10 +5195,9 @@
"dev": true
},
"node_modules/before-after-hook": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz",
"integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==",
"license": "Apache-2.0"
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz",
"integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ=="
},
"node_modules/brace-expansion": {
"version": "2.0.2",
@ -5712,6 +5912,11 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/deprecation": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz",
"integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ=="
},
"node_modules/detect-newline": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz",
@ -5731,9 +5936,9 @@
}
},
"node_modules/docker-compose": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-1.3.1.tgz",
"integrity": "sha512-rF0wH69G3CCcmkN9J1RVMQBaKe8o77LT/3XmqcLIltWWVxcWAzp2TnO7wS3n/umZHN3/EVrlT3exSBMal+Ou1w==",
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/docker-compose/-/docker-compose-1.3.0.tgz",
"integrity": "sha512-7Gevk/5eGD50+eMD+XDnFnOrruFkL0kSd7jEG4cjmqweDSUhB7i0g8is/nBdVpl+Bx338SqIB2GLKm32M+Vs6g==",
"license": "MIT",
"dependencies": {
"yaml": "^2.2.2"
@ -9583,7 +9788,6 @@
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
"dev": true,
"dependencies": {
"wrappy": "1"
}
@ -10359,9 +10563,10 @@
}
},
"node_modules/semver": {
"version": "7.7.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz",
"integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==",
"version": "7.7.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
"integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
@ -11252,12 +11457,15 @@
}
},
"node_modules/undici": {
"version": "6.23.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.23.0.tgz",
"integrity": "sha512-VfQPToRA5FZs/qJxLIinmU59u0r7LXqoJkCzinq3ckNJp3vKEh7jTWN589YQ5+aoAC/TGRLyJLCPKcLQbM8r9g==",
"version": "5.29.0",
"resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
"integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
"license": "MIT",
"dependencies": {
"@fastify/busboy": "^2.0.0"
},
"engines": {
"node": ">=18.17"
"node": ">=14.0"
}
},
"node_modules/undici-types": {
@ -11281,10 +11489,9 @@
}
},
"node_modules/universal-user-agent": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
"integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
"license": "ISC"
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz",
"integrity": "sha512-yCzhz6FN2wU1NiiQRogkTQszlQSlpWaw8SvVegAc+bDxbzHgh1vX8uIe8OYyMH6DwH+sdTJsgMl36+mSMdRJIQ=="
},
"node_modules/unrs-resolver": {
"version": "1.11.1",
@ -11601,8 +11808,7 @@
"node_modules/wrappy": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
"dev": true
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
},
"node_modules/write-file-atomic": {
"version": "4.0.2",

View File

@ -6,7 +6,6 @@
"license": "MIT",
"homepage": "https://github.com/hoverkraft-tech/compose-action",
"private": true,
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/hoverkraft-tech/compose-action.git"
@ -25,11 +24,11 @@
"node": ">=20"
},
"dependencies": {
"@actions/core": "^3.0.0",
"@actions/github": "^9.0.0",
"@actions/tool-cache": "^4.0.0",
"@actions/core": "^2.0.2",
"@actions/github": "^7.0.0",
"@actions/tool-cache": "^3.0.0",
"@octokit/action": "^8.0.4",
"docker-compose": "^1.3.1"
"docker-compose": "^1.3.0"
},
"devDependencies": {
"@ts-dev-tools/core": "^1.9.14",
@ -47,20 +46,18 @@
"all": "npm run format && npm run lint:ci && npm run test:ci && npm run package",
"build": "tsc --noEmit",
"format": "prettier --cache --write .",
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js --detectOpenHandles --forceExit --maxWorkers=50%",
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch --maxWorkers=25%",
"jest": "jest --detectOpenHandles --forceExit",
"test": "npm run jest -- --maxWorkers=50%",
"test:watch": "npm run jest --watch -- --maxWorkers=25%",
"test:cov": "npm run test -- --coverage",
"test:ci": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage --runInBand --detectOpenHandles --forceExit",
"test:ci": "npm run jest -- --coverage --runInBand",
"prepare": "ts-dev-tools install"
},
"jest": {
"preset": "ts-jest/presets/default-esm",
"preset": "ts-jest",
"verbose": true,
"clearMocks": true,
"testEnvironment": "node",
"extensionsToTreatAsEsm": [
".ts"
],
"moduleFileExtensions": [
"js",
"ts"
@ -74,19 +71,9 @@
"/node_modules/",
"/dist/"
],
"moduleNameMapper": {
"^(\\.{1,2}/.*)\\.js$": "$1"
},
"transform": {
"^.+\\.ts$": [
"ts-jest",
{
"useESM": true,
"tsconfig": "tsconfig.json"
}
]
"^.+\\.ts$": "ts-jest"
},
"injectGlobals": true,
"coverageReporters": [
"json-summary",
"text",

View File

@ -1,46 +1,15 @@
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock @actions/core
const setFailedMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
setFailed: setFailedMock,
getInput: jest.fn().mockReturnValue(""),
getMultilineInput: jest.fn().mockReturnValue([]),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock docker-compose
jest.unstable_mockModule("docker-compose", () => ({
upAll: jest.fn(),
upMany: jest.fn(),
down: jest.fn(),
logs: jest.fn(),
version: jest
.fn<() => Promise<{ data: { version: string } }>>()
.mockResolvedValue({ data: { version: "1.2.3" } }),
}));
// Mock node:fs
jest.unstable_mockModule("node:fs", () => ({
existsSync: jest.fn().mockReturnValue(true),
default: { existsSync: jest.fn().mockReturnValue(true) },
}));
// Dynamic imports after mock setup
const { run } = await import("./index-runner.js");
const { InputService } = await import("./services/input.service.js");
const { LoggerService, LogLevel } = await import("./services/logger.service.js");
const { DockerComposeInstallerService } = await import(
"./services/docker-compose-installer.service.js"
);
const { DockerComposeService } = await import("./services/docker-compose.service.js");
import * as core from "@actions/core";
import { InputService } from "./services/input.service";
import { LoggerService, LogLevel } from "./services/logger.service";
import { DockerComposeInstallerService } from "./services/docker-compose-installer.service";
import * as indexRunner from "./index-runner";
import { DockerComposeService } from "./services/docker-compose.service";
describe("run", () => {
// Mock the external libraries and services used by the action
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let installMock: jest.SpiedFunction<typeof DockerComposeInstallerService.prototype.install>;
let upMock: jest.SpiedFunction<typeof DockerComposeService.prototype.up>;
@ -48,8 +17,9 @@ describe("run", () => {
beforeEach(() => {
jest.clearAllMocks();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation(() => {});
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation(() => {});
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation();
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation();
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
getInputsMock = jest.spyOn(InputService.prototype, "getInputs");
installMock = jest.spyOn(DockerComposeInstallerService.prototype, "install");
upMock = jest.spyOn(DockerComposeService.prototype, "up");
@ -75,7 +45,7 @@ describe("run", () => {
upMock.mockResolvedValue();
// Act
await run();
await indexRunner.run();
// Assert
expect(infoMock).toHaveBeenCalledWith("Setting up docker compose version 1.29.2");
@ -119,7 +89,7 @@ describe("run", () => {
}));
// Act
await run();
await indexRunner.run();
// Assert
expect(upMock).toHaveBeenCalledWith({
@ -153,7 +123,7 @@ describe("run", () => {
}));
// Act
await run();
await indexRunner.run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith("Error: Test error");
@ -178,7 +148,7 @@ describe("run", () => {
}));
// Act
await run();
await indexRunner.run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith('"Test error"');

View File

@ -1,9 +1,9 @@
import { setFailed } from "@actions/core";
import { InputService } from "./services/input.service.js";
import { LoggerService } from "./services/logger.service.js";
import { DockerComposeService } from "./services/docker-compose.service.js";
import { DockerComposeInstallerService } from "./services/docker-compose-installer.service.js";
import { ManualInstallerAdapter } from "./services/installer-adapter/manual-installer-adapter.js";
import { InputService } from "./services/input.service";
import { LoggerService } from "./services/logger.service";
import { DockerComposeService } from "./services/docker-compose.service";
import { DockerComposeInstallerService } from "./services/docker-compose-installer.service";
import { ManualInstallerAdapter } from "./services/installer-adapter/manual-installer-adapter";
/**
* The run function for the action.

View File

@ -1,42 +1,10 @@
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock @actions/core
const setFailedMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
setFailed: setFailedMock,
getInput: jest.fn().mockReturnValue(""),
getMultilineInput: jest.fn().mockReturnValue([]),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock docker-compose
jest.unstable_mockModule("docker-compose", () => ({
upAll: jest.fn(),
upMany: jest.fn(),
down: jest.fn(),
logs: jest.fn(),
version: jest
.fn<() => Promise<{ data: { version: string } }>>()
.mockResolvedValue({ data: { version: "1.2.3" } }),
}));
// Mock node:fs
jest.unstable_mockModule("node:fs", () => ({
existsSync: jest.fn().mockReturnValue(true),
default: { existsSync: jest.fn().mockReturnValue(true) },
}));
// Dynamic imports after mock setup
const { InputService } = await import("./services/input.service.js");
const { LoggerService, LogLevel } = await import("./services/logger.service.js");
const { DockerComposeInstallerService } = await import(
"./services/docker-compose-installer.service.js"
);
const { DockerComposeService } = await import("./services/docker-compose.service.js");
import * as core from "@actions/core";
import { DockerComposeService } from "./services/docker-compose.service";
import { InputService } from "./services/input.service";
import { LoggerService, LogLevel } from "./services/logger.service";
import { DockerComposeInstallerService } from "./services/docker-compose-installer.service";
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
@ -47,8 +15,9 @@ describe("index", () => {
beforeEach(() => {
jest.clearAllMocks();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation(() => {});
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation(() => {});
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation();
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation();
getInputsMock = jest.spyOn(InputService.prototype, "getInputs");
installMock = jest.spyOn(DockerComposeInstallerService.prototype, "install");
upMock = jest.spyOn(DockerComposeService.prototype, "up");
@ -71,7 +40,8 @@ describe("index", () => {
installMock.mockResolvedValue("1.2.3");
upMock.mockResolvedValueOnce();
await import("./index.js");
// eslint-disable-next-line @typescript-eslint/no-require-imports
await require("../src/index");
await new Promise((resolve) => setTimeout(resolve, 0));
expect(infoMock).toHaveBeenNthCalledWith(1, "Setting up docker compose");

View File

@ -1,6 +1,6 @@
/**
* The entrypoint for the action.
*/
import { run } from "./index-runner.js";
import { run } from "./index-runner";
run();

View File

@ -1,55 +1,27 @@
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
import * as core from "@actions/core";
import { InputService } from "./services/input.service";
import { LoggerService, LogLevel } from "./services/logger.service";
import * as postRunner from "./post-runner";
import { DockerComposeService } from "./services/docker-compose.service";
// Mock @actions/core
const setFailedMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
setFailed: setFailedMock,
getInput: jest.fn().mockReturnValue(""),
getMultilineInput: jest.fn().mockReturnValue([]),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock docker-compose
const logsMock = jest.fn();
const downMock = jest.fn();
jest.unstable_mockModule("docker-compose", () => ({
logs: logsMock,
down: downMock,
upAll: jest.fn(),
upMany: jest.fn(),
}));
// Mock node:fs
jest.unstable_mockModule("node:fs", () => ({
existsSync: jest.fn().mockReturnValue(true),
default: { existsSync: jest.fn().mockReturnValue(true) },
}));
// Dynamic imports after mock setup
const { run } = await import("./post-runner.js");
const { InputService } = await import("./services/input.service.js");
const { LoggerService, LogLevel } = await import("./services/logger.service.js");
const { DockerComposeService } = await import("./services/docker-compose.service.js");
// Mock the external libraries and services used by the action
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let downMock: jest.SpiedFunction<typeof DockerComposeService.prototype.down>;
let logsMock: jest.SpiedFunction<typeof DockerComposeService.prototype.logs>;
describe("run", () => {
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let serviceDownMock: jest.SpiedFunction<typeof DockerComposeService.prototype.down>;
let serviceLogsMock: jest.SpiedFunction<typeof DockerComposeService.prototype.logs>;
beforeEach(() => {
jest.clearAllMocks();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation(() => {});
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation(() => {});
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation();
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation();
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
getInputsMock = jest.spyOn(InputService.prototype, "getInputs");
serviceDownMock = jest.spyOn(DockerComposeService.prototype, "down");
serviceLogsMock = jest.spyOn(DockerComposeService.prototype, "logs");
downMock = jest.spyOn(DockerComposeService.prototype, "down");
logsMock = jest.spyOn(DockerComposeService.prototype, "logs");
});
it("should bring down docker compose service(s) and log output", async () => {
@ -67,14 +39,15 @@ describe("run", () => {
serviceLogLevel: LogLevel.Debug,
}));
serviceLogsMock.mockResolvedValue({ error: "", output: "test logs" });
serviceDownMock.mockResolvedValue();
logsMock.mockResolvedValue({ error: "", output: "test logs" });
downMock.mockResolvedValue();
// Act
await run();
await postRunner.run();
// Assert
expect(serviceLogsMock).toHaveBeenCalledWith({
expect(logsMock).toHaveBeenCalledWith({
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
composeFlags: [],
@ -83,7 +56,7 @@ describe("run", () => {
serviceLogger: debugMock,
});
expect(serviceDownMock).toHaveBeenCalledWith({
expect(downMock).toHaveBeenCalledWith({
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
composeFlags: [],
@ -93,7 +66,9 @@ describe("run", () => {
});
expect(debugMock).toHaveBeenCalledWith("docker compose logs:\ntest logs");
expect(infoMock).toHaveBeenCalledWith("docker compose is down");
expect(setFailedMock).not.toHaveBeenCalled();
});
@ -112,19 +87,38 @@ describe("run", () => {
serviceLogLevel: LogLevel.Debug,
}));
serviceLogsMock.mockResolvedValue({
logsMock.mockResolvedValue({
error: "test logs error",
output: "test logs output",
});
serviceDownMock.mockResolvedValue();
downMock.mockResolvedValue();
// Act
await run();
await postRunner.run();
// Assert
expect(logsMock).toHaveBeenCalledWith({
composeFiles: ["docker-compose.yml"],
composeFlags: [],
cwd: "/current/working/dir",
dockerFlags: [],
services: [],
serviceLogger: debugMock,
});
expect(downMock).toHaveBeenCalledWith({
composeFiles: ["docker-compose.yml"],
composeFlags: [],
cwd: "/current/working/dir",
dockerFlags: [],
downFlags: [],
serviceLogger: debugMock,
});
expect(debugMock).toHaveBeenCalledWith("docker compose error:\ntest logs error");
expect(debugMock).toHaveBeenCalledWith("docker compose logs:\ntest logs output");
expect(infoMock).toHaveBeenCalledWith("docker compose is down");
});
@ -135,7 +129,7 @@ describe("run", () => {
});
// Act
await run();
await postRunner.run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith("Error: An error occurred");
@ -144,7 +138,7 @@ describe("run", () => {
it("should handle errors and call setFailed", async () => {
// Arrange
const error = new Error("Test error");
serviceDownMock.mockRejectedValue(error);
downMock.mockRejectedValue(error);
getInputsMock.mockImplementation(() => ({
dockerFlags: [],
@ -160,7 +154,7 @@ describe("run", () => {
}));
// Act
await run();
await postRunner.run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith("Error: Test error");
@ -169,7 +163,7 @@ describe("run", () => {
it("should handle unknown errors and call setFailed", async () => {
// Arrange
const error = "Test error";
serviceDownMock.mockRejectedValue(error);
downMock.mockRejectedValue(error);
getInputsMock.mockImplementation(() => ({
dockerFlags: [],
@ -185,7 +179,7 @@ describe("run", () => {
}));
// Act
await run();
await postRunner.run();
// Assert
expect(setFailedMock).toHaveBeenCalledWith('"Test error"');

View File

@ -1,7 +1,7 @@
import { setFailed } from "@actions/core";
import { InputService } from "./services/input.service.js";
import { LoggerService } from "./services/logger.service.js";
import { DockerComposeService } from "./services/docker-compose.service.js";
import { InputService } from "./services/input.service";
import { LoggerService } from "./services/logger.service";
import { DockerComposeService } from "./services/docker-compose.service";
/**
* The run function for the action.

View File

@ -1,54 +1,25 @@
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock @actions/core
const setFailedMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
setFailed: setFailedMock,
getInput: jest.fn().mockReturnValue(""),
getMultilineInput: jest.fn().mockReturnValue([]),
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock docker-compose
const logsMock = jest.fn();
const downMock = jest.fn();
jest.unstable_mockModule("docker-compose", () => ({
logs: logsMock,
down: downMock,
upAll: jest.fn(),
upMany: jest.fn(),
}));
// Mock node:fs
jest.unstable_mockModule("node:fs", () => ({
existsSync: jest.fn().mockReturnValue(true),
default: { existsSync: jest.fn().mockReturnValue(true) },
}));
// Dynamic imports after mock setup
const { InputService } = await import("./services/input.service.js");
const { LoggerService, LogLevel } = await import("./services/logger.service.js");
const { DockerComposeService } = await import("./services/docker-compose.service.js");
import * as core from "@actions/core";
import { DockerComposeService } from "./services/docker-compose.service";
import { InputService } from "./services/input.service";
import { LoggerService, LogLevel } from "./services/logger.service";
let setFailedMock: jest.SpiedFunction<typeof core.setFailed>;
let getInputsMock: jest.SpiedFunction<typeof InputService.prototype.getInputs>;
let debugMock: jest.SpiedFunction<typeof LoggerService.prototype.debug>;
let infoMock: jest.SpiedFunction<typeof LoggerService.prototype.info>;
let serviceLogsMock: jest.SpiedFunction<typeof DockerComposeService.prototype.logs>;
let serviceDownMock: jest.SpiedFunction<typeof DockerComposeService.prototype.down>;
let logsMock: jest.SpiedFunction<typeof DockerComposeService.prototype.logs>;
let downMock: jest.SpiedFunction<typeof DockerComposeService.prototype.down>;
describe("post", () => {
beforeEach(() => {
jest.clearAllMocks();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation(() => {});
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation(() => {});
setFailedMock = jest.spyOn(core, "setFailed").mockImplementation();
infoMock = jest.spyOn(LoggerService.prototype, "info").mockImplementation();
debugMock = jest.spyOn(LoggerService.prototype, "debug").mockImplementation();
getInputsMock = jest.spyOn(InputService.prototype, "getInputs");
serviceLogsMock = jest.spyOn(DockerComposeService.prototype, "logs");
serviceDownMock = jest.spyOn(DockerComposeService.prototype, "down");
logsMock = jest.spyOn(DockerComposeService.prototype, "logs");
downMock = jest.spyOn(DockerComposeService.prototype, "down");
});
it("calls run when imported", async () => {
@ -65,13 +36,14 @@ describe("post", () => {
serviceLogLevel: LogLevel.Debug,
}));
serviceLogsMock.mockResolvedValue({ error: "", output: "test logs" });
serviceDownMock.mockResolvedValueOnce();
logsMock.mockResolvedValue({ error: "", output: "test logs" });
downMock.mockResolvedValueOnce();
await import("./post.js");
// eslint-disable-next-line @typescript-eslint/no-require-imports
await require("../src/post");
await new Promise((resolve) => setTimeout(resolve, 0));
expect(serviceLogsMock).toHaveBeenCalledWith({
expect(logsMock).toHaveBeenCalledWith({
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
composeFlags: [],
@ -80,7 +52,7 @@ describe("post", () => {
serviceLogger: debugMock,
});
expect(serviceDownMock).toHaveBeenCalledWith({
expect(downMock).toHaveBeenCalledWith({
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
composeFlags: [],

View File

@ -1,6 +1,6 @@
/**
* The entrypoint for the post action.
*/
import { run } from "./post-runner.js";
import { run } from "./post-runner";
run();

View File

@ -1,32 +1,27 @@
import { jest, describe, it, expect, beforeEach, afterEach } from "@jest/globals";
import type { IDockerComposeResult } from "docker-compose";
import * as dockerCompose from "docker-compose";
import { DockerComposeInstallerService } from "./docker-compose-installer.service";
import { ManualInstallerAdapter } from "./installer-adapter/manual-installer-adapter";
import { MockAgent, setGlobalDispatcher } from "undici";
// Mock docker-compose before importing the module under test
const versionMock = jest.fn<() => Promise<IDockerComposeResult & { data: { version: string } }>>();
jest.unstable_mockModule("docker-compose", () => ({
version: versionMock,
}));
// Create manual installer adapter mock
const manualInstallerAdapterMock = {
install: jest.fn<(version: string) => Promise<void>>(),
};
// Dynamic import after mock setup
const { DockerComposeInstallerService } = await import("./docker-compose-installer.service.js");
jest.mock("docker-compose");
describe("DockerComposeInstallerService", () => {
let mockAgent: MockAgent;
let service: InstanceType<typeof DockerComposeInstallerService>;
let versionMock: jest.SpiedFunction<typeof dockerCompose.version>;
let manualInstallerAdapterMock: jest.Mocked<ManualInstallerAdapter>;
let service: DockerComposeInstallerService;
beforeEach(() => {
jest.clearAllMocks();
mockAgent = new MockAgent();
mockAgent.disableNetConnect();
service = new DockerComposeInstallerService(manualInstallerAdapterMock as never);
versionMock = jest.spyOn(dockerCompose, "version").mockImplementation();
manualInstallerAdapterMock = {
install: jest.fn(),
} as unknown as jest.Mocked<ManualInstallerAdapter>;
service = new DockerComposeInstallerService(manualInstallerAdapterMock);
});
afterEach(() => {
@ -34,29 +29,6 @@ describe("DockerComposeInstallerService", () => {
});
describe("install", () => {
it("should return current version when no version is provided", async () => {
// Arrange
versionMock.mockResolvedValue({
exitCode: 0,
out: "",
err: "",
data: {
version: "2.0.0",
},
});
// Act
const result = await service.install({
composeVersion: null,
cwd: "/path/to/cwd",
githubToken: null,
});
// Assert
expect(result).toBe("2.0.0");
expect(manualInstallerAdapterMock.install).not.toHaveBeenCalled();
});
it("should not install anything when expected version is already installed", async () => {
// Arrange
versionMock.mockResolvedValue({

View File

@ -1,7 +1,7 @@
import * as github from "@actions/github";
import { version } from "docker-compose";
import { COMPOSE_VERSION_LATEST, Inputs } from "./input.service.js";
import { ManualInstallerAdapter } from "./installer-adapter/manual-installer-adapter.js";
import { COMPOSE_VERSION_LATEST, Inputs } from "./input.service";
import { ManualInstallerAdapter } from "./installer-adapter/manual-installer-adapter";
export type InstallInputs = {
composeVersion: Inputs["composeVersion"];

View File

@ -1,46 +1,39 @@
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
import type { IDockerComposeOptions, IDockerComposeResult } from "docker-compose";
import * as dockerCompose from "docker-compose";
import { DockerComposeService, DownInputs, LogsInputs, UpInputs } from "./docker-compose.service";
// Mock docker-compose before importing the module under test
const upAllMock = jest.fn<(options: IDockerComposeOptions) => Promise<IDockerComposeResult>>();
const upManyMock =
jest.fn<(services: string[], options: IDockerComposeOptions) => Promise<IDockerComposeResult>>();
const downMock = jest.fn<(options: IDockerComposeOptions) => Promise<IDockerComposeResult>>();
const logsMock =
jest.fn<(services: string[], options: IDockerComposeOptions) => Promise<IDockerComposeResult>>();
jest.unstable_mockModule("docker-compose", () => ({
upAll: upAllMock,
upMany: upManyMock,
down: downMock,
logs: logsMock,
}));
// Dynamic import after mock setup
const { DockerComposeService } = await import("./docker-compose.service.js");
jest.mock("docker-compose");
describe("DockerComposeService", () => {
let service: InstanceType<typeof DockerComposeService>;
let service: DockerComposeService;
let upAllMock: jest.SpiedFunction<typeof dockerCompose.upAll>;
let upManyMock: jest.SpiedFunction<typeof dockerCompose.upMany>;
let downMock: jest.SpiedFunction<typeof dockerCompose.down>;
let logsMock: jest.SpiedFunction<typeof dockerCompose.logs>;
beforeEach(() => {
jest.clearAllMocks();
service = new DockerComposeService();
upAllMock = jest.spyOn(dockerCompose, "upAll").mockImplementation();
upManyMock = jest.spyOn(dockerCompose, "upMany").mockImplementation();
downMock = jest.spyOn(dockerCompose, "down").mockImplementation();
logsMock = jest.spyOn(dockerCompose, "logs").mockImplementation();
});
afterEach(() => {
jest.clearAllMocks();
});
describe("up", () => {
it("should call up with correct options", async () => {
const upInputs = {
dockerFlags: [] as string[],
const upInputs: UpInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
services: [],
composeFlags: [],
upFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
upAllMock.mockResolvedValue({ exitCode: 0, err: "", out: "" });
await service.up(upInputs);
expect(upAllMock).toHaveBeenCalledWith({
@ -56,7 +49,7 @@ describe("DockerComposeService", () => {
});
// Ensure callback is calling the service logger
const callback = (upAllMock.mock.calls[0][0] as IDockerComposeOptions)?.callback;
const callback = upAllMock?.mock?.calls[0][0]?.callback;
expect(callback).toBeDefined();
const message = "test log output";
@ -69,18 +62,16 @@ describe("DockerComposeService", () => {
});
it("should call up with specific docker flags", async () => {
const upInputs = {
const upInputs: UpInputs = {
dockerFlags: ["--context", "dev"],
composeFiles: ["docker-compose.yml"],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
services: [],
composeFlags: [],
upFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
upAllMock.mockResolvedValue({ exitCode: 0, err: "", out: "" });
await service.up(upInputs);
expect(upAllMock).toHaveBeenCalledWith({
@ -97,18 +88,16 @@ describe("DockerComposeService", () => {
});
it("should call up with specific services", async () => {
const upInputs = {
dockerFlags: [] as string[],
const upInputs: UpInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: ["helloworld2", "helloworld3"],
composeFlags: [] as string[],
composeFlags: [],
upFlags: ["--build"],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
upManyMock.mockResolvedValue({ exitCode: 0, err: "", out: "" });
await service.up(upInputs);
expect(upManyMock).toHaveBeenCalledWith(["helloworld2", "helloworld3"], {
@ -125,12 +114,12 @@ describe("DockerComposeService", () => {
});
it("should throw formatted error when upAll fails with docker-compose result", async () => {
const upInputs = {
dockerFlags: [] as string[],
const upInputs: UpInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
services: [],
composeFlags: [],
upFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -150,12 +139,12 @@ describe("DockerComposeService", () => {
});
it("should throw formatted error when upMany fails with docker-compose result", async () => {
const upInputs = {
dockerFlags: [] as string[],
const upInputs: UpInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: ["web"],
composeFlags: [] as string[],
upFlags: [] as string[],
composeFlags: [],
upFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -176,12 +165,12 @@ describe("DockerComposeService", () => {
});
it("should pass through docker-compose result without exit code", async () => {
const upInputs = {
dockerFlags: [] as string[],
const upInputs: UpInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
services: [],
composeFlags: [],
upFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -198,12 +187,12 @@ describe("DockerComposeService", () => {
});
it("should pass through standard Error objects", async () => {
const upInputs = {
dockerFlags: [] as string[],
const upInputs: UpInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
services: [],
composeFlags: [],
upFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -215,12 +204,12 @@ describe("DockerComposeService", () => {
});
it("should pass through error strings", async () => {
const upInputs = {
dockerFlags: [] as string[],
const upInputs: UpInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
services: [],
composeFlags: [],
upFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -232,12 +221,12 @@ describe("DockerComposeService", () => {
});
it("should handle unknown error types gracefully", async () => {
const upInputs = {
dockerFlags: [] as string[],
const upInputs: UpInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: [] as string[],
composeFlags: [] as string[],
upFlags: [] as string[],
services: [],
composeFlags: [],
upFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -251,17 +240,15 @@ describe("DockerComposeService", () => {
describe("down", () => {
it("should call down with correct options", async () => {
const downInputs = {
dockerFlags: [] as string[],
composeFiles: [] as string[],
composeFlags: [] as string[],
const downInputs: DownInputs = {
dockerFlags: [],
composeFiles: [],
composeFlags: [],
downFlags: ["--volumes", "--remove-orphans"],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
downMock.mockResolvedValue({ exitCode: 0, err: "", out: "" });
await service.down(downInputs);
expect(downMock).toHaveBeenCalledWith({
@ -278,11 +265,11 @@ describe("DockerComposeService", () => {
});
it("should throw formatted error when down fails with docker-compose result", async () => {
const downInputs = {
dockerFlags: [] as string[],
composeFiles: [] as string[],
composeFlags: [] as string[],
downFlags: [] as string[],
const downInputs: DownInputs = {
dockerFlags: [],
composeFiles: [],
composeFlags: [],
downFlags: [],
cwd: "/current/working/dir",
serviceLogger: jest.fn(),
};
@ -305,11 +292,11 @@ describe("DockerComposeService", () => {
describe("logs", () => {
it("should call logs with correct options", async () => {
const debugMock = jest.fn();
const logsInputs = {
dockerFlags: [] as string[],
const logsInputs: LogsInputs = {
dockerFlags: [],
composeFiles: ["docker-compose.yml"],
services: ["helloworld2", "helloworld3"],
composeFlags: [] as string[],
composeFlags: [],
cwd: "/current/working/dir",
serviceLogger: debugMock,
};
@ -318,7 +305,7 @@ describe("DockerComposeService", () => {
await service.logs(logsInputs);
expect(logsMock).toHaveBeenCalledWith(["helloworld2", "helloworld3"], {
expect(dockerCompose.logs).toHaveBeenCalledWith(["helloworld2", "helloworld3"], {
composeOptions: [],
config: ["docker-compose.yml"],
cwd: "/current/working/dir",

View File

@ -7,7 +7,7 @@ import {
upAll,
upMany,
} from "docker-compose";
import { Inputs } from "./input.service.js";
import { Inputs } from "./input.service";
type OptionsInputs = {
dockerFlags: Inputs["dockerFlags"];

View File

@ -1,36 +1,21 @@
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
// Mock @actions/core before importing the module under test
const getInputMock = jest.fn<(name: string, options?: { required?: boolean }) => string>();
const getMultilineInputMock =
jest.fn<(name: string, options?: { required?: boolean }) => string[]>();
jest.unstable_mockModule("@actions/core", () => ({
getInput: getInputMock,
getMultilineInput: getMultilineInputMock,
debug: jest.fn(),
info: jest.fn(),
warning: jest.fn(),
}));
// Mock node:fs
const existsSyncMock = jest.fn<(path: string) => boolean>();
jest.unstable_mockModule("node:fs", () => ({
existsSync: existsSyncMock,
default: { existsSync: existsSyncMock },
}));
// Dynamic imports after mock setup
const { InputService, InputNames } = await import("./input.service.js");
const { LogLevel } = await import("./logger.service.js");
import * as core from "@actions/core";
import fs from "fs";
import { InputService, InputNames } from "./input.service";
import { LogLevel } from "./logger.service";
describe("InputService", () => {
let service: InstanceType<typeof InputService>;
let service: InputService;
let getInputMock: jest.SpiedFunction<typeof core.getInput>;
let getMultilineInputMock: jest.SpiedFunction<typeof core.getMultilineInput>;
let existsSyncMock: jest.SpiedFunction<typeof fs.existsSync>;
beforeEach(() => {
jest.clearAllMocks();
existsSyncMock = jest.spyOn(fs, "existsSync").mockImplementation();
getInputMock = jest.spyOn(core, "getInput").mockImplementation();
getMultilineInputMock = jest.spyOn(core, "getMultilineInput").mockImplementation();
getMultilineInputMock.mockImplementation((inputName) => {
switch (inputName) {
case InputNames.ComposeFile:
@ -40,11 +25,13 @@ describe("InputService", () => {
}
});
getInputMock.mockReturnValue("");
service = new InputService();
});
afterEach(() => {
jest.clearAllMocks();
});
describe("getInputs", () => {
describe("docker-flags", () => {
it("should return given docker-flags input", () => {
@ -95,50 +82,6 @@ describe("InputService", () => {
expect(inputs.composeFiles).toEqual(["file1", "file2"]);
});
it("should ignore empty compose file entries", () => {
getMultilineInputMock.mockImplementation((inputName) => {
switch (inputName) {
case InputNames.ComposeFile:
return [" ", "file1"];
default:
return [];
}
});
getInputMock.mockReturnValue("");
existsSyncMock.mockReturnValue(true);
const inputs = service.getInputs();
expect(inputs.composeFiles).toEqual(["file1"]);
});
it("should accept compose file when it exists at the original path", () => {
getMultilineInputMock.mockImplementation((inputName) => {
switch (inputName) {
case InputNames.ComposeFile:
return ["./compose.yml"];
default:
return [];
}
});
getInputMock.mockImplementation((inputName) => {
switch (inputName) {
case InputNames.Cwd:
return "/current/working/directory";
default:
return "";
}
});
existsSyncMock.mockImplementation((file) => file === "./compose.yml");
const inputs = service.getInputs();
expect(inputs.composeFiles).toEqual(["./compose.yml"]);
});
it("should throws an error when a compose file does not exist", () => {
getMultilineInputMock.mockImplementation((inputName) => {
switch (inputName) {

View File

@ -1,7 +1,7 @@
import { getInput, getMultilineInput } from "@actions/core";
import { existsSync } from "node:fs";
import { join } from "node:path";
import { LogLevel } from "./logger.service.js";
import { existsSync } from "fs";
import { join } from "path";
import { LogLevel } from "./logger.service";
export type Inputs = {
dockerFlags: string[];

View File

@ -1,42 +1,33 @@
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
import type { ExecOptions } from "@actions/exec";
import { ManualInstallerAdapter } from "./manual-installer-adapter";
import * as exec from "@actions/exec";
import * as io from "@actions/io";
import * as toolCache from "@actions/tool-cache";
// Mock @actions/exec
const execMock =
jest.fn<(command: string, args?: string[], options?: ExecOptions) => Promise<number>>();
jest.unstable_mockModule("@actions/exec", () => ({
exec: execMock,
}));
// Mock @actions/io
const mkdirPMock = jest.fn<(fsPath: string) => Promise<void>>();
jest.unstable_mockModule("@actions/io", () => ({
mkdirP: mkdirPMock,
}));
// Mock @actions/tool-cache
const cacheFileMock = jest.fn<() => Promise<string>>();
const downloadToolMock = jest.fn<() => Promise<string>>();
jest.unstable_mockModule("@actions/tool-cache", () => ({
cacheFile: cacheFileMock,
downloadTool: downloadToolMock,
}));
// Dynamic import after mock setup
const { ManualInstallerAdapter } = await import("./manual-installer-adapter.js");
jest.mock("@actions/exec");
jest.mock("@actions/io");
jest.mock("@actions/tool-cache");
describe("ManualInstallerAdapter", () => {
let adapter: InstanceType<typeof ManualInstallerAdapter>;
let mkdirPMock: jest.SpiedFunction<typeof io.mkdirP>;
let execMock: jest.SpiedFunction<typeof exec.exec>;
let cacheFileMock: jest.SpiedFunction<typeof toolCache.cacheFile>;
let downloadToolMock: jest.SpiedFunction<typeof toolCache.downloadTool>;
let adapter: ManualInstallerAdapter;
beforeEach(() => {
jest.clearAllMocks();
delete process.env.DOCKER_CONFIG;
mkdirPMock = jest.spyOn(io, "mkdirP").mockImplementation();
execMock = jest.spyOn(exec, "exec").mockImplementation();
cacheFileMock = jest.spyOn(toolCache, "cacheFile").mockImplementation();
downloadToolMock = jest.spyOn(toolCache, "downloadTool").mockImplementation();
adapter = new ManualInstallerAdapter();
});
afterEach(() => {
jest.clearAllMocks();
});
describe("install", () => {
it("should install docker compose correctly", async () => {
// Arrange
@ -77,32 +68,6 @@ describe("ManualInstallerAdapter", () => {
);
});
it("should use DOCKER_CONFIG when set", async () => {
// Arrange
const version = "v2.29.0";
execMock.mockImplementationOnce(async (_command, _args, options) => {
options?.listeners?.stdout?.(Buffer.from("Linux\n"));
return 0;
});
execMock.mockImplementationOnce(async (_command, _args, options) => {
options?.listeners?.stdout?.(Buffer.from("x86_64\n"));
return 0;
});
process.env.DOCKER_CONFIG = "/custom/docker";
// Act
await adapter.install(version);
// Assert
expect(downloadToolMock).toHaveBeenCalledWith(
"https://github.com/docker/compose/releases/download/v2.29.0/docker-compose-Linux-x86_64",
"/custom/docker/cli-plugins/docker-compose"
);
});
it("should handle version without 'v' prefix", async () => {
// Arrange
const version = "2.29.0";
@ -135,35 +100,6 @@ describe("ManualInstallerAdapter", () => {
);
});
it("should not add 'v' prefix for 1.x versions", async () => {
// Arrange
const version = "1.29.0";
execMock.mockImplementationOnce(async (_command, _args, options) => {
options?.listeners?.stdout?.(Buffer.from("Linux\n"));
return 0;
});
execMock.mockImplementationOnce(async (_command, _args, options) => {
options?.listeners?.stdout?.(Buffer.from("x86_64\n"));
return 0;
});
delete process.env.DOCKER_CONFIG;
Object.defineProperty(process.env, "HOME", {
value: "/home/test",
});
// Act
await adapter.install(version);
// Assert
expect(downloadToolMock).toHaveBeenCalledWith(
"https://github.com/docker/compose/releases/download/1.29.0/docker-compose-Linux-x86_64",
"/home/test/.docker/cli-plugins/docker-compose"
);
});
it("should throw an error if a command fails", async () => {
// Arrange
const version = "v2.29.0";

View File

@ -1,8 +1,8 @@
import { exec } from "@actions/exec";
import { mkdirP } from "@actions/io";
import { basename } from "node:path";
import { basename } from "path";
import { cacheFile, downloadTool } from "@actions/tool-cache";
import { DockerComposeInstallerAdapter } from "./docker-compose-installer-adapter.js";
import { DockerComposeInstallerAdapter } from "./docker-compose-installer-adapter";
export class ManualInstallerAdapter implements DockerComposeInstallerAdapter {
async install(version: string): Promise<void> {

View File

@ -1,51 +1,46 @@
import { jest, describe, it, expect, beforeEach } from "@jest/globals";
import { LoggerService, LogLevel } from "./logger.service";
import { debug, info, warning } from "@actions/core";
// Import types directly from the module
import type { LogLevel as LogLevelType } from "./logger.service.js";
// Mock @actions/core before importing the module under test
const warningMock = jest.fn();
const infoMock = jest.fn();
const debugMock = jest.fn();
jest.unstable_mockModule("@actions/core", () => ({
warning: warningMock,
info: infoMock,
debug: debugMock,
jest.mock("@actions/core", () => ({
warning: jest.fn(),
info: jest.fn(),
debug: jest.fn(),
}));
// Dynamic import after mock setup
const { LoggerService, LogLevel } = await import("./logger.service.js");
describe("LoggerService", () => {
let loggerService: InstanceType<typeof LoggerService>;
let loggerService: LoggerService;
beforeEach(() => {
jest.clearAllMocks();
loggerService = new LoggerService();
});
afterEach(() => {
jest.clearAllMocks();
});
describe("warn", () => {
it("should call warning with the correct message", () => {
const message = "This is a warning message";
loggerService.warn(message);
expect(warningMock).toHaveBeenCalledWith(message);
expect(warning).toHaveBeenCalledWith(message);
});
});
describe("info", () => {
it("should call info with the correct message", () => {
const message = "This is an info message";
loggerService.info(message);
expect(infoMock).toHaveBeenCalledWith(message);
expect(info).toHaveBeenCalledWith(message);
});
});
describe("debug", () => {
it("should call debug with the correct message", () => {
const message = "This is a debug message";
loggerService.debug(message);
expect(debugMock).toHaveBeenCalledWith(message);
expect(debug).toHaveBeenCalledWith(message);
});
});
@ -61,7 +56,7 @@ describe("LoggerService", () => {
});
it("should default to info level if an unknown level is provided", () => {
const logger = loggerService.getServiceLogger("unknown" as LogLevelType);
const logger = loggerService.getServiceLogger("unknown" as LogLevel);
expect(logger).toBe(loggerService.info);
});
});