mirror of
https://github.com/sandsaber/mdMenu.git
synced 2026-07-22 07:45:30 +00:00
ci: add lint and main branch validation
This commit is contained in:
parent
2b9beee0c9
commit
a9fb80af73
12 changed files with 1243 additions and 6 deletions
34
.github/workflows/ci.yml
vendored
Normal file
34
.github/workflows/ci.yml
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Setup Node 22
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 22
|
||||
cache: 'npm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Typecheck
|
||||
run: npm run typecheck
|
||||
|
||||
- name: Test
|
||||
run: npm run test
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
|
|
@ -31,8 +31,11 @@ jobs:
|
|||
- name: Verify release tag is on main
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git fetch origin main
|
||||
git merge-base --is-ancestor "${GITHUB_SHA}" origin/main
|
||||
git fetch origin main:refs/remotes/origin/main
|
||||
if ! git merge-base --is-ancestor "${GITHUB_SHA}" origin/main; then
|
||||
echo "Release tag ${GITHUB_REF_NAME} (${GITHUB_SHA}) must point to a commit on origin/main."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
|
@ -40,6 +43,9 @@ jobs:
|
|||
- name: Runtime dependency audit
|
||||
run: npm audit --omit=dev
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
- name: Typecheck
|
||||
run: npm run typecheck
|
||||
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@ Run unit tests:
|
|||
npm run test
|
||||
```
|
||||
|
||||
Run lint checks:
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
Run TypeScript checks:
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -169,6 +169,12 @@ Tests ausfuehren:
|
|||
npm run test
|
||||
```
|
||||
|
||||
Lint-Pruefungen ausfuehren:
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
TypeScript pruefen:
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -169,6 +169,12 @@ Ejecutar pruebas:
|
|||
npm run test
|
||||
```
|
||||
|
||||
Ejecutar comprobaciones de lint:
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
Ejecutar comprobaciones de TypeScript:
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -169,6 +169,12 @@ npm install
|
|||
npm run test
|
||||
```
|
||||
|
||||
lint チェックを実行:
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
TypeScript チェックを実行:
|
||||
|
||||
```bash
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -177,7 +177,7 @@ git tag 0.1.0
|
|||
git push origin 0.1.0
|
||||
```
|
||||
|
||||
The release workflow runs on tags matching `x.y.z`. It installs dependencies with `npm ci`, runs `npm audit --omit=dev`, typechecks, runs tests, builds `dist/obmenu`, checks that the tag matches `package.json` and `manifest.json`, verifies release assets, creates GitHub artifact attestations, and publishes `main.js`, `manifest.json`, and `styles.css`.
|
||||
The release workflow runs on tags matching `x.y.z`. It installs dependencies with `npm ci`, runs `npm audit --omit=dev`, lints, typechecks, runs tests, builds `dist/obmenu`, checks that the tag matches `package.json` and `manifest.json`, verifies release assets, creates GitHub artifact attestations, and publishes `main.js`, `manifest.json`, and `styles.css`.
|
||||
|
||||
## Development
|
||||
|
||||
|
|
@ -193,6 +193,12 @@ Run tests:
|
|||
npm run test
|
||||
```
|
||||
|
||||
Run lint checks:
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
Run TypeScript checks:
|
||||
|
||||
```bash
|
||||
|
|
@ -217,7 +223,7 @@ Run the full pre-release check:
|
|||
npm run check
|
||||
```
|
||||
|
||||
`npm run check` runs tests, the production build, the release folder build, and `npm audit --omit=dev`.
|
||||
`npm run check` runs lint checks, tests, the production build, the release folder build, and `npm audit --omit=dev`.
|
||||
|
||||
## Test coverage
|
||||
|
||||
|
|
|
|||
|
|
@ -169,6 +169,12 @@ npm install
|
|||
npm run test
|
||||
```
|
||||
|
||||
Запустить lint-проверки:
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
Запустить TypeScript-проверку:
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -169,6 +169,12 @@ npm install
|
|||
npm run test
|
||||
```
|
||||
|
||||
运行 lint 检查:
|
||||
|
||||
```bash
|
||||
npm run lint
|
||||
```
|
||||
|
||||
运行 TypeScript 检查:
|
||||
|
||||
```bash
|
||||
|
|
|
|||
11
eslint.config.mjs
Normal file
11
eslint.config.mjs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import tseslint from "typescript-eslint";
|
||||
|
||||
export default tseslint.config(
|
||||
{
|
||||
ignores: ["dist/**", "main.js"],
|
||||
},
|
||||
...tseslint.configs.recommended,
|
||||
{
|
||||
files: ["src/**/*.ts", "tests/**/*.ts", "vitest.config.ts"],
|
||||
},
|
||||
);
|
||||
1141
package-lock.json
generated
1141
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -1,16 +1,17 @@
|
|||
{
|
||||
"name": "obmenu",
|
||||
"version": "0.1.0",
|
||||
"description": "A modern Markdown formatting toolbar for Obsidian.",
|
||||
"description": "A mini WYSIWYG-style Markdown formatting toolbar for Obsidian.",
|
||||
"main": "main.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "node esbuild.config.mjs",
|
||||
"lint": "eslint src tests vitest.config.ts",
|
||||
"typecheck": "tsc -noEmit -skipLibCheck",
|
||||
"build": "npm run typecheck && node esbuild.config.mjs production",
|
||||
"build:dist": "npm run typecheck && node scripts/build-dist.mjs",
|
||||
"audit": "npm audit --omit=dev",
|
||||
"check": "npm run test && npm run build && npm run build:dist && npm run audit",
|
||||
"check": "npm run lint && npm run test && npm run build && npm run build:dist && npm run audit",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
},
|
||||
|
|
@ -30,9 +31,11 @@
|
|||
"@types/node": "^25.9.3",
|
||||
"builtin-modules": "^5.2.0",
|
||||
"esbuild": "^0.28.1",
|
||||
"eslint": "^10.5.0",
|
||||
"obsidian": "^1.13.1",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^6.0.3",
|
||||
"typescript-eslint": "^8.61.0",
|
||||
"vitest": "^4.1.8"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue