QCodeEditor: Update to current cpeditor/QCodeEditor fork, commit ed1196a
[smuview.git] / .github / workflows / documentation.yml
blobcaa7c7e076f8ee64f3b86e620ab7f52fdebaf6ed
1 name: SmuView Documentation
3 on:
4   push:
5     branches:
6       - master
7     paths:
8       - "manual/**"
9       - "src/python/bindings.cpp"
10   workflow_dispatch:
12 defaults:
13   run:
14     shell: bash
16 env:
17   # The path where the compiled packages will be installed.
18   INSTALL_DIR: "${{ github.workspace }}/sr"
19   # Git URL for the sigrok dependencies
20   SIGROK_REPO_BASE: "https://github.com/sigrokproject"
21   # Build type for SmuView (Debug, Release, RelWithDebInfo, MinSizeRel)
22   BUILD_TYPE: "Release"
23   # Misc commands
24   WGET: "wget -c --quiet"
25   GIT_CLONE: "git clone --depth=1"
28 jobs:
30   build_manual:
31     name: SmuView Manual
33     runs-on: ubuntu-latest
35     env:
36       BUILD_TYPE: "Release"
38     steps:
39       - name: Install dependencies
40         run: |
41           sudo apt-get update
42           sudo apt-get install -y \
43             git-core gcc make autoconf automake libtool \
44             g++ autoconf-archive pkg-config libglib2.0-dev libglibmm-2.4-dev \
45             libzip-dev check doxygen swig \
46             cmake libboost-dev libqt5svg5-dev qtbase5-dev libqwt-qt5-dev \
47             python3-dev python-gi-dev python-setuptools \
48             asciidoctor ruby-asciidoctor-pdf coderay
50       - name: Checkout sigrok-utils
51         uses: actions/checkout@v3
52         with:
53           repository: knarfS/sigrok-util
54           path: sigrok-util
55           ref: github
57       - name: Build dependencies
58         run: |
59           cd sigrok-util/cross-compile/github-actions
60           source sigrok-linux-init-toolchain.sh
61           ./sigrok-linux-build-dependencies.sh
63       - name: Checkout smuview
64         uses: actions/checkout@v3
65         with:
66           path: smuview
68       - name: Build manual
69         run: |
70           source sigrok-util/cross-compile/github-actions/sigrok-linux-init-toolchain.sh
71           mkdir -p smuview/build
72           cd smuview/build
73           PKG_CONFIG_PATH=$P cmake \
74             -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_DIR \
75             -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
76             -DDISABLE_WERROR=TRUE \
77             -DENABLE_TESTS=FALSE \
78             ..
79           make manual $V
80           make manual-publish $V
82       - name: Upload artifact
83         uses: actions/upload-artifact@v3
84         with:
85           name: SmuView_manual
86           path: smuview/build/manual_publish/
89   build_python_doc:
90     name: SmuView Python API
92     runs-on: ubuntu-latest
94     env:
95       BUILD_TYPE: "Release"
97     steps:
98       - name: Install dependencies
99         run: |
100           sudo apt-get update
101           sudo apt-get install -y \
102             git-core gcc make autoconf automake libtool \
103             g++ autoconf-archive pkg-config libglib2.0-dev libglibmm-2.4-dev \
104             libzip-dev check doxygen swig \
105             cmake libboost-dev libqt5svg5-dev qtbase5-dev libqwt-qt5-dev \
106             python3-dev python-gi-dev python-setuptools coreutils
108       - name: Checkout sigrok-utils
109         uses: actions/checkout@v3
110         with:
111           repository: knarfS/sigrok-util
112           path: sigrok-util
113           ref: github
115       - name: Build dependencies
116         run: |
117           cd sigrok-util/cross-compile/github-actions
118           source sigrok-linux-init-toolchain.sh
119           ./sigrok-linux-build-dependencies.sh
121       - name: Checkout smuview
122         uses: actions/checkout@v3
123         with:
124           path: smuview
126       - name: Build smuview
127         run: |
128           source sigrok-util/cross-compile/github-actions/sigrok-linux-init-toolchain.sh
129           mkdir -p smuview/build
130           cd smuview/build
131           PKG_CONFIG_PATH=$P cmake \
132             -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_DIR \
133             -DCMAKE_BUILD_TYPE=$BUILD_TYPE \
134             -DDISABLE_WERROR=y \
135             -DENABLE_TESTS=FALSE \
136             ..
137           make $PARALLEL $V
138           make install $V
140       - name: Build API doc
141         run: |
142           pip3 install pdoc3
143           export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$INSTALL_DIR/lib"
144           # Source versions  and create destination folders
145           source smuview/build/contrib/config_version.sh
146           mkdir -p api_doc/"$SV_MANUAL_VERSION"
147           # Create script for generating the API doc
148           cat > gen_api.py << EOF
149           import smuview
150           import pdoc
151           html_str = pdoc.html("smuview", show_type_annotations=True)
152           f = open('./api_doc/$SV_MANUAL_VERSION/python_bindings_api.html', 'w')
153           print(html_str, file=f)
154           f.close()
155           EOF
156           # Generating the API doc
157           timeout --preserve-status 60 $INSTALL_DIR/bin/smuview -s gen_api.py -platform offscreen
159       - name: Upload artifact
160         uses: actions/upload-artifact@v3
161         with:
162           name: SmuView_Python_API
163           path: api_doc/
166   publish:
167     name: SmuView documentation publish
169     runs-on: ubuntu-latest
171     needs:
172       - build_manual
173       - build_python_doc
175     steps:
176       - name: Download artifacts
177         uses: actions/download-artifact@v2
179       - name: Inspect directory after downloading artifacts
180         run: ls -alFR
182       - name: Checkout knarfS.github.io
183         uses: actions/checkout@v3
184         with:
185           repository: knarfS/knarfS.github.io
186           path: knarfS.github.io
187           persist-credentials: false
189       - name: Copy documentation
190         run: |
191           cp -r SmuView_manual/* knarfS.github.io/doc/smuview
192           cp -r SmuView_Python_API/* knarfS.github.io/doc/smuview
194       - name: Publish documentation
195         uses: cpina/github-action-push-to-another-repository@main
196         env:
197           SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
198         with:
199           source-directory: "knarfS.github.io"
200           destination-github-username: "knarfS"
201           destination-repository-name: "knarfS.github.io"
202           user-email: "frank-stettner@gmx.net"
203           target-branch: "master"
204           commit-message: "Automated update for ORIGIN_COMMIT"