chore: import upstream snapshot with attribution
This commit is contained in:
Vendored
+83
@@ -0,0 +1,83 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: ["master"]
|
||||
# 暂时只在pr的时候运行
|
||||
pull_request:
|
||||
branches: ["master"]
|
||||
schedule:
|
||||
- cron: "0 0 1 * *" # 每月1号运行
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
# 跳过 Renovate PR
|
||||
if: |
|
||||
github.actor != 'renovate[bot]' &&
|
||||
github.actor != 'renovate-preview[bot]'
|
||||
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ["javascript", "typescript"]
|
||||
# CodeQL supports [ $supported-codeql-languages ]
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
|
||||
# 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@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# If the Autobuild fails above, remove it and uncomment the following three lines.
|
||||
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
|
||||
|
||||
# - run: |
|
||||
# echo "Run, Build Application using script"
|
||||
# ./location_of_script_within_repo/buildscript.sh
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@df409f7d9260372bd5f19e5b04e83cb3c43714ae # v3.27.9
|
||||
with:
|
||||
category: "/language:${{matrix.language}}"
|
||||
Vendored
+91
@@ -0,0 +1,91 @@
|
||||
name: Debug Build
|
||||
|
||||
on:
|
||||
workflow_dispatch: # 手动触发
|
||||
inputs:
|
||||
platform:
|
||||
type: choice
|
||||
description: '选择测试平台'
|
||||
required: true
|
||||
default: 'ubuntu-22.04'
|
||||
options:
|
||||
- ubuntu-22.04
|
||||
- macos-latest
|
||||
- windows-latest
|
||||
|
||||
jobs:
|
||||
debug-build:
|
||||
runs-on: ${{ inputs.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Ubuntu dependencies
|
||||
if: inputs.platform == 'ubuntu-22.04'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
libwebkit2gtk-4.1-dev \
|
||||
librsvg2-dev \
|
||||
patchelf \
|
||||
libudev-dev \
|
||||
libasound2-dev \
|
||||
pkg-config \
|
||||
libgtk-3-dev \
|
||||
libayatana-appindicator3-dev
|
||||
|
||||
# 验证安装的包
|
||||
dpkg -l | grep -E 'webkit|appindicator|rsvg|udev|asound|gtk'
|
||||
|
||||
# 添加环境变量配置
|
||||
- name: Set up environment variables
|
||||
run: echo "${{ secrets.ENV_LOCAL_CONTENT }}" > .env.local
|
||||
|
||||
# 安装 pnpm
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 9
|
||||
run_install: false
|
||||
|
||||
# 设置 Node.js
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
run: pnpm install
|
||||
|
||||
- name: Generate component typings
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
run: pnpm vite build --emptyOutDir
|
||||
|
||||
- name: Build Vite + Tauri
|
||||
run: pnpm build
|
||||
|
||||
# 安装 Rust
|
||||
- name: install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ inputs.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||
|
||||
- name: Rust cache
|
||||
uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './src-tauri -> target'
|
||||
|
||||
# 只构建不发布
|
||||
- name: Build Tauri app
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
# 增加 Node.js 内存限制,避免构建时内存溢出
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
with:
|
||||
releaseId: "debug-build"
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
# Dependency Review Action
|
||||
#
|
||||
# This Action will scan dependency manifest files that change as part of a Pull Request,
|
||||
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
|
||||
# Once installed, if the workflow run is marked as required,
|
||||
# PRs introducing known-vulnerable packages will be blocked from merging.
|
||||
#
|
||||
# Source repository: https://github.com/actions/dependency-review-action
|
||||
name: 'Dependency Review'
|
||||
on: [pull_request]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
dependency-review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
name: Greetings
|
||||
|
||||
on: [pull_request_target, issues]
|
||||
|
||||
# 顶层设置最小权限,推荐 contents: read
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
# 跳过 Renovate PR
|
||||
if: |
|
||||
github.actor != 'renovate[bot]' &&
|
||||
github.actor != 'renovate-preview[bot]'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: "👋 Thank you for your first Issue! We will check and reply as soon as possible. Please ensure that sufficient information has been provided to describe the problem."
|
||||
pr-message: "🎉 Thank you for your first PR! We are very happy to have you join the HuLa project. We will review your contribution as soon as possible."
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
# This workflow will triage pull requests and apply a label based on the
|
||||
# paths that are modified in the pull request.
|
||||
#
|
||||
# To use this workflow, you will need to set up a .github/labeler.yml
|
||||
# file with configuration. For more information, see:
|
||||
# https://github.com/actions/labeler
|
||||
|
||||
name: Labeler
|
||||
on: [pull_request_target]
|
||||
|
||||
jobs:
|
||||
label:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- uses: actions/labeler@v4
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
Vendored
+299
@@ -0,0 +1,299 @@
|
||||
name: Release CI
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
# 确保默认情况下所有 job 都只有只读权限,只有需要写权限的 job(比如发布 release 的 job)才会单独提升权限,其他 job 依然保持最小权限,最大程度保护仓库安全
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: release-${{ github.ref }}
|
||||
cancel-in-progress: true # 如果有新的发布任务,取消正在进行的任务
|
||||
|
||||
jobs:
|
||||
prepare-frontend:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up environment variables
|
||||
run: echo "${{ secrets.ENV_LOCAL_CONTENT }}" > .env.local
|
||||
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
run_install: false
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Generate frontend build (typings & assets)
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
run: pnpm vite build --emptyOutDir
|
||||
|
||||
- name: Upload frontend dist
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: frontend-dist
|
||||
if-no-files-found: error
|
||||
path: dist
|
||||
|
||||
- name: Upload generated component typings
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: components-typings
|
||||
if-no-files-found: error
|
||||
path: |
|
||||
src/typings/components.pc.d.ts
|
||||
src/typings/components.mobile.d.ts
|
||||
|
||||
publish-tauri:
|
||||
needs: prepare-frontend
|
||||
permissions:
|
||||
contents: write # 授予写入仓库内容的权限
|
||||
strategy:
|
||||
fail-fast: false # 某个平台构建失败不影响其他平台
|
||||
matrix:
|
||||
include:
|
||||
- platform: 'macos-latest' # for Arm based macs (M1 and above).
|
||||
args: '--target aarch64-apple-darwin'
|
||||
- platform: 'macos-latest' # for Intel based macs.
|
||||
args: '--target x86_64-apple-darwin'
|
||||
- platform: 'ubuntu-22.04'
|
||||
args: ''
|
||||
- platform: 'windows-latest'
|
||||
args: ''
|
||||
|
||||
runs-on: ${{ matrix.platform }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Determine build mode
|
||||
id: build_mode
|
||||
shell: bash
|
||||
run: |
|
||||
TAG="${GITHUB_REF##*/}"
|
||||
MODE="full"
|
||||
if [[ "$TAG" =~ ^v([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]; then
|
||||
PATCH="${BASH_REMATCH[3]}"
|
||||
if (( PATCH > 0 )); then
|
||||
MODE="incremental"
|
||||
fi
|
||||
fi
|
||||
echo "Detected tag: $TAG"
|
||||
echo "mode=$MODE" >> "$GITHUB_OUTPUT"
|
||||
if [[ "$MODE" == "incremental" ]]; then
|
||||
echo "INCREMENTAL_BUILD=true" >> "$GITHUB_ENV"
|
||||
else
|
||||
echo "INCREMENTAL_BUILD=false" >> "$GITHUB_ENV"
|
||||
fi
|
||||
echo "Build mode: $MODE"
|
||||
|
||||
- name: Download component typings
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: components-typings
|
||||
path: components-typings
|
||||
|
||||
- name: Download frontend dist
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: frontend-dist
|
||||
path: frontend-dist
|
||||
|
||||
- name: Prepare downloaded artifacts
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
rm -rf dist
|
||||
if [[ -d frontend-dist/dist ]]; then
|
||||
mv frontend-dist/dist dist
|
||||
rm -rf frontend-dist
|
||||
elif [[ -d frontend-dist ]]; then
|
||||
mv frontend-dist dist
|
||||
elif [[ ! -d dist ]]; then
|
||||
echo "无法在 artifact 中找到 dist 目录" >&2
|
||||
ls -la
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d components-typings/src/typings ]]; then
|
||||
mkdir -p src/typings
|
||||
cp -R components-typings/src/typings/. src/typings/
|
||||
rm -rf components-typings
|
||||
fi
|
||||
|
||||
- name: install dependencies (ubuntu only)
|
||||
if: matrix.platform == 'ubuntu-22.04'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y \
|
||||
libwebkit2gtk-4.1-dev \
|
||||
librsvg2-dev \
|
||||
patchelf \
|
||||
libudev-dev \
|
||||
libasound2-dev \
|
||||
pkg-config \
|
||||
libgtk-3-dev \
|
||||
libayatana-appindicator3-dev
|
||||
|
||||
# 添加环境变量配置
|
||||
- name: Set up environment variables
|
||||
run: echo "${{ secrets.ENV_LOCAL_CONTENT }}" > .env.local
|
||||
|
||||
# 首先安装 pnpm
|
||||
- name: Install pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
run_install: false
|
||||
|
||||
# 然后设置 Node.js
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Install dependencies
|
||||
env:
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
run: pnpm install
|
||||
|
||||
- name: Disable frontend rebuild for release build
|
||||
shell: bash
|
||||
run: |
|
||||
cat <<'EOF' > release-tauri-config.json
|
||||
{
|
||||
"build": {
|
||||
"beforeBuildCommand": ""
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
- name: Prepare production config
|
||||
shell: bash
|
||||
env:
|
||||
YOUDAO_APP_KEY: ${{ secrets.YOUDAO_APP_KEY }}
|
||||
YOUDAO_APP_SECRET: ${{ secrets.YOUDAO_APP_SECRET }}
|
||||
TENCENT_API_KEY: ${{ secrets.TENCENT_API_KEY }}
|
||||
TENCENT_SECRET_ID: ${{ secrets.TENCENT_SECRET_ID }}
|
||||
TENCENT_MAP_KEY: ${{ secrets.TENCENT_MAP_KEY }}
|
||||
run: |
|
||||
mkdir -p src-tauri/configuration
|
||||
cat > src-tauri/configuration/production.yaml <<'EOF'
|
||||
youdao:
|
||||
app_key: "${YOUDAO_APP_KEY}"
|
||||
app_secret: "${YOUDAO_APP_SECRET}"
|
||||
tencent:
|
||||
api_key: "${TENCENT_API_KEY}"
|
||||
secret_id: "${TENCENT_SECRET_ID}"
|
||||
map_key: "${TENCENT_MAP_KEY}"
|
||||
EOF
|
||||
|
||||
# 安装 Rust
|
||||
- name: install Rust stable
|
||||
uses: dtolnay/rust-toolchain@stable # Set this to dtolnay/rust-toolchain@nightly
|
||||
with:
|
||||
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
|
||||
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
||||
|
||||
- name: Cache cargo target
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
${{ runner.os == 'Windows' && env.USERPROFILE || env.HOME }}/.cargo/registry
|
||||
${{ runner.os == 'Windows' && env.USERPROFILE || env.HOME }}/.cargo/git
|
||||
src-tauri/target
|
||||
key: cargo-target-${{ matrix.platform }}-${{ hashFiles('src-tauri/Cargo.lock') }}
|
||||
restore-keys: |
|
||||
cargo-target-${{ matrix.platform }}-
|
||||
|
||||
- name: Create release
|
||||
uses: tauri-apps/tauri-action@v0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# 使用之前配置的私钥
|
||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||
# 使用之前配置的私钥密码
|
||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||
# 增加 Node.js 内存限制,避免构建时内存溢出
|
||||
NODE_OPTIONS: --max-old-space-size=4096
|
||||
with:
|
||||
tagName: v__VERSION__ #这个动作会自动将\_\_VERSION\_\_替换为app version
|
||||
releaseName: 'v__VERSION__'
|
||||
releaseBody: 'See the assets to download and install this version.'
|
||||
releaseDraft: true
|
||||
prerelease: false
|
||||
args: ${{ matrix.args }} --config release-tauri-config.json
|
||||
|
||||
publish-release:
|
||||
needs: publish-tauri
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Extract changelog for current version
|
||||
id: changelog
|
||||
run: |
|
||||
# 从 CHANGELOG.md 中提取最新版本的内容
|
||||
# 匹配从第一个 ## [version] 到下一个 ## [version] 之间的内容
|
||||
CHANGELOG_CONTENT=$(awk '/^## \[/{if(found) exit; found=1} found' CHANGELOG.md)
|
||||
|
||||
# 将内容写入文件以保留格式
|
||||
echo "$CHANGELOG_CONTENT" > /tmp/release_notes.md
|
||||
|
||||
# 输出到 GITHUB_OUTPUT(使用 EOF 分隔符处理多行)
|
||||
{
|
||||
echo 'body<<EOF'
|
||||
echo "$CHANGELOG_CONTENT"
|
||||
echo 'EOF'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Publish draft release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
# 直接按 tag 获取 release,避免同 tag 多个草稿导致多个 ID
|
||||
RELEASE=$(gh api repos/${{ github.repository }}/releases/tags/${{ github.ref_name }} 2>/dev/null || true)
|
||||
if [ -n "$RELEASE" ] && [ "$(echo "$RELEASE" | jq -r '.draft')" = "true" ]; then
|
||||
RELEASE_ID=$(echo "$RELEASE" | jq -r '.id')
|
||||
echo "Publishing draft release with ID: $RELEASE_ID"
|
||||
|
||||
# 使用 changelog 内容更新 release body 并发布
|
||||
gh api -X PATCH repos/${{ github.repository }}/releases/$RELEASE_ID \
|
||||
-f draft=false \
|
||||
-f body="$(cat /tmp/release_notes.md)"
|
||||
|
||||
echo "Release published successfully with changelog"
|
||||
else
|
||||
echo "No draft release found for tag ${{ github.ref_name }}, it may already be published"
|
||||
fi
|
||||
|
||||
upgradeLink-upload:
|
||||
needs: publish-release # 依赖于 publish-release 作业完成(确保 release 已正式发布)
|
||||
permissions:
|
||||
contents: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Send a request to UpgradeLink
|
||||
uses: toolsetlink/upgradelink-action@v5
|
||||
with:
|
||||
source-url: 'https://github.com/HuLaSpark/HuLa/releases/download/${{ github.ref_name }}/latest.json'
|
||||
access-key: ${{ secrets.UPGRADE_LINK_ACCESS_KEY }} # ACCESS_KEY 密钥key
|
||||
tauri-key: ${{ secrets.UPGRADE_LINK_TAURI_KEY }} # TAURI_KEY tauri 应用唯一标识
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
Vendored
+58
@@ -0,0 +1,58 @@
|
||||
# This workflow uses actions that are not certified by GitHub.
|
||||
# They are provided by a third-party and are governed by
|
||||
# separate terms of service, privacy policy, and support
|
||||
# documentation.
|
||||
# rust-clippy is a tool that runs a bunch of lints to catch common
|
||||
# mistakes in your Rust code and help improve your Rust code.
|
||||
# More details at https://github.com/rust-lang/rust-clippy
|
||||
# and https://rust-lang.github.io/rust-clippy/
|
||||
|
||||
name: rust-clippy analyze
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ "master" ]
|
||||
paths:
|
||||
- '**/*.rs'
|
||||
|
||||
jobs:
|
||||
rust-clippy-analyze:
|
||||
# 跳过 Renovate PR
|
||||
if: |
|
||||
github.actor != 'renovate[bot]' &&
|
||||
github.actor != 'renovate-preview[bot]'
|
||||
|
||||
name: Run rust-clippy analyzing
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
security-events: write
|
||||
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
components: clippy
|
||||
override: true
|
||||
|
||||
- name: Install required cargo
|
||||
run: cargo install clippy-sarif sarif-fmt
|
||||
|
||||
- name: Run rust-clippy
|
||||
run:
|
||||
cargo clippy
|
||||
--all-features
|
||||
--message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt
|
||||
continue-on-error: true
|
||||
|
||||
- name: Upload analysis results to GitHub
|
||||
uses: github/codeql-action/upload-sarif@v3
|
||||
with:
|
||||
sarif_file: rust-clippy-results.sarif
|
||||
wait-for-processing: true
|
||||
Reference in New Issue
Block a user