deploy documentation to static sites #225
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: Test Linux | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
generateDocx: | |
description: 'Generate docx report' | |
required: false | |
type: boolean | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
pybmds: | |
runs-on: ubuntu-22.04 | |
env: | |
generateDocx: ${{ inputs.generateDocx }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
cache: pip | |
- name: Install dependencies | |
run: | | |
echo "generateDocx: $generateDocx" | |
source ./tools/linux_ci_setup.sh | |
if [ "$generateDocx" = "true" ]; then | |
sudo apt-get install -y pandoc | |
fi | |
- name: Build pybmds | |
run: | | |
source ./tools/linux_ci_env.sh | |
python -m pip install -U pip wheel | |
python -m pip install -e ".[dev,docs]" | |
stubgen -p pybmds.bmdscore -o src | |
ruff format src/pybmds/bmdscore.pyi | |
python -c "import pybmds; print(pybmds.bmdscore.version())" | |
- name: Check linked files | |
run: | | |
ls -lah src/pybmds | |
ldd src/pybmds/bmdscore*.so | |
- name: loc | |
run: | | |
sudo apt-get install -y cloc | |
echo "# Lines of Code Report" >> $GITHUB_STEP_SUMMARY | |
make loc >> $GITHUB_STEP_SUMMARY | |
- name: Check linting | |
run: | | |
make lint | |
- name: Test with pytest | |
run: | | |
coverage run -m pytest | |
echo "# Python coverage report" >> $GITHUB_STEP_SUMMARY | |
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY | |
coverage html -d coverage -i | |
- name: Build documentation | |
run: | | |
make docs | |
if [ "$generateDocx" = "true" ]; then | |
make docs-docx | |
mv docs/build/pybmds.docx docs/build/html/pybmds.docx | |
fi | |
chmod -R a+rX docs/build/html # required for github pages | |
- name: Upload Documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: docs/build/html | |
retention-days: 14 | |
- name: Upload Coverage Report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: coverage | |
retention-days: 14 | |
bmdscore: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
source ./tools/linux_ci_setup.sh | |
- name: Run clang-format | |
run: | | |
pip install clang-format==19.1.3 | |
make format-cpp | |
git diff --exit-code --compact-summary || { echo "Code formatting failed; run 'make format-cpp'"; exit 1; } | |
- name: Build bmdscore | |
run: | | |
source ./tools/linux_ci_env.sh | |
mkdir -p src/build | |
cd src/build | |
cmake .. | |
make -j$(nproc) | |
- name: Run tests and generate report | |
run: | | |
source ./tools/linux_ci_env.sh | |
cd src/build | |
make run_tests_with_coverage | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cpp-coverage | |
path: | | |
./src/build/coverage/* | |
docs: | |
name: Deploy documentation to GitHub Pages | |
needs: pybmds | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: docs |