Update main.yml #549
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: CI | |
on: | |
push: | |
branches: [ dev ] | |
pull_request: | |
branches: [ dev ] | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
# Note: some steps require the checkout in the root directory | |
- uses: actions/checkout@v3 | |
- name: Build KnowRob workspace | |
shell: bash | |
run: | | |
sudo add-apt-repository ppa:swi-prolog/stable | |
curl -fsSL https://www.mongodb.org/static/pgp/server-6.0.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-6.gpg | |
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list | |
sudo apt-get update -y -qq | |
sudo apt-get install swi-prolog libspdlog-dev \ | |
libboost-python-dev libboost-serialization-dev libboost-program-options-dev \ | |
libraptor2-dev librdf0-dev libgtest-dev \ | |
libfmt-dev libeigen3-dev libmongoc-dev \ | |
doxygen graphviz mongodb-org | |
mkdir build | |
cd build | |
cmake ../ | |
make 2> >(tee "make-output.txt") | |
- name: Annotate compilation warnings/errors | |
if: ${{github.event_name == 'pull_request'}} | |
uses: JacobDomagala/CompileResult@master | |
# just so that in case this step fails, the workflow doesn't stop. | |
# this is done as it is unclear how well the action is maintained. | |
continue-on-error: true | |
with: | |
comment_title: Compilation | |
compile_result_file: build/make-output.txt | |
- name: setup init_script | |
shell: bash | |
run: | | |
add-apt-repository ppa:oibaf/graphics-drivers | |
sudo apt-get install -y -qq libvulkan1 mesa-vulkan-drivers vulkan-utils | |
echo "#!/bin/bash | |
# Input args provided by StaticAnalysis action | |
root_dir=\${1} | |
build_dir=\${2} | |
echo \"Hello from the init script! First arg=\${root_dir} second arg=\${build_dir}\"" > init_script.sh | |
- name: Run static analysis | |
uses: JacobDomagala/StaticAnalysis@master | |
with: | |
language: c++ | |
# Exclude any issues found in ${Project_root_dir}/lib | |
exclude_dir: lib | |
use_cmake: true | |
# Additional apt packages that need to be installed before running Cmake | |
apt_pckgs: software-properties-common libglu1-mesa-dev freeglut3-dev mesa-common-dev | |
# Additional script that will be run (sourced) AFTER 'apt_pckgs' and before running Cmake | |
init_script: init_script.sh | |
# (Optional) clang-tidy args | |
clang_tidy_args: -checks='*,fuchsia-*,google-*,zircon-*,abseil-*,modernize-use-trailing-return-type' | |
# (Optional) cppcheck args | |
cppcheck_args: --enable=all --suppress=missingIncludeSystem | |
- name: Create debian package | |
if: ${{github.event_name == 'push' || github.event_name == 'release'}} | |
shell: bash | |
run: | | |
cd build | |
cpack | |
- name: Run unit tests | |
if: ${{github.event_name == 'push' || github.event_name == 'pull_request'}} | |
shell: bash | |
run: | | |
sudo systemctl start mongod | |
cd build | |
./all_gtests --gtest_filter=* --gtest_output="xml:$GITHUB_WORKSPACE/gtest-knowrob.xml" --gtest_color=no | |
- name: Report test results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: ${{github.event_name == 'push' || github.event_name == 'pull_request'}} | |
with: | |
junit_files: "gtest-knowrob.xml" | |
action_fail: true | |
action_fail_on_inconclusive: true | |
##### | |
- name: Run doxygen | |
if: ${{github.event_name == 'push' || github.event_name == 'release'}} | |
shell: bash | |
run: | | |
cd build | |
make doc | |
- name: Extract version tag | |
if: github.event_name == 'release' | |
shell: bash | |
# Extract major.minor version from tag | |
run: echo "KNOWROB_DOCU_VERSION=$(echo ${GITHUB_REF#refs/tags/} | cut -d'.' -f1,2)" >> $GITHUB_ENV | |
- name: Extract branch name | |
if: github.event_name == 'push' | |
shell: bash | |
# Use branch name as version | |
run: echo "KNOWROB_DOCU_VERSION=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_ENV | |
- name: Deploy doc to gh-pages | |
if: ${{github.event_name == 'push' || github.event_name == 'release'}} | |
uses: JamesIves/[email protected] | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# The branch the action should deploy to. | |
BRANCH: gh-pages | |
# The folder the action should deploy. | |
FOLDER: doc/html | |
# The folder in the target branch | |
TARGET_FOLDER: ${{ env.KNOWROB_DOCU_VERSION }} | |
CLEAN: true | |
SINGLE_COMMIT: true | |
##### | |
- name: Release debian package | |
if: github.event_name == 'release' | |
shell: bash | |
env: | |
GITHUB_TOKEN: ${{ github.TOKEN }} | |
run: | | |
gh release upload ${{github.event.release.tag_name}} ./build/knowrob-*.deb | |
- name: Upload debian package | |
if: github.event_name == 'push' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debian package | |
path: ./build/knowrob-*.deb | |
- name: Upload test results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test results | |
path: ./gtest-knowrob.xml |