Skip to content

Commit 242f573

Browse files
committed
feat: Add xtask workflow and GitHub Actions CI/CD
- Implement cargo-xtask automation with build, test, docs, and dist tasks - Add GitHub Actions for CI, release, documentation, and nightly builds - Configure rust-toolchain.toml with nightly and multi-target support - Include automated mdbook documentation generation - Add Cargo.lock consistency checking - Support multi-platform builds and cross-compilation
1 parent 277074c commit 242f573

28 files changed

+1812
-0
lines changed

.cargo/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Licensed under the Apache-2.0 license
2+
3+
[alias]
4+
xtask = "run --package xtask --"

.github/dependabot.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "cargo"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"
7+
day: "monday"
8+
time: "09:00"
9+
open-pull-requests-limit: 10
10+
reviewers:
11+
- "@me"
12+
assignees:
13+
- "@me"
14+
commit-message:
15+
prefix: "deps"
16+
include: "scope"
17+
18+
- package-ecosystem: "github-actions"
19+
directory: "/"
20+
schedule:
21+
interval: "weekly"
22+
day: "monday"
23+
time: "09:00"
24+
open-pull-requests-limit: 5
25+
reviewers:
26+
- "@me"
27+
assignees:
28+
- "@me"
29+
commit-message:
30+
prefix: "ci"
31+
include: "scope"

.github/workflows/ci.yml

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Licensed under the Apache-2.0 license
2+
3+
name: CI
4+
5+
on:
6+
push:
7+
branches: [ main, develop ]
8+
pull_request:
9+
branches: [ main ]
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
RUST_BACKTRACE: 1
14+
15+
jobs:
16+
test:
17+
name: Test
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
rust:
22+
- stable
23+
- beta
24+
- nightly
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Install Rust toolchain
29+
uses: dtolnay/rust-toolchain@master
30+
with:
31+
toolchain: ${{ matrix.rust }}
32+
components: clippy, rustfmt
33+
34+
- name: Cache cargo registry
35+
uses: actions/cache@v3
36+
with:
37+
path: |
38+
~/.cargo/registry
39+
~/.cargo/git
40+
target
41+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
42+
43+
- name: Check formatting
44+
run: cargo xtask fmt --check
45+
46+
- name: Run clippy
47+
run: cargo xtask clippy
48+
49+
- name: Run tests
50+
run: cargo xtask test
51+
52+
- name: Build
53+
run: cargo xtask build
54+
55+
build-targets:
56+
name: Build Targets
57+
runs-on: ubuntu-latest
58+
strategy:
59+
matrix:
60+
target:
61+
- x86_64-unknown-linux-gnu
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- name: Install Rust toolchain
66+
uses: dtolnay/rust-toolchain@master
67+
with:
68+
toolchain: nightly-2025-02-15
69+
targets: ${{ matrix.target }}
70+
components: clippy, rust-src, llvm-tools, rustfmt, rustc-dev
71+
72+
- name: Cache cargo registry
73+
uses: actions/cache@v3
74+
with:
75+
path: |
76+
~/.cargo/registry
77+
~/.cargo/git
78+
target
79+
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
80+
81+
- name: Build for target
82+
run: cargo build --target ${{ matrix.target }}
83+
84+
security-audit:
85+
name: Security Audit
86+
runs-on: ubuntu-latest
87+
steps:
88+
- uses: actions/checkout@v4
89+
90+
- name: Install Rust toolchain
91+
uses: dtolnay/rust-toolchain@stable
92+
93+
- name: Install cargo-audit
94+
run: cargo install cargo-audit
95+
96+
- name: Run security audit
97+
run: cargo audit

.github/workflows/docs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Licensed under the Apache-2.0 license
2+
3+
name: Documentation
4+
5+
on:
6+
push:
7+
branches: [ main ]
8+
pull_request:
9+
branches: [ main ]
10+
11+
env:
12+
CARGO_TERM_COLOR: always
13+
14+
jobs:
15+
docs:
16+
name: Documentation
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install Rust toolchain
22+
uses: dtolnay/rust-toolchain@stable
23+
with:
24+
components: rust-docs
25+
26+
- name: Cache cargo registry
27+
uses: actions/cache@v3
28+
with:
29+
path: |
30+
~/.cargo/registry
31+
~/.cargo/git
32+
target
33+
key: ${{ runner.os }}-docs-cargo-${{ hashFiles('**/Cargo.lock') }}
34+
35+
- name: Build documentation
36+
run: cargo doc --all-features --no-deps --workspace
37+
38+
- name: Check for broken links in docs
39+
run: |
40+
cargo install cargo-deadlinks
41+
cargo deadlinks --check-http
42+
continue-on-error: true
43+
44+
- name: Deploy documentation to GitHub Pages
45+
if: github.ref == 'refs/heads/main'
46+
uses: peaceiris/actions-gh-pages@v3
47+
with:
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
49+
publish_dir: ./target/doc
50+
force_orphan: true

.github/workflows/nightly.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Licensed under the Apache-2.0 license
2+
3+
name: Nightly
4+
5+
on:
6+
schedule:
7+
- cron: '0 2 * * *' # Run every day at 2 AM UTC
8+
workflow_dispatch: # Allow manual triggering
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
RUST_BACKTRACE: 1
13+
14+
jobs:
15+
nightly-test:
16+
name: Nightly Test
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Install Rust nightly toolchain
22+
uses: dtolnay/rust-toolchain@master
23+
with:
24+
toolchain: nightly-2025-02-15
25+
components: clippy, rust-src, llvm-tools, rustfmt, rustc-dev
26+
27+
- name: Cache cargo registry
28+
uses: actions/cache@v3
29+
with:
30+
path: |
31+
~/.cargo/registry
32+
~/.cargo/git
33+
target
34+
key: ${{ runner.os }}-nightly-cargo-${{ hashFiles('**/Cargo.lock') }}
35+
36+
- name: Run tests with nightly
37+
run: cargo xtask test
38+
39+
- name: Run clippy with nightly
40+
run: cargo xtask clippy
41+
42+
- name: Build with nightly
43+
run: cargo xtask build
44+
45+
dependency-update:
46+
name: Dependency Update Check
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Install Rust toolchain
52+
uses: dtolnay/rust-toolchain@stable
53+
54+
- name: Install cargo-outdated
55+
run: cargo install cargo-outdated
56+
57+
- name: Check for outdated dependencies
58+
run: cargo outdated --exit-code 1
59+
continue-on-error: true
60+
61+
- name: Install cargo-audit
62+
run: cargo install cargo-audit
63+
64+
- name: Run security audit
65+
run: cargo audit
66+
67+
benchmark:
68+
name: Benchmark
69+
runs-on: ubuntu-latest
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: Install Rust toolchain
74+
uses: dtolnay/rust-toolchain@stable
75+
76+
- name: Cache cargo registry
77+
uses: actions/cache@v3
78+
with:
79+
path: |
80+
~/.cargo/registry
81+
~/.cargo/git
82+
target
83+
key: ${{ runner.os }}-benchmark-cargo-${{ hashFiles('**/Cargo.lock') }}
84+
85+
- name: Run benchmarks
86+
run: cargo bench --workspace
87+
continue-on-error: true

0 commit comments

Comments
 (0)