]> git.proxmox.com Git - rustc.git/blob - src/doc/rustc-dev-guide/.github/workflows/ci.yml
New upstream version 1.52.0~beta.3+dfsg1
[rustc.git] / src / doc / rustc-dev-guide / .github / workflows / ci.yml
1 name: CI
2
3 on:
4 push:
5 branches:
6 - master
7 pull_request:
8 schedule:
9 # Run at 18:00 UTC every day
10 - cron: '0 18 * * *'
11
12 jobs:
13 ci:
14 runs-on: ubuntu-latest
15 env:
16 MDBOOK_VERSION: 0.4.7
17 MDBOOK_LINKCHECK_VERSION: 0.7.2
18 MDBOOK_TOC_VERSION: 0.6.1
19 DEPLOY_DIR: book/html
20 BASE_SHA: ${{ github.event.pull_request.base.sha }}
21 steps:
22 - uses: actions/checkout@v2
23 with:
24 # linkcheck needs the base commit.
25 fetch-depth: 0
26
27 - name: Cache binaries
28 id: mdbook-cache
29 uses: actions/cache@v2
30 with:
31 path: |
32 ~/.cargo/bin
33 key: ${{ runner.os }}-${{ env.MDBOOK_VERSION }}--${{ env.MDBOOK_LINKCHECK_VERSION }}--${{ env.MDBOOK_TOC_VERSION }}
34
35 - name: Cache linkcheck
36 uses: actions/cache@v2
37 with:
38 path: |
39 ~/book/linkcheck
40 key: ${{ runner.os }}-${{ hashFiles('./book/linkcheck') }}
41
42 - name: Check line lengths
43 if: github.event_name != 'push'
44 run: |
45 shopt -s globstar
46 MAX_LINE_LENGTH=100 bash ci/check_line_lengths.sh src/**/*.md
47
48 - name: Install latest nightly Rust toolchain
49 if: steps.mdbook-cache.outputs.cache-hit != 'true'
50 uses: actions-rs/toolchain@v1
51 with:
52 toolchain: nightly
53 override: true
54
55 - name: Install Dependencies
56 if: steps.mdbook-cache.outputs.cache-hit != 'true'
57 run: |
58 cargo install mdbook --version ${{ env.MDBOOK_VERSION }}
59 cargo install mdbook-linkcheck --version ${{ env.MDBOOK_LINKCHECK_VERSION }}
60 cargo install mdbook-toc --version ${{ env.MDBOOK_TOC_VERSION }}
61
62 - name: Check build
63 run: mdbook build
64
65 - name: Deploy to gh-pages
66 if: github.event_name == 'push' && github.repository == 'rust-lang/rustc-dev-guide'
67 run: |
68 touch "${{ env.DEPLOY_DIR }}/.nojekyll"
69 cp CNAME "${{ env.DEPLOY_DIR }}"
70 cd "${{ env.DEPLOY_DIR }}"
71 rm -rf .git
72 git init
73 git config user.name "Deploy from CI"
74 git config user.email ""
75 git add .
76 git commit -m "Deploy ${GITHUB_SHA} to gh-pages"
77 git push --quiet -f "https://x-token:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}" HEAD:gh-pages