Add GitHub links to benchmark data files in docs #28
This file contains hidden or 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: Documentation Build & Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| jobs: | |
| docs: | |
| name: Build & Deploy Docs | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y doxygen graphviz gcc g++ lcov | |
| - name: Configure (docs) | |
| run: cmake -B build -DBUILD_DOCS=ON | |
| - name: Build Doxygen API docs | |
| run: cmake --build build --target docs | |
| - name: Copy Doxygen output into docs site | |
| run: | | |
| mkdir -p docs/api | |
| cp -r build/docs/html/* docs/api/ | |
| - name: Build and test with coverage | |
| run: | | |
| cmake -B build-cov \ | |
| -DENABLE_COVERAGE=ON \ | |
| -DBUILD_TESTS=ON \ | |
| -DBUILD_EXAMPLES=ON \ | |
| -DBUILD_JSON=ON | |
| cmake --build build-cov | |
| ctest --test-dir build-cov --output-on-failure | |
| - name: Generate coverage report | |
| run: | | |
| cd build-cov | |
| lcov --capture --directory . --output-file lcov_raw.info \ | |
| --rc branch_coverage=1 \ | |
| --ignore-errors empty,empty,unused,unused | |
| lcov --remove lcov_raw.info \ | |
| '*/tests/*' '*/_deps/*' '/usr/*' '*/examples/*' \ | |
| --output-file lcov.info \ | |
| --rc branch_coverage=1 \ | |
| --ignore-errors empty,empty,unused,unused,inconsistent | |
| genhtml lcov.info --output-directory coverage \ | |
| --branch-coverage \ | |
| --ignore-errors inconsistent | |
| - name: Copy coverage report into docs site | |
| run: | | |
| mkdir -p docs/coverage | |
| cp -r build-cov/coverage/* docs/coverage/ | |
| - name: Generate coverage badge | |
| run: | | |
| COV_PCT=$(lcov --summary build-cov/lcov.info 2>&1 | grep 'lines' | sed 's/.*: \([0-9.]*\)%.*/\1/') | |
| COV_INT=${COV_PCT%.*} | |
| if [ "$COV_INT" -ge 90 ]; then COLOR="brightgreen" | |
| elif [ "$COV_INT" -ge 75 ]; then COLOR="green" | |
| elif [ "$COV_INT" -ge 60 ]; then COLOR="yellow" | |
| else COLOR="red"; fi | |
| printf '{"schemaVersion":1,"label":"C coverage","message":"%s%%","color":"%s"}\n' "$COV_PCT" "$COLOR" > docs/coverage-badge.json | |
| - name: Generate releases page from CHANGELOG | |
| run: | | |
| # Build docs/releases.md from CHANGELOG.md with Jekyll front matter | |
| { | |
| echo '---' | |
| echo 'layout: default' | |
| echo 'title: Releases' | |
| echo '---' | |
| echo '' | |
| echo '# Releases' | |
| echo '' | |
| echo 'Download releases from the [GitHub Releases page](https://github.com/${{ github.repository }}/releases).' | |
| echo '' | |
| echo '---' | |
| echo '' | |
| # Strip the CHANGELOG header lines, keep version entries | |
| sed -n '/^## \[/,$p' CHANGELOG.md | sed 's/^## \[/## v/; s/\] - / -- /' | |
| echo '' | |
| echo '---' | |
| echo '' | |
| echo '## Installing a Release' | |
| echo '' | |
| echo '```bash' | |
| echo 'git clone https://github.com/${{ github.repository }}.git' | |
| echo 'cd triepack' | |
| echo "git checkout v$(grep 'project(triepack VERSION' CMakeLists.txt | sed 's/.*VERSION \([0-9.]*\).*/\1/')" | |
| echo 'cmake -B build -DCMAKE_BUILD_TYPE=Release' | |
| echo 'cmake --build build' | |
| echo 'sudo cmake --install build' | |
| echo '```' | |
| } > docs/releases.md | |
| - name: Setup Jekyll | |
| uses: actions/configure-pages@v4 | |
| - name: Build Jekyll site | |
| uses: actions/jekyll-build-pages@v1 | |
| with: | |
| source: docs/ | |
| destination: ./_site | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |
| continue-on-error: true |