Skip to content

Commit c40be4b

Browse files
authored
Merge pull request #7 from simonsan/mdbook
Adding mdbook support/CI for PRs
2 parents cff7fc2 + 99219f1 commit c40be4b

File tree

6 files changed

+392
-38
lines changed

6 files changed

+392
-38
lines changed

.env

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MDBOOK_VERSION=0.4.6
2+
MDBOOK_LINKCHECK_VERSION=0.7.2
3+
MDBOOK_TOC_VERSION=0.6.1
4+
5+
GIT_DEPLOY_DIR=book
6+
GIT_DEPLOY_BRANCH=gh-pages
7+
GIT_DEPLOY_REPO=https://github.com/rust-lang/std-dev-guide

.github/workflows/ci.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Continuous Integration
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
8+
jobs:
9+
book-test:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Read .env
15+
id: mdbook-version
16+
run: |
17+
. ./.env
18+
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}"
19+
echo "::set-output name=MDBOOK_LINKCHECK_VERSION::${MDBOOK_LINKCHECK_VERSION}"
20+
echo "::set-output name=MDBOOK_TOC_VERSION::${MDBOOK_TOC_VERSION}"
21+
22+
- name: Cache binaries
23+
id: mdbook-cache
24+
uses: actions/cache@v2
25+
with:
26+
path: |
27+
~/.cargo/bin
28+
key: ${{ runner.os }}-${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}--${{ steps.mdbook-version.outputs.DBOOK_LINKCHECK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
29+
30+
- name: Install latest stable Rust toolchain
31+
if: steps.mdbook-cache.outputs.cache-hit != 'true'
32+
uses: actions-rs/toolchain@v1
33+
with:
34+
toolchain: stable
35+
override: true
36+
37+
- name: Install Dependencies
38+
if: steps.mdbook-cache.outputs.cache-hit != 'true'
39+
run: |
40+
cargo install mdbook --version ${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}
41+
cargo install mdbook-linkcheck --version ${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}
42+
cargo install mdbook-toc --version ${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
43+
44+
- name: Test book
45+
run: mdbook test
46+
47+
book-build:
48+
runs-on: ubuntu-20.04
49+
steps:
50+
- uses: actions/checkout@v2
51+
52+
- name: Read .env
53+
id: mdbook-version
54+
run: |
55+
. ./.env
56+
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}"
57+
echo "::set-output name=MDBOOK_LINKCHECK_VERSION::${MDBOOK_LINKCHECK_VERSION}"
58+
echo "::set-output name=MDBOOK_TOC_VERSION::${MDBOOK_TOC_VERSION}"
59+
60+
- name: Cache binaries
61+
id: mdbook-cache
62+
uses: actions/cache@v2
63+
with:
64+
path: |
65+
~/.cargo/bin
66+
key: ${{ runner.os }}-${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}--${{ steps.mdbook-version.outputs.DBOOK_LINKCHECK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
67+
68+
- name: Install latest stable Rust toolchain
69+
if: steps.mdbook-cache.outputs.cache-hit != 'true'
70+
uses: actions-rs/toolchain@v1
71+
with:
72+
toolchain: stable
73+
override: true
74+
75+
- name: Install Dependencies
76+
if: steps.mdbook-cache.outputs.cache-hit != 'true'
77+
run: |
78+
cargo install mdbook --version ${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}
79+
cargo install mdbook-linkcheck --version ${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}
80+
cargo install mdbook-toc --version ${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
81+
82+
- name: Build book for testing
83+
run: mdbook build

.github/workflows/gh-pages.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: github pages
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-20.04
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Read .env
15+
id: mdbook-version
16+
run: |
17+
. ./.env
18+
echo "::set-output name=MDBOOK_VERSION::${MDBOOK_VERSION}"
19+
echo "::set-output name=MDBOOK_LINKCHECK_VERSION::${MDBOOK_LINKCHECK_VERSION}"
20+
echo "::set-output name=MDBOOK_TOC_VERSION::${MDBOOK_TOC_VERSION}"
21+
22+
- name: Cache binaries
23+
id: mdbook-cache
24+
uses: actions/cache@v2
25+
with:
26+
path: |
27+
~/.cargo/bin
28+
key: ${{ runner.os }}-${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}--${{ steps.mdbook-version.outputs.DBOOK_LINKCHECK_VERSION }}--${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
29+
30+
- name: Install latest stable Rust toolchain
31+
if: steps.mdbook-cache.outputs.cache-hit != 'true'
32+
uses: actions-rs/toolchain@v1
33+
with:
34+
toolchain: stable
35+
override: true
36+
37+
- name: Install Dependencies
38+
if: steps.mdbook-cache.outputs.cache-hit != 'true'
39+
run: |
40+
cargo install mdbook --version ${{ steps.mdbook-version.outputs.MDBOOK_VERSION }}
41+
cargo install mdbook-linkcheck --version ${{ steps.mdbook-version.outputs.MDBOOK_LINKCHECK_VERSION }}
42+
cargo install mdbook-toc --version ${{ steps.mdbook-version.outputs.MDBOOK_TOC_VERSION }}
43+
44+
- name: Build book
45+
run: mdbook build
46+
47+
- name: Deploy to gh-pages
48+
run: |
49+
git config --global user.email "Runner@GH Actions Deployment"
50+
git config --global user.name "GH Actions Runner"
51+
chmod u+x ci/ghpages-deploy.sh
52+
./ci/ghpages-deploy.sh

.travis.yml

-38
This file was deleted.

book.toml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[book]
2+
title = "Standard library developers Guide"
3+
authors = ["the rust-lang authors"]
4+
description = "Guide for standard library developers"
5+
language = "en"
6+
multilingual = false
7+
src = "./src"
8+
9+
[build]
10+
create-missing = false
11+
12+
[rust]
13+
edition = "2018"
14+
15+
[preprocessor.toc]
16+
command = "mdbook-toc"
17+
renderer = ["html"]
18+
19+
[output.linkcheck]
20+
21+
[output.html]
22+
default-theme = "rust"
23+
git-repository-url = "https://github.com/rust-lang/std-dev-guide"
24+
git-repository-icon = "fa-github"

0 commit comments

Comments
 (0)