mirror of
https://github.com/qingjian-team/qingjian.git
synced 2026-11-23 08:04:55 +00:00
139 lines
5.1 KiB
YAML
139 lines
5.1 KiB
YAML
# 三个 job:Linux 跑 fmt / clippy / 全 workspace 测试(排除 IMK 外壳);macOS 与 Windows runner 各编各的壳并跑平台测试,
|
||
# 平台特有的编译错(Objective-C 调用、TSF 导出、WinUI)在 PR 里就暴露,不等发版。仓库公开,Actions 不计费。
|
||
# actions 一律钉到 commit(注释里是对应的标签),Dependabot 每周提 PR 更新;cargo 全加 --locked,Cargo.lock 没提交就报错。
|
||
name: ci
|
||
|
||
on:
|
||
push:
|
||
branches: [main]
|
||
pull_request:
|
||
|
||
permissions:
|
||
contents: read
|
||
|
||
concurrency:
|
||
group: ci-${{ github.ref }}
|
||
cancel-in-progress: true
|
||
|
||
env:
|
||
CARGO_TERM_COLOR: always
|
||
|
||
jobs:
|
||
core:
|
||
runs-on: ubuntu-26.04
|
||
timeout-minutes: 20
|
||
steps:
|
||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
with:
|
||
persist-credentials: false
|
||
|
||
- uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # v1
|
||
with:
|
||
toolchain: 1.96.0
|
||
components: rustfmt, clippy
|
||
|
||
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
||
|
||
- name: Install Fcitx5 build and test dependencies
|
||
run: |
|
||
sudo apt-get update
|
||
sudo apt-get install -y cmake g++ libfcitx5core-dev libfcitx5config-dev libfcitx5utils-dev nlohmann-json3-dev fcitx5
|
||
|
||
- name: Format
|
||
run: cargo fmt --all --check
|
||
|
||
- name: Clippy
|
||
run: cargo clippy --workspace --exclude qingjian-macos --all-targets --locked -- -D warnings
|
||
|
||
- name: Test
|
||
run: cargo test --workspace --exclude qingjian-macos --locked
|
||
|
||
- name: Build Linux server
|
||
run: cargo build -p qingjian-linux-server --locked
|
||
|
||
- name: Configure Fcitx5 default panel
|
||
run: cmake -S apps/linux/fcitx5 -B target/fcitx5-stage1 -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=ON
|
||
|
||
- name: Build Fcitx5 default panel
|
||
run: cmake --build target/fcitx5-stage1 --parallel 2
|
||
|
||
# 日志用 tee 落盘,失败时由下面的 Upload Linux diagnostics 打包上传,便于排障。
|
||
# 必须显式 shell: bash:默认的 bash -e 不带 pipefail,`| tee` 会返回 tee 的退出码、把测试失败吞掉,
|
||
# if: failure() 的诊断上传也不会触发
|
||
- name: Test Fcitx5 default panel
|
||
shell: bash
|
||
run: |
|
||
mkdir -p target/ci-logs
|
||
env -u DBUS_SESSION_BUS_ADDRESS ctest --test-dir target/fcitx5-stage1 --output-on-failure 2>&1 | tee target/ci-logs/fcitx5-ctest.log
|
||
|
||
- name: Validate Linux install scripts
|
||
run: bash -n apps/linux/scripts/install.sh apps/linux/scripts/uninstall.sh apps/linux/scripts/package.sh apps/linux/scripts/package-install.sh
|
||
|
||
- name: Test Linux installation
|
||
shell: bash
|
||
run: |
|
||
mkdir -p target/ci-logs
|
||
python3 apps/linux/tests/installation.py 2>&1 | tee target/ci-logs/linux-installation.log
|
||
|
||
- name: Upload Linux diagnostics
|
||
if: failure()
|
||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||
with:
|
||
name: linux-ci-diagnostics
|
||
if-no-files-found: ignore
|
||
path: |
|
||
target/ci-logs/**
|
||
target/fcitx5-stage1/Testing/**
|
||
target/fcitx5-stage1/CMakeFiles/CMakeOutput.log
|
||
target/fcitx5-stage1/CMakeFiles/CMakeError.log
|
||
|
||
macos:
|
||
runs-on: macos-latest
|
||
timeout-minutes: 15
|
||
steps:
|
||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
with:
|
||
persist-credentials: false
|
||
|
||
- uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # v1
|
||
with:
|
||
toolchain: 1.96.0
|
||
components: clippy
|
||
|
||
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
||
|
||
- name: Clippy (IMK shell)
|
||
run: cargo clippy -p qingjian-macos --all-targets --locked -- -D warnings
|
||
|
||
- name: Test (IMK shell)
|
||
run: cargo test -p qingjian-macos --locked
|
||
|
||
windows:
|
||
runs-on: windows-latest
|
||
timeout-minutes: 15
|
||
env:
|
||
# Server 的 build.rs 嵌 uiAccess manifest,没签名的 exe(含测试二进制)起不来(os error 740);与 release.yml 一样关掉
|
||
QINGJIAN_UIACCESS: '0'
|
||
steps:
|
||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||
with:
|
||
persist-credentials: false
|
||
|
||
- uses: dtolnay/rust-toolchain@7e38f4b43b4db5c8dd498af069a4f6196df1d067 # v1
|
||
with:
|
||
toolchain: 1.96.0
|
||
components: clippy
|
||
targets: i686-pc-windows-msvc
|
||
|
||
- uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2
|
||
|
||
- name: Clippy (Server, TSF DLL, Settings)
|
||
run: cargo clippy -p qingjian-windows-server -p qingjian-windows-tsf -p qingjian-windows-settings --all-targets --locked -- -D warnings
|
||
|
||
- name: Test (Server, TSF DLL, Settings)
|
||
run: cargo test -p qingjian-windows-server -p qingjian-windows-tsf -p qingjian-windows-settings --locked
|
||
|
||
# 安装包另带一份 32 位 DLL(企业微信 / WPS 这类 32 位应用只能加载它)
|
||
- name: Check (TSF DLL, 32-bit)
|
||
run: cargo check -p qingjian-windows-tsf --target i686-pc-windows-msvc --locked
|