ci: try to fix github ci #70
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
# This file is a part of Simple-XX/SimplePhysicsEngine | |
# (https://github.com/Simple-XX/SimplePhysicsEngine). | |
# | |
# workflow.yml for Simple-XX/SimplePhysicsEngine. | |
name: build | |
on: | |
- push | |
- pull_request | |
- release | |
env: | |
CMAKE_BUILD_TYPE: Release | |
jobs: | |
build_docs: | |
name: Build and publish documentation | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install --fix-missing -y doxygen graphviz clang-format clang-tidy cppcheck lcov | |
sudo apt install --fix-missing -y gcc g++ libspdlog-dev libcgal-dev freeglut3-dev libboost-all-dev libvtk9-dev qtbase5-dev xorg-dev libglu1-mesa-dev libglm-dev libglfw3-dev libglew-dev | |
- name: Build | |
run: | | |
cmake --preset=build | |
cmake --build build --target doc | |
- name: Publish | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ${{github.workspace}}/doc/html | |
build_ubuntu: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
sudo apt update | |
sudo apt install --fix-missing -y doxygen graphviz clang-format clang-tidy cppcheck lcov | |
sudo apt install --fix-missing -y gcc g++ libspdlog-dev libcgal-dev freeglut3-dev libboost-all-dev libvtk9-dev qtbase5-dev xorg-dev libglu1-mesa-dev libglm-dev libglfw3-dev libglew-dev | |
sudo apt-get install --no-install-recommends -y xvfb | |
- name: Build | |
run: | | |
cmake --preset=build | |
cmake --build build --target all | |
cmake --build build --target coverage | |
- name: Start Xvfb | |
run: | | |
nohup Xvfb :99 -screen 0 1024x768x24 & | |
echo "DISPLAY=:99" >> $GITHUB_ENV | |
- name: Run demo2d | |
run: | | |
for i in {1..7}; do | |
./build/bin/demo2d --test --instruction $i | |
done | |
env: | |
DISPLAY: :99 | |
- name: Run MassSpring3D | |
run: ./build/bin/MassSpring3D --test --instruction 1 | |
env: | |
DISPLAY: :99 | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: build/coverage/coverage.info | |
verbose: true | |
build_macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
brew install doxygen graphviz llvm cppcheck lcov spdlog boost freeglut glfw glew vtk cgal glm | |
ln -s "$(brew --prefix llvm)/bin/clang-format" "/usr/local/bin/clang-format" | |
ln -s "$(brew --prefix llvm)/bin/clang-tidy" "/usr/local/bin/clang-tidy" | |
- name: Install XQuartz | |
run: | | |
brew install --cask xquartz | |
- name: Start Xvfb | |
run: | | |
sudo Xvfb :99 -screen 0 1024x768x24 & | |
echo "DISPLAY=:99" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
cmake --preset=build | |
cmake --build build --target all | |
- name: Run demo2d | |
run: | | |
for i in {1..7}; do | |
./build/bin/demo2d --test --instruction $i | |
done | |
env: | |
DISPLAY: :99 | |
- name: Run MassSpring3D | |
run: ./build/bin/MassSpring3D --test --instruction 1 | |
env: | |
DISPLAY: :99 | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
files: build/coverage/coverage.info | |
verbose: true | |
# @bug 在 osx 下无法正常执行 lcov | |
# cmake --build build --target coverage |