Skip to content

Adding mdbook support/CI for PRs #7

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 6 commits into from
Feb 2, 2021
Merged
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
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MDBOOK_VERSION=0.4.6
MDBOOK_LINKCHECK_VERSION=0.7.2
MDBOOK_TOC_VERSION=0.6.1

GIT_DEPLOY_DIR=book
GIT_DEPLOY_BRANCH=gh-pages
GIT_DEPLOY_REPO=https://github.com/rust-lang/std-dev-guide
83 changes: 83 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Continuous Integration

on:
push:
branches: [master]
pull_request:

jobs:
book-test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Read .env
id: mdbook-version
run: |
. ./.env
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}"
echo "::set-output name=MDBOOK_LINKCHECK_VERSION::${MDBOOK_LINKCHECK_VERSION}"
echo "::set-output name=MDBOOK_TOC_VERSION::${MDBOOK_TOC_VERSION}"

- name: Cache binaries
id: mdbook-cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}--${{ steps.mdbook-version.outputs.DBOOK_LINKCHECK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}

- name: Install latest stable Rust toolchain
if: steps.mdbook-cache.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install Dependencies
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
cargo install mdbook --version ${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}
cargo install mdbook-linkcheck --version ${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}
cargo install mdbook-toc --version ${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}

- name: Test book
run: mdbook test

book-build:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Read .env
id: mdbook-version
run: |
. ./.env
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}"
echo "::set-output name=MDBOOK_LINKCHECK_VERSION::${MDBOOK_LINKCHECK_VERSION}"
echo "::set-output name=MDBOOK_TOC_VERSION::${MDBOOK_TOC_VERSION}"

- name: Cache binaries
id: mdbook-cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}--${{ steps.mdbook-version.outputs.DBOOK_LINKCHECK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}

- name: Install latest stable Rust toolchain
if: steps.mdbook-cache.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install Dependencies
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
cargo install mdbook --version ${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}
cargo install mdbook-linkcheck --version ${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}
cargo install mdbook-toc --version ${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}

- name: Build book for testing
run: mdbook build
52 changes: 52 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: github pages

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2

- name: Read .env
id: mdbook-version
run: |
. ./.env
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}"
echo "::set-output name=MDBOOK_LINKCHECK_VERSION::${MDBOOK_LINKCHECK_VERSION}"
echo "::set-output name=MDBOOK_TOC_VERSION::${MDBOOK_TOC_VERSION}"

- name: Cache binaries
id: mdbook-cache
uses: actions/cache@v2
with:
path: |
~/.cargo/bin
key: ${{ runner.os }}-${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}--${{ steps.mdbook-version.outputs.DBOOK_LINKCHECK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}

- name: Install latest stable Rust toolchain
if: steps.mdbook-cache.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install Dependencies
if: steps.mdbook-cache.outputs.cache-hit != 'true'
run: |
cargo install mdbook --version ${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}
cargo install mdbook-linkcheck --version ${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}
cargo install mdbook-toc --version ${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}

- name: Build book
run: mdbook build

- name: Deploy to gh-pages
run: |
git config --global user.email "Runner@GH Actions Deployment"
git config --global user.name "GH Actions Runner"
chmod u+x ci/ghpages-deploy.sh
./ci/ghpages-deploy.sh
38 changes: 0 additions & 38 deletions .travis.yml

This file was deleted.

24 changes: 24 additions & 0 deletions book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[book]
title = "Standard library developers Guide"
authors = ["the rust-lang authors"]
description = "Guide for standard library developers"
language = "en"
multilingual = false
src = "./src"

[build]
create-missing = false

[rust]
edition = "2018"

[preprocessor.toc]
command = "mdbook-toc"
renderer = ["html"]

[output.linkcheck]

[output.html]
default-theme = "rust"
git-repository-url = "https://github.com/rust-lang/std-dev-guide"
git-repository-icon = "fa-github"
Loading