aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/docs.yml
blob: 1b14aae36bc1f32b16b1b68e6301b7cf1d45c79c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: Docs

on:
  push:
    branches:
      - master
      - ghatest
  pull_request:
    branches:
      - master
      - ghatest

env:
  CARGO_TERM_COLOR: always

jobs:
  docs:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Set up Python 3.x
        uses: actions/setup-python@v2
        with:
        # Semantic version range syntax or exact version of a Python version
          python-version: '3.x'
          # Optional - x64 or x86 architecture, defaults to x64
          architecture: 'x64'

      # You can test your matrix by printing the current Python version
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"

      - name: Install dependencies
        run: pip install git+https://github.com/linkchecker/linkchecker.git

      - name: Remove cargo-config
        run: rm -f .cargo/config

      - name: Build docs
        run: cargo doc

      - name: Check links
        run: |
          td=$(mktemp -d)
          cp -r target/doc $td/api
          linkchecker $td/api/rtic/
          linkchecker $td/api/cortex_m_rtic_macros/

  mdbook:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Set up Python 3.x
        uses: actions/setup-python@v2
        with:
        # Semantic version range syntax or exact version of a Python version
          python-version: '3.x'
          # Optional - x64 or x86 architecture, defaults to x64
          architecture: 'x64'

      # You can test your matrix by printing the current Python version
      - name: Display Python version
        run: python -c "import sys; print(sys.version)"

      - name: Install dependencies
        run: pip install git+https://github.com/linkchecker/linkchecker.git

      - name: mdBook Action
        uses: peaceiris/actions-mdbook@v1.1.11
        with:
          mdbook-version: '0.3.1'

      - name: Build book in English
        run: cd book/en && mdbook build

      - name: Build book in Russian
        run: cd book/ru && mdbook build

      - name: Check links
        run: |
          td=$(mktemp -d)
          mkdir $td/book
          cp -r book/en/book $td/book/en
          cp -r book/ru/book $td/book/ru
          cp LICENSE-* $td/book/en
          cp LICENSE-* $td/book/ru

          linkchecker $td/book/en/
          linkchecker $td/book/ru/