diff --git a/configure/README.md b/configure/README.md new file mode 100644 index 0000000..285d5db --- /dev/null +++ b/configure/README.md @@ -0,0 +1,9 @@ +# Configure CMake Action + +Configure [CMake](https://cmake.org/) projects on [GitHub Actions](https://github.com/features/actions). + +## License + +This project is licensed under the terms of the [MIT License](../LICENSE). + +Copyright © 2023-2024 [Alfi Maulana](https://github.com/threeal/) diff --git a/configure/action.yml b/configure/action.yml new file mode 100644 index 0000000..6e37a12 --- /dev/null +++ b/configure/action.yml @@ -0,0 +1,32 @@ +name: Configure CMake Action +description: Configure CMake projects +author: Alfi Maulana +branding: + color: gray-dark + icon: terminal +inputs: + source-dir: + description: The source directory of the CMake project + build-dir: + description: The build directory of the CMake project + generator: + description: The build system generator for the CMake project + c-compiler: + description: The preferred executable for compiling C language files + cxx-compiler: + description: The preferred executable for compiling C++ language files + c-flags: + description: Additional flags to pass when compiling C language files + cxx-flags: + description: Additional flags to pass when compiling C++ language files + options: + description: Additional options to pass during the CMake configuration + args: + description: Additional arguments to pass during the CMake configuration +outputs: + build-dir: + description: The build directory of the CMake project + value: ${{ steps.process-inputs.outputs.build-dir }} +runs: + using: node20 + main: dist/action.mjs diff --git a/configure/eslint.config.js b/configure/eslint.config.js new file mode 100644 index 0000000..99f3dcf --- /dev/null +++ b/configure/eslint.config.js @@ -0,0 +1,11 @@ +import eslint from "@eslint/js"; +import tseslint from "typescript-eslint"; + +export default [ + eslint.configs.recommended, + ...tseslint.configs.recommended, + ...tseslint.configs.stylistic, + { + ignores: [".*", "dist"], + }, +]; diff --git a/configure/jest.config.json b/configure/jest.config.json new file mode 100644 index 0000000..8cc69af --- /dev/null +++ b/configure/jest.config.json @@ -0,0 +1,20 @@ +{ + "collectCoverage": true, + "coverageReporters": ["text"], + "coverageThreshold": { + "global": { + "branches": 100, + "functions": 100, + "lines": 100, + "statements": 100 + } + }, + "moduleNameMapper": { + "^(\\.{1,2}/.*)\\.js$": "$1" + }, + "preset": "ts-jest/presets/default-esm", + "transform": { + "^.+\\.ts$": ["ts-jest", { "useESM": true }] + }, + "verbose": true +} diff --git a/configure/package.json b/configure/package.json new file mode 100644 index 0000000..1193872 --- /dev/null +++ b/configure/package.json @@ -0,0 +1,34 @@ +{ + "name": "cmake-action-configure", + "private": true, + "type": "module", + "workspaces": [ + "lib/*" + ], + "scripts": { + "build": "rollup -c", + "format": "prettier --write --cache . !dist !README.md", + "lint": "eslint", + "test": "jest" + }, + "dependencies": { + "gha-utils": "^0.1.0" + }, + "devDependencies": { + "@eslint/js": "^9.8.0", + "@jest/globals": "^29.7.0", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-typescript": "^11.1.6", + "@types/jest": "^29.5.12", + "@types/node": "^22.1.0", + "eslint": "^9.8.0", + "jest": "^29.7.0", + "prettier": "^3.3.3", + "rollup": "^4.20.0", + "ts-jest": "^29.2.4", + "tslib": "^2.6.3", + "typescript": "^5.5.4", + "typescript-eslint": "^8.0.0" + }, + "packageManager": "yarn@4.4.0" +} diff --git a/configure/rollup.config.js b/configure/rollup.config.js new file mode 100644 index 0000000..5119846 --- /dev/null +++ b/configure/rollup.config.js @@ -0,0 +1,11 @@ +import { nodeResolve } from "@rollup/plugin-node-resolve"; +import typescript from "@rollup/plugin-typescript"; + +export default { + input: "src/action.ts", + output: { + dir: "dist", + entryFileNames: "[name].mjs", + }, + plugins: [nodeResolve(), typescript()], +}; diff --git a/configure/tsconfig.json b/configure/tsconfig.json new file mode 100644 index 0000000..17b1233 --- /dev/null +++ b/configure/tsconfig.json @@ -0,0 +1,13 @@ +{ + "include": ["src"], + "exclude": ["**/*.test.ts"], + "compilerOptions": { + "exactOptionalPropertyTypes": true, + "strict": true, + "module": "node16", + "moduleResolution": "node16", + "esModuleInterop": true, + "target": "es2022", + "skipLibCheck": true + } +} diff --git a/package.json b/package.json index b8e6f87..fa7c950 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "root", + "name": "cmake-action", "private": true, "type": "module", "scripts": { diff --git a/yarn.lock b/yarn.lock index b8e7102..5a65873 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1737,6 +1737,28 @@ __metadata: languageName: node linkType: hard +"cmake-action@workspace:.": + version: 0.0.0-use.local + resolution: "cmake-action@workspace:." + dependencies: + "@eslint/js": "npm:^9.8.0" + "@jest/globals": "npm:^29.7.0" + "@rollup/plugin-node-resolve": "npm:^15.2.3" + "@rollup/plugin-typescript": "npm:^11.1.6" + "@types/jest": "npm:^29.5.12" + "@types/node": "npm:^22.1.0" + eslint: "npm:^9.8.0" + gha-utils: "npm:^0.1.0" + jest: "npm:^29.7.0" + prettier: "npm:^3.3.3" + rollup: "npm:^4.20.0" + ts-jest: "npm:^29.2.4" + tslib: "npm:^2.6.3" + typescript: "npm:^5.5.4" + typescript-eslint: "npm:^8.0.0" + languageName: unknown + linkType: soft + "co@npm:^4.6.0": version: 4.6.0 resolution: "co@npm:4.6.0" @@ -4122,28 +4144,6 @@ __metadata: languageName: node linkType: hard -"root@workspace:.": - version: 0.0.0-use.local - resolution: "root@workspace:." - dependencies: - "@eslint/js": "npm:^9.8.0" - "@jest/globals": "npm:^29.7.0" - "@rollup/plugin-node-resolve": "npm:^15.2.3" - "@rollup/plugin-typescript": "npm:^11.1.6" - "@types/jest": "npm:^29.5.12" - "@types/node": "npm:^22.1.0" - eslint: "npm:^9.8.0" - gha-utils: "npm:^0.1.0" - jest: "npm:^29.7.0" - prettier: "npm:^3.3.3" - rollup: "npm:^4.20.0" - ts-jest: "npm:^29.2.4" - tslib: "npm:^2.6.3" - typescript: "npm:^5.5.4" - typescript-eslint: "npm:^8.0.0" - languageName: unknown - linkType: soft - "run-parallel@npm:^1.1.9": version: 1.2.0 resolution: "run-parallel@npm:1.2.0"