Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
pull_request:
branches: [main]

env:
MDBOOK_VERSION: 0.5.2
MDBOOK_QUIZ_VERSION: 0.5.0
AQUASCOPE_VERSION: 0.4.0
AQUASCOPE_TOOLCHAIN: nightly-2026-05-01

jobs:
test-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install 1.90
rustup default 1.90

- name: Install Aquascope toolchain
run: |
rustup toolchain install ${AQUASCOPE_TOOLCHAIN} -c rust-src,rustc-dev,llvm-tools-preview,miri
cargo +${AQUASCOPE_TOOLCHAIN} miri setup
echo "LD_LIBRARY_PATH=$($(rustup which --toolchain ${AQUASCOPE_TOOLCHAIN} rustc) --print target-libdir)" >> "${GITHUB_ENV}"

- uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v4
with:
version: 9

- name: Install mdBook tools
run: |
mkdir bin
curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar -xz --directory=bin
curl -sSL "https://github.com/cognitive-engineering-lab/mdbook-quiz/releases/download/v${MDBOOK_QUIZ_VERSION}/mdbook-quiz_x86_64-unknown-linux-gnu_full.tar.gz" | tar -xz --directory=bin
curl -sSL "https://github.com/cognitive-engineering-lab/aquascope/releases/download/v${AQUASCOPE_VERSION}/aquascope-x86_64-unknown-linux-gnu.tar.gz" | tar -xz --directory=bin
sudo apt-get update
sudo apt-get install -y patchelf
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 bin/mdbook-aquascope bin/cargo-aquascope bin/aquascope-driver
echo "${PWD}/bin" >> "${GITHUB_PATH}"

- name: Build local preprocessors
run: cargo install --path packages/mdbook-trpl

- name: Build JavaScript extensions
run: |
cd js-extensions
pnpm init-repo

- name: Build book
run: mdbook build

- name: Check for errors
run: |
mdbook build 2>&1 | tee build.log
if grep -i "error" build.log; then
echo "❌ Build has errors!"
exit 1
else
echo "✅ Build successful!"
fi
135 changes: 0 additions & 135 deletions .github/workflows/main.yml

This file was deleted.

88 changes: 88 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Deploy Persian Rust Book

on:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

env:
MDBOOK_VERSION: 0.5.2
MDBOOK_QUIZ_VERSION: 0.5.0
AQUASCOPE_VERSION: 0.4.0
AQUASCOPE_TOOLCHAIN: nightly-2026-05-01

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Rust
run: |
rustup set profile minimal
rustup toolchain install 1.90
rustup default 1.90

- name: Install Aquascope toolchain
run: |
rustup toolchain install ${AQUASCOPE_TOOLCHAIN} -c rust-src,rustc-dev,llvm-tools-preview,miri
cargo +${AQUASCOPE_TOOLCHAIN} miri setup
echo "LD_LIBRARY_PATH=$($(rustup which --toolchain ${AQUASCOPE_TOOLCHAIN} rustc) --print target-libdir)" >> "${GITHUB_ENV}"

- uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v4
with:
version: 9

- name: Install mdBook tools
run: |
mkdir bin
curl -sSL "https://github.com/rust-lang/mdBook/releases/download/v${MDBOOK_VERSION}/mdbook-v${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | tar -xz --directory=bin
curl -sSL "https://github.com/cognitive-engineering-lab/mdbook-quiz/releases/download/v${MDBOOK_QUIZ_VERSION}/mdbook-quiz_x86_64-unknown-linux-gnu_full.tar.gz" | tar -xz --directory=bin
curl -sSL "https://github.com/cognitive-engineering-lab/aquascope/releases/download/v${AQUASCOPE_VERSION}/aquascope-x86_64-unknown-linux-gnu.tar.gz" | tar -xz --directory=bin
sudo apt-get update
sudo apt-get install -y patchelf
patchelf --set-interpreter /lib64/ld-linux-x86-64.so.2 bin/mdbook-aquascope bin/cargo-aquascope bin/aquascope-driver
echo "${PWD}/bin" >> "${GITHUB_PATH}"

- name: Build local preprocessors
run: cargo install --path packages/mdbook-trpl

- name: Build JavaScript extensions
run: |
cd js-extensions
pnpm init-repo

- name: Build book
run: mdbook build

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./book

deploy:
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
36 changes: 32 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,39 @@
# mdBook output
book/

# Local mdBook / Aquascope / quiz binaries
bin/
bin-tools/

# Rust build artifacts
target/
**/target/

# JavaScript dependencies and build output
node_modules/
**/node_modules/
**/dist/

# Editor and OS files
*~
.idea
.idea/
.vscode/
.DS_Store
target
tmp
.nova/

# mdBook interactive content (generated locally)
/src/quiz
/src/aquascope
.aquascope-cache
.nova

# Temporary files
tmp/
*.swp
*.swo

# Environment and secrets
.env
.env.*

# Obsidian settings
.obsidian/
11 changes: 7 additions & 4 deletions book.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
# in `nostarch/book.toml`!

[book]
title = "The Rust Programming Language"
authors = ["Steve Klabnik", "Carol Nichols", "Contributions from the Rust Community"]
title = "زبان برنامه‌نویسی Rust"
authors = ["Steve Klabnik", "Carol Nichols", "Contributions from the Rust Community", "ترجمهٔ فارسی"]
language = "fa"

[output.html]
default-theme = "light"
additional-css = [
"theme/persian.css",
"ferris.css",
"theme/semantic-notes.css",
"theme/listing.css",
Expand All @@ -22,7 +25,7 @@ additional-js = [
"js-extensions/packages/feedback/dist/index.js",
]

git-repository-url = "https://github.com/cognitive-engineering-lab/rust-book"
git-repository-url = "https://github.com/Aalamifar/rust-book"

[preprocessor.quiz]
fullscreen = true
Expand Down Expand Up @@ -73,4 +76,4 @@ output-mode = "default"
edition = "2024"

[build]
extra-watch-dirs = ["packages/mdbook-trpl"]
extra-watch-dirs = ["packages/mdbook-trpl"]
Loading
Loading