mirror of
https://github.com/142vip/408CSFamily.git
synced 2026-02-03 02:23:38 +08:00
perf(CI): 简化流水线校验流程
This commit is contained in:
42
.github/workflows/CD.yaml
vendored
42
.github/workflows/CD.yaml
vendored
@@ -49,11 +49,13 @@ jobs:
|
||||
registry-url: 'https://registry.npmmirror.com'
|
||||
|
||||
- name: Install Dependencies
|
||||
run: ./scripts/ci
|
||||
run: |
|
||||
./scripts/ci
|
||||
|
||||
# 运行构建脚本
|
||||
- name: Build VuePress Site
|
||||
run: ls -a && ./scripts/bundle build_proxy
|
||||
run: |
|
||||
./scripts/bundle build_proxy
|
||||
|
||||
- name: Deploy To GitHub Page
|
||||
uses: crazy-max/ghaction-github-pages@v3
|
||||
@@ -140,4 +142,38 @@ jobs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./408CSFamily.zip
|
||||
asset_name: 408CSFamily.zip
|
||||
asset_content_type: application/zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
|
||||
# Deploy-ESC:
|
||||
# name: "部署到ESC服务器"
|
||||
# needs: install-init
|
||||
# runs-on: ubuntu-latest
|
||||
# ## 主库master、next且执行release更新时执行
|
||||
# if: github.repository == '142vip/408CSFamily' && startsWith(github.event.head_commit.message, 'chore(release):')
|
||||
#
|
||||
# steps:
|
||||
# - name: Checkout repository
|
||||
# uses: actions/checkout@v4
|
||||
#
|
||||
# - name: Get Current Version
|
||||
# id: version
|
||||
# uses: ashley-taylor/read-json-property-action@v1.0
|
||||
# with:
|
||||
# path: ./package.json
|
||||
# property: version
|
||||
#
|
||||
# # 拉取镜像,更新服务
|
||||
# - name: Pull Image And Update ESC
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ secrets.SERVER_HOST }}
|
||||
# port: ${{ secrets.SERVER_PORT }}
|
||||
# username: ${{ secrets.SERVER_USERNAME }}
|
||||
# password: ${{ secrets.SERVER_PASSWORD }}
|
||||
# script: |
|
||||
# docker images
|
||||
# echo "-----------正在运行的服务--------"
|
||||
# docker ps
|
||||
# cd /service_env/ && git reset --hard && git pull origin main
|
||||
# bash ./scripts/book_doc.deploy.sh jsc ${{steps.version.outputs.value}}
|
||||
59
.github/workflows/CI.yml
vendored
59
.github/workflows/CI.yml
vendored
@@ -10,6 +10,7 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- next
|
||||
|
||||
# 手动触发部署
|
||||
workflow_dispatch:
|
||||
|
||||
@@ -24,9 +25,11 @@ env:
|
||||
|
||||
|
||||
jobs:
|
||||
install-init:
|
||||
name: "依赖安装初始化"
|
||||
Base-Build:
|
||||
name: "基础编译构建"
|
||||
runs-on: ubuntu-latest
|
||||
## 主库且拉取PR时触发
|
||||
if: github.repository == '142vip/408CSFamily' && github.event_name == 'pull_request'
|
||||
permissions:
|
||||
actions: read
|
||||
pull-requests: read
|
||||
@@ -39,59 +42,31 @@ jobs:
|
||||
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
|
||||
fetch-depth: 0
|
||||
|
||||
# ## 依赖下载完成后,或执行思维导图编译
|
||||
# - name: PNPM Install
|
||||
# uses: pnpm/action-setup@v2
|
||||
# with:
|
||||
# version: 7
|
||||
# run_install: |
|
||||
# args: [--frozen-lockfile, --registry=https://registry.npmmirror.com]
|
||||
# 安装Node环境
|
||||
## 安装PNPM
|
||||
- name: PNPM Install
|
||||
uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 8
|
||||
|
||||
## 安装Node环境
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18.18.0
|
||||
## 淘宝镜像加速
|
||||
registry-url: 'https://registry.npmmirror.com'
|
||||
## 缓存
|
||||
cache: 'pnpm'
|
||||
|
||||
## 下载依赖,并执行初始化脚本:钩子函数、思维导图构建
|
||||
- name: Install Dependencies
|
||||
run: ./scripts/ci
|
||||
|
||||
- name: Cache Dependencies
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
|
||||
Base-Build:
|
||||
name: "基础编译构建"
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- install-init
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
persist-credentials: false
|
||||
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Restore Dependencies From Cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/pnpm-lock.yaml') }}
|
||||
run: |
|
||||
./scripts/ci
|
||||
|
||||
- name: Code LintFix
|
||||
run: |
|
||||
./scripts/lint --fix
|
||||
|
||||
## 支持思维导图转化
|
||||
- name: Build Mark-Map
|
||||
run: |
|
||||
./scripts/mark-map
|
||||
|
||||
- name: Build Site
|
||||
run: |
|
||||
./scripts/bundle build
|
||||
|
||||
19
.github/workflows/codeql-analysis.yml
vendored
19
.github/workflows/codeql-analysis.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: CodeQL
|
||||
|
||||
on:
|
||||
push:
|
||||
# push:
|
||||
pull_request:
|
||||
branches:
|
||||
- next
|
||||
@@ -13,22 +13,23 @@ jobs:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language:
|
||||
- javascript
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
queries: +security-extended
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
languages: javascript
|
||||
|
||||
- name: Auto Build
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
height: 100vh;
|
||||
}
|
||||
</style>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/style.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/markmap-toolbar@0.15.4/dist/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<svg id="mindmap"></svg>
|
||||
<script src="https://cdn.jsdelivr.net/npm/d3@7.8.5/dist/d3.min.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://cdn.jsdelivr.net/npm/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
<script src="https://unpkg.com/d3@7.8.5/dist/d3.min.js"></script><script src="https://unpkg.com/markmap-view@0.15.4/dist/browser/index.js"></script><script src="https://unpkg.com/markmap-toolbar@0.15.4/dist/index.js"></script><script>(r => {
|
||||
setTimeout(r);
|
||||
})(() => {
|
||||
const {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -35,6 +35,6 @@
|
||||
})</script><script>((getMarkmap, getOptions, root, jsonOptions) => {
|
||||
const markmap = getMarkmap();
|
||||
window.mm = markmap.Markmap.create('svg#mindmap', (getOptions || markmap.deriveOptions)(jsonOptions), root);
|
||||
})(() => window.markmap,null,{"type":"heading","depth":0,"payload":{"lines":[0,1]},"content":"操作系统","children":[{"type":"heading","depth":1,"payload":{"lines":[5,6]},"content":"引论","children":[]},{"type":"heading","depth":1,"payload":{"lines":[7,8]},"content":"进程管理","children":[]},{"type":"heading","depth":1,"payload":{"lines":[9,10]},"content":"内存管理","children":[]},{"type":"heading","depth":1,"payload":{"lines":[11,12]},"content":"一些总结","children":[]},{"type":"heading","depth":1,"payload":{"lines":[13,14]},"content":"I/O管理","children":[]},{"type":"heading","depth":1,"payload":{"lines":[15,16]},"content":"文件管理","children":[]}]},null)</script>
|
||||
})(() => window.markmap,null,{"type":"heading","depth":0,"payload":{"lines":[0,1]},"content":"操作系统","children":[{"type":"heading","depth":1,"payload":{"lines":[4,5]},"content":"引论","children":[]},{"type":"heading","depth":1,"payload":{"lines":[6,7]},"content":"进程管理","children":[]},{"type":"heading","depth":1,"payload":{"lines":[8,9]},"content":"内存管理","children":[]},{"type":"heading","depth":1,"payload":{"lines":[10,11]},"content":"一些总结","children":[]},{"type":"heading","depth":1,"payload":{"lines":[12,13]},"content":"I/O管理","children":[]},{"type":"heading","depth":1,"payload":{"lines":[14,15]},"content":"文件管理","children":[]}]},null)</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -35,6 +35,6 @@
|
||||
})</script><script>((getMarkmap, getOptions, root, jsonOptions) => {
|
||||
const markmap = getMarkmap();
|
||||
window.mm = markmap.Markmap.create('svg#mindmap', (getOptions || markmap.deriveOptions)(jsonOptions), root);
|
||||
})(() => window.markmap,null,{"type":"heading","depth":0,"payload":{"lines":[0,1]},"content":"思维导图","children":[{"type":"blockquote","depth":1,"payload":{"lines":[2,3]},"content":"","children":[{"type":"paragraph","depth":2,"payload":{"lines":[2,3]},"content":"思维导图汇总整理,内容更新慢于笔记,赶稿中...","children":[]}]},{"type":"bullet_list","depth":1,"payload":{"lines":[4,8]},"content":"","children":[{"type":"list_item","depth":2,"payload":{"lines":[4,5]},"content":"<a href=\"../../mark-map/ds-map.html\" target=\"_blank\">数据结构</a>","children":[]},{"type":"list_item","depth":2,"payload":{"lines":[5,6]},"content":"<a href=\"../../mark-map/os-map.html\" target=\"_blank\">操作系统</a>","children":[]},{"type":"list_item","depth":2,"payload":{"lines":[6,7]},"content":"<a href=\"../../mark-map/ccp-map.html\" target=\"_blank\">计算机组成原理</a>","children":[]},{"type":"list_item","depth":2,"payload":{"lines":[7,8]},"content":"<a href=\"../../mark-map/cn-map.html\" target=\"_blank\">计算机网络</a>","children":[]}]}]},null)</script>
|
||||
})(() => window.markmap,null,{"type":"heading","depth":0,"payload":{"lines":[0,1]},"content":"思维导图","children":[{"type":"blockquote","depth":1,"payload":{"lines":[2,3]},"content":"","children":[{"type":"paragraph","depth":2,"payload":{"lines":[2,3]},"content":"思维导图汇总整理,内容更新慢于笔记,赶稿中...","children":[]}]},{"type":"bullet_list","depth":1,"payload":{"lines":[4,9]},"content":"","children":[{"type":"list_item","depth":2,"payload":{"lines":[4,5]},"content":"<a href=\"../mark-map/ds-map.html\" target=\"_blank\">数据结构</a>","children":[]},{"type":"list_item","depth":2,"payload":{"lines":[5,6]},"content":"<a href=\"../mark-map/os-map.html\" target=\"_blank\">操作系统</a>","children":[]},{"type":"list_item","depth":2,"payload":{"lines":[6,7]},"content":"<a href=\"../mark-map/ccp-map.html\" target=\"_blank\">计算机组成原理</a>","children":[]},{"type":"list_item","depth":2,"payload":{"lines":[7,8]},"content":"<a href=\"../mark-map/cn-map.html\" target=\"_blank\">计算机网络</a>","children":[]}]}]},null)</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
29
scripts/ci
29
scripts/ci
@@ -1,4 +1,31 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 期望的 pnpm 大版本号
|
||||
majorVersionRequired="8"
|
||||
|
||||
# 检测 pnpm 是否已安装并且大版本号符合要求
|
||||
checkPNPM() {
|
||||
local pnpmVersionInstalled=$(pnpm --version 2>/dev/null) # 获取已安装的 pnpm 版本
|
||||
if [[ $pnpmVersionInstalled =~ ^$majorVersionRequired ]]; then
|
||||
echo "已安装的 pnpm 版本:$pnpmVersionInstalled"
|
||||
echo "已安装的 pnpm 大版本号符合要求."
|
||||
return 0
|
||||
else
|
||||
echo "未安装 pnpm 或 pnpm 大版本号不符合要求."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
## 下载依赖
|
||||
npm i pnpm@8 -g && pnpm i --frozen-lockfile --registry https://registry.npmmirror.com
|
||||
# 检查 pnpm 是否已安装并符合要求
|
||||
if checkPNPM; then
|
||||
echo "无需安装 pnpm@@$majorVersionRequired"
|
||||
else
|
||||
echo "安装 pnpm@$majorVersionRequired..."
|
||||
npm i pnpm@$majorVersionRequired -g
|
||||
fi
|
||||
|
||||
# 安装项目依赖
|
||||
pnpm i --frozen-lockfile --registry https://registry.npmmirror.com
|
||||
|
||||
|
||||
Reference in New Issue
Block a user