mirror of
https://github.com/threeal/cmake-action.git
synced 2025-06-08 18:21:20 +00:00
build: initialize JavaScript Action project (#69)
* build: initialize JavaScript action project * chore(dependabot): check for npm package updates * style: ignore `main` dir and `README.md` from being formatted * ci: add Build workflow that contains Build Package job * ci: add Test Package job in the Test workflow * test: add an empty `main.test.ts` test * chore: adjust Git attributes for `main/index.mjs` file * docs(readme): add a build status badge
This commit is contained in:
parent
d27fb54a3f
commit
ed7c2d179c
28
.eslintrc.json
Normal file
28
.eslintrc.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"root": true,
|
||||||
|
"extends": ["eslint:recommended", "prettier"],
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 2022,
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["**/*.mts", "**/*.ts"],
|
||||||
|
"extends": ["plugin:@typescript-eslint/recommended"],
|
||||||
|
"parser": "@typescript-eslint/parser",
|
||||||
|
"parserOptions": {
|
||||||
|
"project": ["tsconfig.eslint.json"]
|
||||||
|
},
|
||||||
|
"plugins": ["@typescript-eslint", "eslint-plugin-tsdoc"],
|
||||||
|
"rules": {
|
||||||
|
"tsdoc/syntax": "error"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["**/*.test.*"],
|
||||||
|
"env": {
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
main/index.mjs -diff linguist-generated=true
|
9
.github/dependabot.yaml
vendored
9
.github/dependabot.yaml
vendored
@ -7,3 +7,12 @@ updates:
|
|||||||
commit-message:
|
commit-message:
|
||||||
prefix: chore
|
prefix: chore
|
||||||
labels: [chore]
|
labels: [chore]
|
||||||
|
|
||||||
|
- package-ecosystem: npm
|
||||||
|
directory: /
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
commit-message:
|
||||||
|
prefix: chore
|
||||||
|
labels: [chore]
|
||||||
|
versioning-strategy: increase
|
||||||
|
39
.github/workflows/build.yaml
vendored
Normal file
39
.github/workflows/build.yaml
vendored
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
name: Build
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
jobs:
|
||||||
|
build-package:
|
||||||
|
name: Build Package
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4.0.0
|
||||||
|
with:
|
||||||
|
node-version: latest
|
||||||
|
|
||||||
|
- name: Update Yarn
|
||||||
|
run: corepack enable && yarn set version stable
|
||||||
|
|
||||||
|
- name: Cache deps
|
||||||
|
uses: actions/cache@v3.3.2
|
||||||
|
with:
|
||||||
|
path: .yarn
|
||||||
|
key: yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
run: yarn install
|
||||||
|
|
||||||
|
- name: Check lib
|
||||||
|
run: yarn check
|
||||||
|
|
||||||
|
- name: Bundle dist
|
||||||
|
run: yarn bundle
|
||||||
|
|
||||||
|
- name: Check diff
|
||||||
|
run: git diff --exit-code HEAD
|
30
.github/workflows/test.yml
vendored
30
.github/workflows/test.yml
vendored
@ -5,6 +5,36 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches: [latest, main]
|
branches: [latest, main]
|
||||||
jobs:
|
jobs:
|
||||||
|
test-package:
|
||||||
|
name: Test Package
|
||||||
|
runs-on: ${{ matrix.os }}-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
os: [windows, ubuntu, macos]
|
||||||
|
env:
|
||||||
|
NODE_OPTIONS: --experimental-vm-modules
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4.1.1
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4.0.0
|
||||||
|
with:
|
||||||
|
node-version: latest
|
||||||
|
|
||||||
|
- name: Cache deps
|
||||||
|
uses: actions/cache@v3.3.2
|
||||||
|
with:
|
||||||
|
path: .yarn
|
||||||
|
key: yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
|
||||||
|
|
||||||
|
- name: Install deps
|
||||||
|
run: corepack enable && yarn install
|
||||||
|
|
||||||
|
- name: Test lib
|
||||||
|
run: yarn test
|
||||||
|
|
||||||
default-usage:
|
default-usage:
|
||||||
runs-on: ${{ matrix.os }}-latest
|
runs-on: ${{ matrix.os }}-latest
|
||||||
strategy:
|
strategy:
|
||||||
|
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,4 +1,8 @@
|
|||||||
.*
|
.*
|
||||||
|
!.eslint*
|
||||||
!.git*
|
!.git*
|
||||||
|
|
||||||
build
|
build/
|
||||||
|
coverage/
|
||||||
|
dist/
|
||||||
|
node_modules/
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
[](https://github.com/threeal/cmake-action/releases/)
|
[](https://github.com/threeal/cmake-action/releases/)
|
||||||
[](./LICENSE)
|
[](./LICENSE)
|
||||||
|
[](https://github.com/threeal/cmake-action/actions/workflows/build.yaml)
|
||||||
[](https://github.com/threeal/cmake-action/actions/workflows/test.yml)
|
[](https://github.com/threeal/cmake-action/actions/workflows/test.yml)
|
||||||
|
|
||||||
Configure, build, and test your [CMake](https://cmake.org/) project using [GitHub Actions](https://github.com/features/actions). This action simplifies the workflow for configuring the build environment of a CMake project. It can also be optionally specified to build a CMake project using the `cmake --build` command and test it using the `ctest` command.
|
Configure, build, and test your [CMake](https://cmake.org/) project using [GitHub Actions](https://github.com/features/actions). This action simplifies the workflow for configuring the build environment of a CMake project. It can also be optionally specified to build a CMake project using the `cmake --build` command and test it using the `ctest` command.
|
||||||
|
19
jest.config.json
Normal file
19
jest.config.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"collectCoverage": true,
|
||||||
|
"coverageThreshold": {
|
||||||
|
"global": {
|
||||||
|
"branches": 100,
|
||||||
|
"functions": 100,
|
||||||
|
"lines": 100,
|
||||||
|
"statements": 100
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"extensionsToTreatAsEsm": [".ts", ".mts"],
|
||||||
|
"moduleNameMapper": {
|
||||||
|
"^(\\.{1,2}/.*)\\.mjs$": "$1.mts"
|
||||||
|
},
|
||||||
|
"testMatch": ["**/*.test.ts"],
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.m?ts$": ["ts-jest", { "useESM": true }]
|
||||||
|
}
|
||||||
|
}
|
8
main/index.mjs
generated
Normal file
8
main/index.mjs
generated
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/******/ /* webpack/runtime/compat */
|
||||||
|
/******/
|
||||||
|
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = new URL('.', import.meta.url).pathname.slice(import.meta.url.match(/^file:\/\/\/\w:/) ? 1 : 0, -1) + "/";
|
||||||
|
/******/
|
||||||
|
/************************************************************************/
|
||||||
|
var __webpack_exports__ = {};
|
||||||
|
|
||||||
|
//# sourceMappingURL=main.mjs.map
|
27
package.json
Normal file
27
package.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"name": "cmake-action",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"bundle": "tsc && ncc build dist/main.mjs -o main",
|
||||||
|
"check": "sort-package-json && prettier --write . !main !README.md && eslint src",
|
||||||
|
"test": "jest"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@jest/globals": "^29.7.0",
|
||||||
|
"@types/jest": "^29.5.8",
|
||||||
|
"@types/node": "^20.9.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.11.0",
|
||||||
|
"@typescript-eslint/parser": "^6.11.0",
|
||||||
|
"@vercel/ncc": "^0.38.1",
|
||||||
|
"eslint": "^8.53.0",
|
||||||
|
"eslint-config-prettier": "^9.0.0",
|
||||||
|
"eslint-plugin-tsdoc": "^0.2.17",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"prettier": "^3.1.0",
|
||||||
|
"sort-package-json": "^2.6.0",
|
||||||
|
"ts-jest": "^29.1.1",
|
||||||
|
"typescript": "^5.2.2"
|
||||||
|
},
|
||||||
|
"packageManager": "yarn@4.0.2"
|
||||||
|
}
|
0
src/main.mts
Normal file
0
src/main.mts
Normal file
1
src/main.test.ts
Normal file
1
src/main.test.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
test("some test", () => {});
|
4
tsconfig.eslint.json
Normal file
4
tsconfig.eslint.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"exclude": []
|
||||||
|
}
|
17
tsconfig.json
Normal file
17
tsconfig.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"strict": true,
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"declaration": true,
|
||||||
|
"outDir": "dist",
|
||||||
|
"sourceMap": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"lib": ["ES2022"],
|
||||||
|
"target": "ES2022",
|
||||||
|
"skipLibCheck": true
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"exclude": ["**/*.test.*"]
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user