Skip to content

Commit c2d3478

Browse files
Add website written in Rust
1 parent 69a20df commit c2d3478

27 files changed

+4482
-68
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
pull_request: {}
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
RUSTFLAGS: '-Dwarnings'
11+
12+
jobs:
13+
test:
14+
name: Test
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Rust toolchain
22+
run: rustup toolchain install stable --no-self-update --profile default --target wasm32-unknown-unknown
23+
24+
- name: Set up Rust cache
25+
uses: swatinem/rust-cache@v2
26+
with:
27+
cache-on-failure: true
28+
save-if: ${{ github.ref == 'refs/heads/main' }}
29+
30+
- name: Check formatting
31+
run: cargo fmt --all --check
32+
33+
- name: Lint
34+
run: cargo clippy --all-features
35+
36+
- name: Test
37+
run: cargo test --all-features

.github/workflows/static.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

.github/workflows/website.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Website
2+
on:
3+
pull_request: {}
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: false
11+
12+
jobs:
13+
website-build:
14+
name: Build Book
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Rust toolchain
22+
run: |
23+
rustup toolchain install stable --no-self-update --profile minimal
24+
rustup target add wasm32-unknown-unknown
25+
26+
- name: Set up Rust cache
27+
uses: swatinem/rust-cache@v2
28+
with:
29+
cache-on-failure: true
30+
save-if: ${{ github.ref == 'refs/heads/main' }}
31+
32+
- name: Install Cargo Binary Install
33+
uses: cargo-bins/cargo-binstall@main
34+
35+
- name: Install Trunk
36+
run: cargo binstall --force -y trunk
37+
38+
- name: Install Node.js dependencies
39+
run: npm install
40+
41+
- name: Build Website
42+
run: trunk build
43+
44+
- name: Upload artifact
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: website
48+
path: dist
49+
retention-days: 1
50+
if-no-files-found: error
51+
52+
deploy:
53+
name: Deploy
54+
needs: website-build
55+
if: github.ref == 'refs/heads/main'
56+
runs-on: ubuntu-latest
57+
permissions:
58+
contents: read
59+
pages: write
60+
id-token: write
61+
steps:
62+
- uses: actions/checkout@v4
63+
with:
64+
fetch-depth: 0
65+
66+
- name: Download artifacts
67+
uses: actions/download-artifact@v4
68+
with:
69+
path: dist
70+
merge-multiple: true
71+
72+
- name: Setup Pages
73+
uses: actions/configure-pages@v5
74+
75+
- name: Upload artifact
76+
uses: actions/upload-pages-artifact@v3
77+
with:
78+
path: dist
79+
80+
- name: Deploy to GitHub Pages
81+
id: deployment
82+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/rust,node
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=rust,node
3+
4+
### Node ###
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
yarn-debug.log*
10+
yarn-error.log*
11+
lerna-debug.log*
12+
.pnpm-debug.log*
13+
14+
# Diagnostic reports (https://nodejs.org/api/report.html)
15+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
*.lcov
29+
30+
# nyc test coverage
31+
.nyc_output
32+
33+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
34+
.grunt
35+
36+
# Bower dependency directory (https://bower.io/)
37+
bower_components
38+
39+
# node-waf configuration
40+
.lock-wscript
41+
42+
# Compiled binary addons (https://nodejs.org/api/addons.html)
43+
build/Release
44+
45+
# Dependency directories
46+
node_modules/
47+
jspm_packages/
48+
49+
# Snowpack dependency directory (https://snowpack.dev/)
50+
web_modules/
51+
52+
# TypeScript cache
53+
*.tsbuildinfo
54+
55+
# Optional npm cache directory
56+
.npm
57+
58+
# Optional eslint cache
59+
.eslintcache
60+
61+
# Optional stylelint cache
62+
.stylelintcache
63+
64+
# Microbundle cache
65+
.rpt2_cache/
66+
.rts2_cache_cjs/
67+
.rts2_cache_es/
68+
.rts2_cache_umd/
69+
70+
# Optional REPL history
71+
.node_repl_history
72+
73+
# Output of 'npm pack'
74+
*.tgz
75+
76+
# Yarn Integrity file
77+
.yarn-integrity
78+
79+
# dotenv environment variable files
80+
.env
81+
.env.development.local
82+
.env.test.local
83+
.env.production.local
84+
.env.local
85+
86+
# parcel-bundler cache (https://parceljs.org/)
87+
.cache
88+
.parcel-cache
89+
90+
# Next.js build output
91+
.next
92+
out
93+
94+
# Nuxt.js build / generate output
95+
.nuxt
96+
dist
97+
98+
# Gatsby files
99+
.cache/
100+
# Comment in the public line in if your project uses Gatsby and not Next.js
101+
# https://nextjs.org/blog/next-9-1#public-directory-support
102+
# public
103+
104+
# vuepress build output
105+
.vuepress/dist
106+
107+
# vuepress v2.x temp and cache directory
108+
.temp
109+
110+
# Docusaurus cache and generated files
111+
.docusaurus
112+
113+
# Serverless directories
114+
.serverless/
115+
116+
# FuseBox cache
117+
.fusebox/
118+
119+
# DynamoDB Local files
120+
.dynamodb/
121+
122+
# TernJS port file
123+
.tern-port
124+
125+
# Stores VSCode versions used for testing VSCode extensions
126+
.vscode-test
127+
128+
# yarn v2
129+
.yarn/cache
130+
.yarn/unplugged
131+
.yarn/build-state.yml
132+
.yarn/install-state.gz
133+
.pnp.*
134+
135+
### Node Patch ###
136+
# Serverless Webpack directories
137+
.webpack/
138+
139+
# Optional stylelint cache
140+
141+
# SvelteKit build / generate output
142+
.svelte-kit
143+
144+
### Rust ###
145+
# Generated by Cargo
146+
# will have compiled files and executables
147+
debug/
148+
target/
149+
150+
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
151+
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
152+
# Cargo.lock
153+
154+
# These are backup files generated by rustfmt
155+
**/*.rs.bk
156+
157+
# MSVC Windows builds of rustc generate these, which store debugging information
158+
*.pdb
159+
160+
# End of https://www.toptal.com/developers/gitignore/api/rust,node
161+
162+
# mdBook
163+
book/book/
164+
165+
# Tailwind CSS ouput
166+
tailwind.output.css

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/mirrors-prettier
3+
rev: v3.1.0
4+
hooks:
5+
- id: prettier
6+
additional_dependencies:
7+
- prettier@^3.4.1
8+
- repo: https://github.com/doublify/pre-commit-rust
9+
rev: v1.0
10+
hooks:
11+
- id: fmt
12+
- id: clippy

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
target/

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"bracketSpacing": false,
3+
"printWidth": 120,
4+
"singleQuote": true,
5+
"tabWidth": 4,
6+
"trailingComma": "none"
7+
}

0 commit comments

Comments
 (0)