From 9584ce30430c22bea516983dc183db14530c6fbe Mon Sep 17 00:00:00 2001 From: Alfi Maulana Date: Thu, 8 Aug 2024 21:03:44 +0700 Subject: [PATCH] DONT MERGE --- configure/README.md | 9 +++++++++ configure/action.yml | 32 ++++++++++++++++++++++++++++++++ configure/eslint.config.js | 11 +++++++++++ configure/jest.config.json | 20 ++++++++++++++++++++ configure/package.json | 34 ++++++++++++++++++++++++++++++++++ configure/rollup.config.js | 11 +++++++++++ configure/tsconfig.json | 13 +++++++++++++ 7 files changed, 130 insertions(+) create mode 100644 configure/README.md create mode 100644 configure/action.yml create mode 100644 configure/eslint.config.js create mode 100644 configure/jest.config.json create mode 100644 configure/package.json create mode 100644 configure/rollup.config.js create mode 100644 configure/tsconfig.json 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 + } +}