GitHub CI: add C/C++ SonarCloud workflow #1380
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: NMODL Documentation | |
concurrency: | |
group: ${{ github.workflow }}#${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- master | |
- release/** | |
pull_request: | |
branches: | |
- master | |
- release/** | |
env: | |
BUILD_TYPE: Release | |
PYTHON_VERSION: 3.8 | |
DESIRED_CMAKE_VERSION: 3.15.0 | |
jobs: | |
ci: | |
runs-on: ubuntu-20.04 | |
name: documentation | |
env: | |
INSTALL_DIR: install | |
strategy: | |
fail-fast: true | |
steps: | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v1 | |
with: | |
cmake-version: ${{ env.DESIRED_CMAKE_VERSION }} | |
- name: Install apt packages | |
run: | | |
sudo apt-get update | |
sudo apt-get install bison ccache dvipng doxygen flex libfl-dev \ | |
ninja-build pandoc python3-dev python3-pip \ | |
texlive-latex-recommended texlive-latex-extra | |
shell: bash | |
- name: Set up Python3 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- uses: actions/checkout@v3 | |
- name: Install Python3 dependencies | |
working-directory: ${{runner.workspace}}/nmodl | |
run: | | |
pip3 install -U pip setuptools | |
pip3 install --user -r requirements.txt | |
# This step will set up an SSH connection on tmate.io for live debugging. | |
# To trigger it, simply add 'live-debug-docs' to your last pushed commit message. | |
- name: live debug session on failure | |
if: failure() && contains(github.event.head_commit.message, 'live-debug-docs') | |
uses: mxschmitt/action-tmate@v3 | |
- name: Restore compiler cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{runner.workspace}}/ccache | |
key: docs-${{github.ref}}-${{github.sha}} | |
restore-keys: | | |
docs-${{github.ref}}- | |
docs- | |
- name: Documentation | |
id: documentation | |
working-directory: ${{runner.workspace}}/nmodl | |
run: | | |
echo "------- Build Documentation -------"; | |
ccache -z | |
ccache -s | |
python3 setup.py build_ext --inplace docs -j 2 -G Ninja \ | |
-- -DCMAKE_CXX_COMPILER_LAUNCHER=ccache; | |
ccache -s | |
cd _skbuild/linux-x86_64-3.8/setuptools/sphinx; | |
rm -rf doctest doctrees && touch .nojekyll; | |
echo "<meta http-equiv=\"refresh\" content=\"0; url=./html/index.html\" />" > index.html; | |
echo "status=done" >> $GITHUB_OUTPUT | |
env: | |
CCACHE_DIR: ${{runner.workspace}}/ccache | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
if: steps.documentation.outputs.status == 'done' && startsWith(github.ref, 'refs/heads/master') | |
with: | |
branch: gh-pages # The branch the action should deploy to. | |
folder: ${{runner.workspace}}/nmodl/_skbuild/linux-x86_64-3.8/setuptools/sphinx # The folder the action should deploy. | |
clean: false # Automatically remove deleted files from the deploy branch |