forked from nrfconnect/sdk-nrf
-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (92 loc) · 3.42 KB
/
docbuild.yml
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
94
95
96
97
98
99
100
101
102
103
104
name: Documentation Build
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- 'v*-branch'
push:
branches:
- main
- 'v*-branch'
tags:
- v*
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
with:
path: ncs/nrf
fetch-depth: 0
- name: cache-pip
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-doc-pip
# Doxygen >= 1.8.18 is required. This can be removed once ubuntu-latest ships
# a compatible version. More details: https://github.com/doxygen/doxygen/issues/7411.
- name: Install packages
run: |
sudo apt update
sudo apt-get install -y ninja-build mscgen plantuml libclang1-9 libclang-cpp9
DOXYGEN_VERSION=$(cat ./ncs/nrf/scripts/tools-versions-linux.txt |grep 'doxygen' | sed 's/^.*=//')
wget --no-verbose https://downloads.sourceforge.net/project/doxygen/rel-${DOXYGEN_VERSION}/doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz
tar xf doxygen-${DOXYGEN_VERSION}.linux.bin.tar.gz
echo "${PWD}/doxygen-${DOXYGEN_VERSION}/bin" >> $GITHUB_PATH
- name: Install base dependencies
working-directory: ncs
run: |
sudo pip3 install -U setuptools wheel pip
pip3 install -r nrf/scripts/requirements-base.txt
- name: West init and update
working-directory: ncs
run: |
west init -l nrf
west update
west zephyr-export
- name: Install documentation dependencies
working-directory: ncs
run: |
pip3 install -r zephyr/scripts/requirements-doc.txt -r nrf/scripts/requirements-doc.txt
- name: Build documentation
working-directory: ncs/nrf
run: |
cmake -GNinja -Bdoc/_build -Sdoc -DSPHINXOPTS_EXTRA="-W"
ninja -C doc/_build
- name: Build cache
if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') }}
working-directory: ncs/nrf
run: |
python3 doc/_scripts/cache_create.py -b doc/_build -o cache
- name: Prepare extra cache files
if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') }}
working-directory: ncs/nrf/cache
run: |
mkdir extra && cd extra
# Keep root HTML files
cp ../../doc/_build/html/index.html .
cp ../../doc/_build/html/versions.json .
# Create documentation upload files
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "publish2 dev PR-${{ github.event.number }} __FILE__" > monitor.txt
echo "${{ github.event.number }}" > pr.txt
else
VERSION_REGEX="^v([0-9a-z\.\-]+)$"
if [[ ${GITHUB_REF#refs/tags/} =~ $VERSION_REGEX ]]; then
VERSION=${BASH_REMATCH[1]}
elif [[ ${GITHUB_REF#refs/heads/} == "main" ]]; then
VERSION="latest"
else
echo "Not a release or latest, skipping publish"
exit 0
fi
echo "publish2 main ${VERSION} __FILE__" > monitor.txt
fi
- name: Archive cache
if: ${{ !contains(github.event.pull_request.labels.*.name, 'external') }}
uses: actions/upload-artifact@v2
with:
name: cache
path: ncs/nrf/cache