Repository navigation
148 lines (124 loc) · 5.72 KB
/
Copy pathbook-ci.yml
File metadata and controls
148 lines (124 loc) · 5.72 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
name: Book CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
schedule:
- cron: "17 2 * * *"
permissions:
contents: read
jobs:
book-and-examples:
name: Checkout latest sources and verify book
runs-on: ubuntu-latest
steps:
- name: Checkout lets-walrus
uses: actions/checkout@v6
with:
path: lets-walrus
fetch-depth: 1
- name: Checkout latest MystenLabs/walrus
uses: actions/checkout@v6
with:
repository: MystenLabs/walrus
path: upstream/walrus
fetch-depth: 1
- name: Checkout latest MystenLabs/walrus-sites
uses: actions/checkout@v6
with:
repository: MystenLabs/walrus-sites
path: upstream/walrus-sites
fetch-depth: 1
- name: Checkout latest MystenLabs/MemWal
uses: actions/checkout@v6
with:
repository: MystenLabs/MemWal
path: upstream/MemWal
fetch-depth: 1
- name: Checkout latest MystenLabs/sui-stack-messaging
uses: actions/checkout@v6
with:
repository: MystenLabs/sui-stack-messaging
path: upstream/sui-stack-messaging
fetch-depth: 1
- name: Print checked out upstream commits
shell: bash
run: |
set -euo pipefail
for repo in lets-walrus upstream/walrus upstream/walrus-sites upstream/MemWal upstream/sui-stack-messaging; do
echo "## ${repo}"
git -C "${repo}" remote get-url origin
git -C "${repo}" rev-parse --abbrev-ref HEAD
git -C "${repo}" rev-parse HEAD
done
- name: Setup latest Node.js
uses: actions/setup-node@v6
with:
node-version: latest
cache: npm
cache-dependency-path: |
lets-walrus/examples/sdk/package-lock.json
lets-walrus/examples/memwal/package-lock.json
- name: Install latest mdBook
shell: bash
run: |
set -euo pipefail
MDBOOK_TAG="$(node -e "fetch('https://api.github.com/repos/rust-lang/mdBook/releases/latest').then((r) => r.json()).then((r) => console.log(r.tag_name))")"
curl -fsSL "https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_TAG}/mdbook-${MDBOOK_TAG}-x86_64-unknown-linux-gnu.tar.gz" | tar -xz
sudo mv mdbook /usr/local/bin/mdbook
mdbook --version
- name: Validate npm dependencies are latest
working-directory: lets-walrus
run: |
node scripts/check-latest-npm-deps.mjs \
examples/sdk/package.json \
examples/memwal/package.json \
examples/sui-stack-messaging/package.json
- name: Validate book links
working-directory: lets-walrus
run: |
node -e "const fs=require('fs'); const path=require('path'); const files=[]; function walk(d){for(const n of fs.readdirSync(d)){const p=path.join(d,n); const s=fs.statSync(p); if(s.isDirectory()) walk(p); else if(p.endsWith('.md')) files.push(p)}} walk('src'); files.push('readme.md'); const missing=[]; const re=/\[[^\]]*\]\((?!https?:|mailto:|#)([^)]+)\)/g; for(const file of files){const text=fs.readFileSync(file,'utf8'); for(const m of text.matchAll(re)){let target=m[1].split('#')[0]; if(!target) continue; if(target.startsWith('<')&&target.endsWith('>')) target=target.slice(1,-1); if(target.startsWith('/')) continue; const full=path.resolve(path.dirname(file), target); if(!fs.existsSync(full)) missing.push(file+' -> '+m[1]);}} if(missing.length){console.error(missing.join('\n')); process.exit(1)} console.log('relative markdown links ok:', files.length, 'files');"
- name: Build mdBook
working-directory: lets-walrus
run: mdbook build
- name: Validate CLI examples
working-directory: lets-walrus
run: sh -n examples/cli/*.sh
- name: Validate HTTP examples
working-directory: lets-walrus
run: |
node --check examples/http/upload.mjs
node --check examples/http/download.mjs
node --check examples/http/upload-quilt.mjs
- name: Validate JSON and YAML files
working-directory: lets-walrus
run: |
node -e "const fs=require('fs'); for (const f of ['examples/sites/minimal-static-site/ws-resources.json','examples/http/package.json','examples/sdk/package.json','examples/sdk/package-lock.json','examples/memwal/package.json','examples/memwal/package-lock.json','examples/sui-stack-messaging/package.json']) JSON.parse(fs.readFileSync(f,'utf8')); console.log('json ok')"
ruby -e "require 'yaml'; YAML.load_file('examples/sites/github-actions/deploy-walrus-site.yml'); puts 'yaml ok'"
- name: Install SDK example dependencies
working-directory: lets-walrus/examples/sdk
run: npm ci
- name: Typecheck SDK examples
working-directory: lets-walrus/examples/sdk
run: npx tsc --noEmit
- name: Audit SDK examples
working-directory: lets-walrus/examples/sdk
run: npm audit --audit-level=moderate
- name: Install MemWal example dependencies
working-directory: lets-walrus/examples/memwal
run: npm ci
- name: Typecheck MemWal example
working-directory: lets-walrus/examples/memwal
run: npm run build
- name: Audit MemWal example
working-directory: lets-walrus/examples/memwal
run: npm audit --audit-level=moderate
- name: Validate Move example when Sui CLI is available
working-directory: lets-walrus/examples/move
run: |
if command -v sui >/dev/null 2>&1; then
sui move build
else
echo "sui CLI is not preinstalled on the GitHub runner; skipping Move build."
fi