Skip to content

Commit da6a12d

Browse files
authored
CI Scaffolding with Comprehensive Workflows (Issue #3)
Adds CI, docs-check, and dependencies workflows with rustfmt config
1 parent 93fb603 commit da6a12d

File tree

6 files changed

+342
-0
lines changed

6 files changed

+342
-0
lines changed

.github/markdown-link-check.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"ignorePatterns": [
3+
{
4+
"pattern": "^https://github.com/raibid-labs/sigilforge/compare/"
5+
},
6+
{
7+
"pattern": "^https://crates.io/"
8+
}
9+
],
10+
"timeout": "20s",
11+
"retryOn429": true,
12+
"retryCount": 3,
13+
"fallbackRetryDelay": "30s",
14+
"aliveStatusCodes": [200, 206]
15+
}

.github/workflows/ci.yml

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
env:
11+
CARGO_TERM_COLOR: always
12+
RUST_BACKTRACE: 1
13+
14+
jobs:
15+
fmt:
16+
name: Format Check
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
21+
22+
- name: Install Rust
23+
uses: dtolnay/rust-toolchain@stable
24+
with:
25+
components: rustfmt
26+
27+
- name: Check formatting
28+
run: cargo fmt --all -- --check
29+
30+
clippy:
31+
name: Clippy Lints
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Checkout code
35+
uses: actions/checkout@v4
36+
37+
- name: Install Rust
38+
uses: dtolnay/rust-toolchain@stable
39+
with:
40+
components: clippy
41+
42+
- name: Cache cargo registry
43+
uses: actions/cache@v4
44+
with:
45+
path: ~/.cargo/registry
46+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
47+
48+
- name: Cache cargo index
49+
uses: actions/cache@v4
50+
with:
51+
path: ~/.cargo/git
52+
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
53+
54+
- name: Cache cargo build
55+
uses: actions/cache@v4
56+
with:
57+
path: target
58+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
59+
60+
- name: Run clippy
61+
run: cargo clippy --all-targets --all-features -- -D warnings
62+
63+
test:
64+
name: Test Suite
65+
runs-on: ${{ matrix.os }}
66+
strategy:
67+
fail-fast: false
68+
matrix:
69+
os: [ubuntu-latest, macos-latest, windows-latest]
70+
rust: [stable, beta]
71+
steps:
72+
- name: Checkout code
73+
uses: actions/checkout@v4
74+
75+
- name: Install Rust
76+
uses: dtolnay/rust-toolchain@master
77+
with:
78+
toolchain: ${{ matrix.rust }}
79+
80+
- name: Cache cargo registry
81+
uses: actions/cache@v4
82+
with:
83+
path: ~/.cargo/registry
84+
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
85+
86+
- name: Cache cargo index
87+
uses: actions/cache@v4
88+
with:
89+
path: ~/.cargo/git
90+
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
91+
92+
- name: Cache cargo build
93+
uses: actions/cache@v4
94+
with:
95+
path: target
96+
key: ${{ runner.os }}-${{ matrix.rust }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
97+
98+
- name: Run tests
99+
run: cargo test --workspace --all-features
100+
101+
- name: Run doc tests
102+
run: cargo test --workspace --doc
103+
104+
build:
105+
name: Build Check
106+
runs-on: ubuntu-latest
107+
steps:
108+
- name: Checkout code
109+
uses: actions/checkout@v4
110+
111+
- name: Install Rust
112+
uses: dtolnay/rust-toolchain@stable
113+
114+
- name: Cache cargo registry
115+
uses: actions/cache@v4
116+
with:
117+
path: ~/.cargo/registry
118+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
119+
120+
- name: Cache cargo index
121+
uses: actions/cache@v4
122+
with:
123+
path: ~/.cargo/git
124+
key: ${{ runner.os }}-cargo-git-${{ hashFiles('**/Cargo.lock') }}
125+
126+
- name: Cache cargo build
127+
uses: actions/cache@v4
128+
with:
129+
path: target
130+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
131+
132+
- name: Build all crates
133+
run: cargo build --workspace --all-features
134+
135+
- name: Build release
136+
run: cargo build --workspace --release
137+
138+
coverage:
139+
name: Code Coverage
140+
runs-on: ubuntu-latest
141+
steps:
142+
- name: Checkout code
143+
uses: actions/checkout@v4
144+
145+
- name: Install Rust
146+
uses: dtolnay/rust-toolchain@stable
147+
148+
- name: Install cargo-tarpaulin
149+
run: cargo install cargo-tarpaulin
150+
151+
- name: Generate coverage
152+
run: cargo tarpaulin --workspace --all-features --out xml --timeout 300
153+
154+
- name: Upload coverage to Codecov
155+
uses: codecov/codecov-action@v4
156+
with:
157+
files: ./cobertura.xml
158+
fail_ci_if_error: false
159+
continue-on-error: true
160+
161+
docs:
162+
name: Documentation Check
163+
runs-on: ubuntu-latest
164+
steps:
165+
- name: Checkout code
166+
uses: actions/checkout@v4
167+
168+
- name: Install Rust
169+
uses: dtolnay/rust-toolchain@stable
170+
171+
- name: Check documentation
172+
run: cargo doc --workspace --all-features --no-deps
173+
env:
174+
RUSTDOCFLAGS: -D warnings
175+
176+
- name: Verify docs structure
177+
run: |
178+
# Check that required documentation files exist
179+
test -f docs/STRUCTURE.md || (echo "Missing docs/STRUCTURE.md" && exit 1)
180+
test -f docs/ARCHITECTURE.md || (echo "Missing docs/ARCHITECTURE.md" && exit 1)
181+
test -f docs/INTERFACES.md || (echo "Missing docs/INTERFACES.md" && exit 1)
182+
test -f docs/ROADMAP.md || (echo "Missing docs/ROADMAP.md" && exit 1)
183+
test -f docs/NEXT_STEPS.md || (echo "Missing docs/NEXT_STEPS.md" && exit 1)
184+
test -f CHANGELOG.md || echo "Warning: Missing CHANGELOG.md"
185+
echo "Documentation structure verified"
186+
187+
security:
188+
name: Security Audit
189+
runs-on: ubuntu-latest
190+
steps:
191+
- name: Checkout code
192+
uses: actions/checkout@v4
193+
194+
- name: Install Rust
195+
uses: dtolnay/rust-toolchain@stable
196+
197+
- name: Run cargo-audit
198+
run: |
199+
cargo install cargo-audit
200+
cargo audit
201+
continue-on-error: true
202+
203+
# Placeholder for future Phage policy check
204+
# Uncomment when Phage is available and policy pack is defined
205+
# phage-check:
206+
# name: Phage Policy Check
207+
# runs-on: ubuntu-latest
208+
# steps:
209+
# - name: Checkout code
210+
# uses: actions/checkout@v4
211+
#
212+
# - name: Install Phage
213+
# run: |
214+
# # Install phage CLI
215+
# cargo install phage-cli
216+
#
217+
# - name: Run policy checks
218+
# run: phage check --ci

.github/workflows/dependencies.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Dependency Updates
2+
3+
on:
4+
schedule:
5+
# Run weekly on Monday at 9am UTC
6+
- cron: '0 9 * * 1'
7+
workflow_dispatch:
8+
9+
jobs:
10+
update-dependencies:
11+
name: Check for Dependency Updates
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Install Rust
18+
uses: dtolnay/rust-toolchain@stable
19+
20+
- name: Install cargo-outdated
21+
run: cargo install cargo-outdated
22+
23+
- name: Check for outdated dependencies
24+
run: cargo outdated --workspace --root-deps-only
25+
26+
- name: Check for security advisories
27+
run: |
28+
cargo install cargo-audit
29+
cargo audit
30+
continue-on-error: true

.github/workflows/docs-check.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Documentation Check
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'docs/**'
7+
- 'README.md'
8+
- 'CHANGELOG.md'
9+
workflow_dispatch:
10+
11+
jobs:
12+
check-links:
13+
name: Check Markdown Links
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Check links
20+
uses: gaurav-nelson/github-action-markdown-link-check@v1
21+
with:
22+
use-quiet-mode: 'yes'
23+
config-file: '.github/markdown-link-check.json'
24+
continue-on-error: true
25+
26+
check-structure:
27+
name: Verify Documentation Structure
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Check required files
34+
run: |
35+
echo "Checking required documentation files..."
36+
37+
# Required root docs
38+
test -f docs/STRUCTURE.md || (echo "ERROR: Missing docs/STRUCTURE.md" && exit 1)
39+
test -f docs/ARCHITECTURE.md || (echo "ERROR: Missing docs/ARCHITECTURE.md" && exit 1)
40+
test -f docs/INTERFACES.md || (echo "ERROR: Missing docs/INTERFACES.md" && exit 1)
41+
test -f docs/ROADMAP.md || (echo "ERROR: Missing docs/ROADMAP.md" && exit 1)
42+
test -f docs/NEXT_STEPS.md || (echo "ERROR: Missing docs/NEXT_STEPS.md" && exit 1)
43+
test -f README.md || (echo "ERROR: Missing README.md" && exit 1)
44+
45+
# Optional but recommended
46+
test -f CHANGELOG.md || echo "WARNING: Missing CHANGELOG.md"
47+
test -f docs/RELEASE.md || echo "WARNING: Missing docs/RELEASE.md"
48+
49+
# Check versioned docs structure
50+
if [ -d docs/versions ]; then
51+
echo "Found docs/versions directory"
52+
version_count=$(find docs/versions -mindepth 1 -maxdepth 1 -type d | wc -l)
53+
echo "Version directories: $version_count"
54+
fi
55+
56+
echo "Documentation structure check passed!"
57+
58+
check-formatting:
59+
name: Check Markdown Formatting
60+
runs-on: ubuntu-latest
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- name: Install markdownlint
66+
run: npm install -g markdownlint-cli
67+
68+
- name: Run markdownlint
69+
run: markdownlint '**/*.md' --ignore node_modules --ignore target
70+
continue-on-error: true

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
*.profdata
3131
coverage/
3232
tarpaulin-report.html
33+
cobertura.xml
34+
lcov.info
3335

3436
# Documentation build
3537
/doc/

.rustfmt.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Rustfmt configuration for sigilforge
2+
edition = "2024"
3+
max_width = 100
4+
use_small_heuristics = "Default"
5+
format_code_in_doc_comments = true
6+
normalize_comments = true
7+
wrap_comments = true

0 commit comments

Comments
 (0)