summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-08-01 19:02:16 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-08-01 21:26:37 +0800
commitd2f80c314911e395d92ee16b8003d230f4846bf3 (patch)
tree3e7caa1ec5ca549f83e81ca46cb0ab638b01c15e
parentc13ad48dd3efa67250b7285026f2ad989bf631f3 (diff)
init: ci
-rw-r--r--.github/workflows/ci.yml201
-rw-r--r--.github/workflows/docs.yml58
-rw-r--r--qml_plugin/Cargo.toml3
3 files changed, 262 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..084fc4d
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,201 @@
+# .github/workflows/build.yml
+name: Build
+
+on: [push, pull_request]
+
+jobs:
+ check:
+ name: Check
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: qml_plugin
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup | Qt
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y qt6-base-dev qt6-declarative-dev
+
+ - name: Setup | Rust
+ uses: dtolnay/rust-toolchain@nightly
+
+ - name: Check
+ run: cargo check
+
+ lint:
+ name: Lint
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup | Qt
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y qt6-base-dev qt6-declarative-dev
+ - name: Setup | Rust
+ uses: dtolnay/rust-toolchain@nightly
+ - uses: giraffate/clippy-action@v1
+ with:
+ reporter: "github-pr-check"
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ clippy_flags: --all --lib --bins --examples
+ workdir: qml_plugin
+
+ fmt:
+ name: Rustfmt
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: qml_plugin
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup | Rust
+ uses: dtolnay/rust-toolchain@nightly
+
+ - name: Format
+ run: cargo fmt --all -- --check
+
+ semver:
+ name: Semver Check
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: qml_plugin
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Setup | Qt
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y qt6-base-dev qt6-declarative-dev
+
+ - name: Setup | Rust
+ uses: dtolnay/rust-toolchain@nightly
+
+ - name: Install cargo-semver-checks from git
+ run: cargo install --git https://github.com/obi1kenobi/cargo-semver-checks cargo-semver-checks
+
+ - name: Check semver
+ run: cargo semver-checks --baseline-rev origin/main
+
+ test:
+ name: Test
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: qml_plugin
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v4
+ - name: Setup | Qt
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y qt6-base-dev qt6-declarative-dev
+ - name: Setup | Rust
+ uses: dtolnay/rust-toolchain@nightly
+ - name: Setup | Toolchain
+ uses: taiki-e/install-action@v2
+ with:
+ tool: cargo-nextest
+ - name: Test
+ run: cargo nextest run --no-tests=pass
+
+ mutants:
+ name: Mutation Testing
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: qml_plugin
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v4
+ - name: Setup | Qt
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y qt6-base-dev qt6-declarative-dev
+ - name: Setup | Rust
+ uses: dtolnay/rust-toolchain@nightly
+ - name: Setup | Toolchain
+ uses: taiki-e/install-action@v2
+ with:
+ tool: cargo-mutants
+ - name: Mutation Testing
+ run: cargo mutants -vV --in-place
+ - name: Upload Mutation Testing Results
+ uses: actions/upload-artifact@v4
+ if: always()
+ with:
+ name: mutants-out
+ path: qml_plugin/mutants.out
+
+ audit:
+ name: Dependency Audit
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: qml_plugin
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v4
+ - name: Setup | Rust
+ uses: dtolnay/rust-toolchain@nightly
+ - name: Setup | Toolchain | Install cargo-audit
+ run: cargo install cargo-audit
+ - name: Audit
+ run: cargo audit
+
+ dep:
+ name: Unused Dependencies
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: qml_plugin
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v4
+ - name: Setup | Rust
+ uses: dtolnay/rust-toolchain@nightly
+ - name: Check Unused Dependencies
+ uses: bnjbvr/cargo-machete@main
+
+ ui:
+ name: UI (QML/JS/Shell) Linting
+ runs-on: ubuntu-latest
+ steps:
+ - name: Setup | Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup | Qt & ShellCheck
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y qt6-declarative-dev-tools shellcheck
+
+ - name: Setup | Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+
+ - name: Install Prettier
+ run: npm install -g prettier
+
+ - name: Format JS
+ run: |
+ cat <<EOF > .prettierignore
+ utils/fuzzysort.js
+ utils/fzf.js
+ utils/levendist.js
+ EOF
+ prettier --check "utils/**/*.js"
+
+ - name: Check QML/JS Format
+ run: find . \( -name "*.qml" -o -name "*.js" \) -exec qmlformat -n {} +
+
+ - name: Lint Shell
+ run: shellcheck utils/*.sh
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..ce77f78
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,58 @@
+# .github/workflows/docs.yml
+name: Docs
+on:
+ push:
+ branches: [main]
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+concurrency:
+ group: deploy
+ cancel-in-progress: false
+jobs:
+ build:
+ name: Build
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: qml_plugin
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ - name: Setup | Qt
+ run: |
+ sudo apt-get update
+ sudo apt-get install -y qt6-base-dev qt6-declarative-dev
+ - name: Setup Rust
+ uses: dtolnay/rust-toolchain@stable
+ - name: Configure cache
+ uses: Swatinem/rust-cache@v2
+ with:
+ workspaces: qml_plugin
+ - name: Setup pages
+ id: pages
+ uses: actions/configure-pages@v5
+ - name: Clean docs folder
+ run: cargo clean --doc
+ - name: Build docs
+ run: cargo doc --no-deps
+ - name: Add redirect
+ run: echo '<meta http-equiv="refresh" content="0;url=qml_plugin/index.html">' > target/doc/index.html
+ - name: Remove lock file
+ run: rm target/doc/.lock
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: qml_plugin/target/doc
+ deploy:
+ name: Deploy
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-latest
+ needs: build
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
diff --git a/qml_plugin/Cargo.toml b/qml_plugin/Cargo.toml
index 19e6f19..d749887 100644
--- a/qml_plugin/Cargo.toml
+++ b/qml_plugin/Cargo.toml
@@ -21,3 +21,6 @@ tokio = { version = "1.53.1", features = ["rt-multi-thread", "macros"] }
[build-dependencies]
cxx-qt-build = "0.9.1"
+
+[package.metadata.cargo-machete]
+ignored = ["cxx"]