Skip to content

Merge pull request #9 from Battery-Intelligence-Lab/dependabot/github… #180

Merge pull request #9 from Battery-Intelligence-Lab/dependabot/github…

Merge pull request #9 from Battery-Intelligence-Lab/dependabot/github… #180

Workflow file for this run

name: Build, test and generate docs
on:
push:
branches:
- main # Due to protection of branches only main can push docs
# paths:
# - 'dtwc/**'
# - 'docs/**'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Build master with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: 'docs'
destination: ./_site
- run: sudo rm -rf build
- run: mkdir build
- name: Create Doxygen Files
uses: mattnotmitt/[email protected]
with:
doxyfile-path: 'docs/Doxyfile'
- run: sudo sed -ri 's/<div id="projectname">(.*)/<div id="projectname"><a href="..\/index.html">\1 <\/a>/g' ./build/Doxygen/html/index.html
- run: sudo mv ./build/Doxygen/html ./_site/Doxygen
- run: sudo cp -r ./media ./_site/Doxygen #Copy media folder into Doxygen folder.
# Create a coverage report and upload to the website!
- name: update
run: sudo apt update
- name: install compiler and dependencies
run: sudo apt install gcc-11 g++-11 lcov
- name: make build directory
run: mkdir build_dir
- name: cmake configure
run: cmake .. -DCMAKE_BUILD_TYPE=Debug -DDTWC_ENABLE_COVERAGE:BOOL=TRUE -DDTWC_BUILD_TESTING=ON
working-directory: build_dir
env:
CC: gcc-11
CXX: g++-11
- name: cmake build
run: cmake --build . --parallel 2
working-directory: build_dir
- name: cmake test
run: ctest -j2 -C Debug --output-on-failure
working-directory: build_dir
- name: upload coverage results
run: |
lcov --directory ./tests --capture --output-file coverage.info
lcov --remove coverage.info '*/tests/*' '*/armadillo_bits/*' '*/eigen-src/*' '/_deps/*' '/usr/*' '*/catch2/*' --output-file coverage.info
lcov --list coverage.info
bash <(curl https://codecov.io/bash) -f coverage.info
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
working-directory: build_dir
- name: generate html report for website
run: genhtml coverage.info -o Coverage
working-directory: build_dir
- run: sudo mv ./build_dir/Coverage ./_site/Coverage
# JOSS Paper Compilation Steps
- name: Build draft PDF for JOSS paper
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
paper-path: joss/paper.md
- name: Create directory for JOSS paper
run: sudo mkdir -p ./_site/pub
- name: Move JOSS paper to documentation
run: sudo mv ./joss/paper.pdf ./_site/pub/joss.pdf
# Upload the website:
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
# Publication job
publish:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4