-
Notifications
You must be signed in to change notification settings - Fork 81
Add vercel support for book #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| # Documentation and mdbook related jobs. | ||
| # Heavily inspired by Reth https://github.com/paradigmxyz/reth/blob/main/.github/workflows/book.yml | ||
|
|
||
| name: book-tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
| paths: | ||
| - 'book/**' | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-latest | ||
| name: test | ||
| timeout-minutes: 60 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install mdbook | ||
| run: | | ||
| mkdir mdbook | ||
| curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook | ||
| echo $(pwd)/mdbook >> $GITHUB_PATH | ||
| - name: Install mdbook-template | ||
| run: | | ||
| mkdir mdbook-template | ||
| curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook-template | ||
| echo $(pwd)/mdbook-template >> $GITHUB_PATH | ||
| - name: Run tests | ||
| working-directory: ./book | ||
| run: mdbook test | ||
|
|
||
| lint: | ||
| runs-on: ubuntu-latest | ||
| name: lint | ||
| timeout-minutes: 60 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install mdbook-linkcheck | ||
| run: | | ||
| mkdir mdbook-linkcheck | ||
| curl -sSL -o mdbook-linkcheck.zip https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/latest/download/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip | ||
| unzip mdbook-linkcheck.zip -d ./mdbook-linkcheck | ||
| chmod +x $(pwd)/mdbook-linkcheck/mdbook-linkcheck | ||
| echo $(pwd)/mdbook-linkcheck >> $GITHUB_PATH | ||
| - name: Run linkcheck | ||
| working-directory: ./book | ||
| run: mdbook-linkcheck --standalone |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| mkdir -p $HOME/bin | ||
| export PATH=$HOME/bin:$PATH | ||
| REPO_ROOT=$(pwd) | ||
|
|
||
| echo "Installing mdbook..." | ||
| curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.14/mdbook-v0.4.14-x86_64-unknown-linux-gnu.tar.gz | tar -xz | ||
| chmod +x ./mdbook | ||
| cp ./mdbook $HOME/bin/ | ||
|
|
||
| echo "Installing mdbook-template..." | ||
| curl -sSL https://github.com/sgoudham/mdbook-template/releases/latest/download/mdbook-template-x86_64-unknown-linux-gnu.tar.gz | tar -xz | ||
| chmod +x ./mdbook-template | ||
| cp ./mdbook-template $HOME/bin/ | ||
|
|
||
| echo "Installing Rust..." | ||
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | RUSTUP_HOME=/tmp/rustup HOME=/tmp sh -s -- -y | ||
| export PATH="/tmp/.cargo/bin:$PATH" | ||
| export RUSTUP_HOME=/tmp/rustup | ||
| export CARGO_HOME=/tmp/.cargo | ||
|
|
||
| rustup toolchain install nightly | ||
| rustup default nightly | ||
|
|
||
| echo "Verifying installations..." | ||
| which mdbook | ||
| which mdbook-template | ||
| rustc --version | ||
|
|
||
| echo "Building the book..." | ||
| cd "${REPO_ROOT}/book" | ||
| mdbook build | ||
|
|
||
| echo "Building Rust documentation..." | ||
| cd "${REPO_ROOT}" | ||
| export RUSTDOCFLAGS="--cfg docsrs --show-type-layout --generate-link-to-definition --enable-index-page -Zunstable-options" | ||
| cargo doc --all-features --no-deps || { | ||
| echo "Cargo doc failed, but continuing with mdbook only" | ||
| } | ||
|
|
||
| # Try to copy the API docs if they were generated | ||
| if [ -d "${REPO_ROOT}/target/doc" ]; then | ||
| echo "Copying API documentation..." | ||
| mkdir -p "${REPO_ROOT}/book/book/api" | ||
| cp -r "${REPO_ROOT}/target/doc"/* "${REPO_ROOT}/book/book/api/" | ||
| else | ||
| echo "API documentation not generated, continuing with mdbook only" | ||
| fi | ||
|
|
||
| # Create a final output directory for Vercel | ||
| mkdir -p "${REPO_ROOT}/vercel-output" | ||
| cp -r "${REPO_ROOT}/book/book"/* "${REPO_ROOT}/vercel-output/" | ||
|
|
||
| echo "Build completed successfully!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "version": 2, | ||
| "buildCommand": "chmod +x ./.vercel/build.sh && ./.vercel/build.sh", | ||
| "outputDirectory": "vercel-output", | ||
| "ignoreCommand": "git diff --quiet HEAD^ HEAD ./book/", | ||
| "github": { | ||
| "silent": false, | ||
| "autoJobCancelation": true | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
was this meant to be deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, renamed to
book-testsbecause it's just tests now. No strong feelings about file name.