-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (128 loc) · 3.67 KB
/
docs.yml
File metadata and controls
153 lines (128 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Cache: 202509060012
name: Docs
on:
push:
branches: [main]
paths:
- "docs/**"
- ".github/workflows/docs.yml"
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
test_and_lint:
name: CI Gate (tests + lint)
runs-on: ubuntu-latest
container:
image: rust:1.88.0
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Install rustfmt and clippy
run: |
rustup component add rustfmt clippy
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "STORE_PATH=$(pnpm store path)" >> "$GITHUB_OUTPUT"
- name: Cache pnpm dependencies
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Cache cargo dependencies and build artifacts
uses: actions/cache@v4
with:
path: |
~/.cargo
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install pnpm dependencies
run: pnpm install --frozen-lockfile
- name: Add node_modules/.bin to PATH
run: echo "$PWD/node_modules/.bin" >> "$GITHUB_PATH"
- name: Download cargo dependencies
run: cargo fetch --locked
- name: Check formatting
run: cargo fmt -- --check
- name: Run linting
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all
build:
name: Build Docs
runs-on: ubuntu-latest
needs: test_and_lint
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Install root deps (if any)
run: |
pnpm install --frozen-lockfile || pnpm install
- name: Build docs (if present)
run: |
set -e
if [ -f docs/package.json ]; then
cd docs
pnpm install --frozen-lockfile || pnpm install
if pnpm run -s build; then
echo "Docs built with pnpm"
elif npm run build; then
echo "Docs built with npm"
else
echo "Docs build script not found" >&2
exit 1
fi
if [ ! -d dist ]; then
echo "Docs build output not found at dist/" >&2
exit 1
fi
else
echo "docs/package.json not found; docs site missing" >&2
exit 1
fi
- name: Verify docs output exists
run: |
if [ ! -d docs/dist ]; then
echo "Docs build output not found at docs/dist" >&2
exit 1
fi
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/dist
deploy:
name: Deploy Docs
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