Improve code style and add tests #427
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: Deploy | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
release: | |
types: [published] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
jobs: | |
# send-slack-notification: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: send slack message | |
# uses: docker://technosophos/slack-notify | |
# env: | |
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
# SLACK_MESSAGE: "Building QtMeshEditor in GitHub Actions - works! :D" | |
#################################################################### | |
# Windows Deploy | |
#################################################################### | |
build-n-cache-assimp-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Cache Assimp | |
id: cache-assimp-windows | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-windows | |
with: | |
# It is caching the folder that also contains source and building files, maybe in the future it would be nice cache only the includes and dll | |
path: | | |
C:/PROGRA~2/Assimp | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- if: steps.cache-assimp-windows.outputs.cache-hit != 'true' | |
name: Set up MinGW | |
uses: e-t-l/setup-mingw@patch-1 #egor-tensin/setup-mingw@v2 | |
with: | |
platform: x64 | |
- if: steps.cache-assimp-windows.outputs.cache-hit != 'true' | |
name: Check out Assimp repo | |
uses: actions/checkout@master | |
with: | |
repository: assimp/assimp | |
path: ${{github.workspace}}/assimp | |
- if: steps.cache-assimp-windows.outputs.cache-hit != 'true' | |
name: Windows - Workaround to fix the need of utf8.h file https://github.com/assimp/assimp/issues/5005 | |
run: | | |
xcopy /I /S /E "D:/a/QtMeshEditor/QtMeshEditor/assimp/contrib" "C:/PROGRA~2/Assimp/include/contrib" | |
cd D:/a/QtMeshEditor/QtMeshEditor/assimp/contrib | |
dir | |
cd C:/PROGRA~2/Assimp/include/contrib | |
dir | |
shell: cmd | |
- if: steps.cache-assimp-windows.outputs.cache-hit != 'true' | |
name: Build Assimp repo | |
env: | |
CMAKE_GENERATOR: "MinGW Makefiles" | |
run: | | |
cd ${{github.workspace}}/assimp | |
cmake -S . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_GENERATOR="MinGW Makefiles" -DASSIMP_WARNINGS_AS_ERRORS=OFF | |
mingw32-make install -j8 | |
xcopy /I "C:/PROGRA~2/Assimp" "${{github.workspace}}/assimp-build" | |
shell: cmd | |
build-n-cache-ogre-windows: | |
needs: build-n-cache-assimp-windows | |
runs-on: windows-latest | |
steps: | |
- name: Cache Assimp | |
id: cache-assimp-windows | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-windows | |
with: | |
path: | | |
C:/PROGRA~2/Assimp | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- name: Cache Ogre | |
id: cache-ogre-windows | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-ogre-windows | |
with: | |
path: ${{github.workspace}}/ogre-build/SDK | |
# Need to delete manually if needed to rebuild. Until I find a better solution for detecting changes in the ogre repo. | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- if: steps.cache-ogre-windows.outputs.cache-hit != 'true' | |
name: Install Doxygen | |
shell: cmd | |
run: | | |
curl -L -o doxygen-installer.exe "https://www.doxygen.nl/files/doxygen-1.9.7-setup.exe" | |
doxygen-installer.exe /VERYSILENT | |
- if: steps.cache-ogre-windows.outputs.cache-hit != 'true' | |
name: Check out ogre repo | |
uses: actions/checkout@master | |
with: | |
repository: OGRECave/ogre | |
path: ${{github.workspace}}/ogre | |
- if: steps.cache-ogre-windows.outputs.cache-hit != 'true' | |
name: Set up MinGW | |
uses: e-t-l/setup-mingw@patch-1 #egor-tensin/setup-mingw@v2 | |
with: | |
platform: x64 | |
- if: steps.cache-ogre-windows.outputs.cache-hit != 'true' | |
name: Build Ogre3D | |
shell: cmd | |
env: | |
CMAKE_GENERATOR: "MinGW Makefiles" | |
ASSIMP_DIR: "C:/Program Files (x86)/Assimp/lib/cmake/assimp-5.2/" | |
run: | | |
cd ${{github.workspace}}/ogre | |
cmake -B ${{github.workspace}}/ogre-build -S . -DDOXYGEN_EXECUTABLE="C:\Program Files\doxygen\bin\doxygen.exe" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_STANDARD=17 -DOGRE_BUILD_PLUGIN_ASSIMP=ON -DOGRE_BUILD_PLUGIN_PCZ=ON -DOGRE_BUILD_PLUGIN_DOT_SCENE=ON -DOGRE_BUILD_RENDERSYSTEM_GL=ON -DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=ON -DOGRE_BUILD_RENDERSYSTEM_GLES2=OFF -DOGRE_BUILD_RENDERSYSTEM_D3D9=OFF -DOGRE_BUILD_RENDERSYSTEM_D3D11=OFF -DOGRE_BUILD_TESTS=OFF -DOGRE_BUILD_TOOLS=OFF -DOGRE_BUILD_SAMPLES=OFF -DOGRE_BUILD_COMPONENT_CSHARP=OFF -DOGRE_BUILD_COMPONENT_JAVA=OFF -DOGRE_BUILD_COMPONENT_PYTHON=OFF -DOGRE_INSTALL_TOOLS=OFF -DOGRE_INSTALL_DOCS=OFF -DOGRE_INSTALL_SAMPLES=OFF -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
cd ${{github.workspace}}/ogre-build | |
mingw32-make install -j8 | |
build-windows: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
needs: [build-n-cache-assimp-windows, build-n-cache-ogre-windows] | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Cache Assimp | |
id: cache-assimp-windows | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-windows | |
with: | |
# It is caching the folder that also contains source and building files, maybe in the future it would be nice cache only the includes and dll | |
path: | | |
C:/PROGRA~2/Assimp | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- name: Cache Ogre | |
id: cache-ogre-windows | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-ogre-windows | |
with: | |
path: ${{github.workspace}}/ogre-build/SDK | |
# Need to delete manually if needed to rebuild. Until I find a better solution for detecting changes in the ogre repo. | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- name: Set up MinGW | |
uses: e-t-l/setup-mingw@patch-1 #egor-tensin/setup-mingw@v2 | |
with: | |
platform: x64 | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: '==2.1.*' | |
version: '6.5.0' | |
host: 'windows' | |
target: 'desktop' | |
arch: 'win64_mingw' | |
tools: 'tools_cmake' | |
- name: Configure CMake | |
env: | |
OGRE_DIR: ${{github.workspace}}/ogre-build/SDK/CMake/ | |
CMAKE_GENERATOR: "MinGW Makefiles" | |
ASSIMP_DIR: C:/PROGRA~2/Assimp | |
run: cmake -S . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DQT_QMAKE_EXECUTABLE=qmake -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_EXE_LINKER_FLAGS=-static -DQt6_DIR=D:/a/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 -DQT_DIR=D:/a/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 -DQt6GuiTools_DIR=D:/a/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6GuiTools -DOGRE_DIR=${{github.workspace}}/ogre-build/SDK/CMake/ -DASSIMP_DIR=C:/PROGRA~2/Assimp/lib/cmake/assimp-5.2 | |
shell: cmd | |
- name: Build | |
run: mingw32-make install -j8 | |
- name: Copy assimp dll to the binary folder | |
run: | | |
copy C:/PROGRA~2/Assimp/bin/libassimp-5.dll ${{github.workspace}}/bin | |
- name: Copy gcc dll to the binary folder | |
run: | | |
echo "mingw bin" | |
cd C:/ProgramData/mingw64/mingw64/bin | |
dir | |
copy C:/ProgramData/mingw64/mingw64/bin/libgcc_s_seh-1.dll ${{github.workspace}}/bin | |
copy C:/ProgramData/mingw64/mingw64/bin/libstdc++-6.dll ${{github.workspace}}/bin | |
copy C:/ProgramData/mingw64/mingw64/bin/libwinpthread-1.dll ${{github.workspace}}/bin | |
copy ${{github.workspace}}/src/dependencies/zlib1.dll ${{github.workspace}}/bin/zlib1__.dll | |
copy ${{github.workspace}}/src/dependencies/zlib1.dll ${{github.workspace}}/bin/libzlib.dll | |
# copy C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/libgcc_s_seh-1.dll ${{github.workspace}}/bin | |
# copy C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin/zlib1.dll ${{github.workspace}}/bin/libzlib.dll | |
- name: Upload Artifact | |
if: github.event_name == 'release' && github.event.action == 'published' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: QtMeshEditor-${{github.ref_name}}-bin-Windows | |
path: ${{github.workspace}}/bin | |
- name: Compress File | |
if: github.event_name == 'release' && github.event.action == 'published' | |
run: Compress-Archive ${{github.workspace}}/bin QtMeshEditor-${{github.ref_name}}-bin-Windows.zip | |
shell: powershell | |
- name: Uploadfile to release | |
if: github.event_name == 'release' && github.event.action == 'published' | |
uses: xresloader/upload-to-github-release@main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: QtMeshEditor-${{github.ref_name}}-bin-Windows.zip | |
update_latest_release: true | |
overwrite: false | |
verbose: true | |
#################################################################### | |
# Linux Deploy | |
#################################################################### | |
build-n-cache-assimp-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: change folder permissions | |
run: | | |
sudo chmod -R 777 /usr/local/lib | |
sudo chmod -R 777 /usr/local/include | |
- name: Cache Assimp | |
id: cache-assimp-linux | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-linux | |
with: | |
# Assimp cache files are stored in `/home/runner/work/QtMeshEditor/QtMeshEditor/assimp` on Linux | |
path: | | |
/usr/local/lib/cmake/ | |
/usr/local/include/assimp | |
/usr/local/include/contrib | |
/usr/local/lib/pkgconfig/assimp.pc | |
/usr/local/lib/libassimp* | |
/usr/local/lib/libzlibstatic.a | |
#key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/QtMeshEditor/QtMeshEditor/assimp') }} | |
# Need to delete manually if needed to rebuild. Until I find a better solution for detecting changes in the assimp repo. | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- if: steps.cache-assimp-linux.outputs.cache-hit != 'true' | |
name: Check out Assimp repo | |
uses: actions/checkout@master | |
with: | |
repository: assimp/assimp | |
path: /home/runner/work/QtMeshEditor/QtMeshEditor/assimp | |
- if: steps.cache-assimp-linux.outputs.cache-hit != 'true' | |
name: Workaround to fix the need of utf8.h file https://github.com/assimp/assimp/issues/5005 | |
run: cp -R /home/runner/work/QtMeshEditor/QtMeshEditor/assimp/contrib /usr/local/include/contrib | |
- if: steps.cache-assimp-linux.outputs.cache-hit != 'true' | |
name: Build Assimp repo | |
run: | | |
cmake -B /home/runner/work/QtMeshEditor/QtMeshEditor/assimp-build -S /home/runner/work/QtMeshEditor/QtMeshEditor/assimp -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
cd /home/runner/work/QtMeshEditor/QtMeshEditor/assimp-build/ | |
sudo make install -j8 | |
build-n-cache-ogre-linux: | |
needs: build-n-cache-assimp-linux | |
runs-on: ubuntu-latest | |
steps: | |
- name: change folder permissions | |
run: | | |
sudo chmod -R 777 /usr/local/lib | |
sudo chmod -R 777 /usr/local/include | |
sudo chmod -R 777 /usr/local/share | |
- name: Cache Ogre | |
id: cache-ogre-linux | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-ogre-linux | |
with: | |
path: | | |
/usr/local/lib/lib* | |
/usr/local/share/OGRE/ | |
/usr/local/share/OGRE* | |
/usr/local/include/OGRE/ | |
/usr/local/lib/OGRE/ | |
/usr/local/lib/pkgconfig/ | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- if: steps.cache-ogre-linux.outputs.cache-hit != 'true' | |
name: Cache Assimp | |
id: cache-assimp-linux | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-linux | |
with: | |
# Assimp cache files are stored in `/home/runner/work/QtMeshEditor/assimp` on Linux/macOS | |
path: | | |
/usr/local/lib/cmake/ | |
/usr/local/include/assimp | |
/usr/local/include/contrib | |
/usr/local/lib/pkgconfig/assimp.pc | |
/usr/local/lib/libassimp* | |
/usr/local/lib/libzlibstatic.a | |
#key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/QtMeshEditor/QtMeshEditor/assimp') }} | |
# Need to delete manually if needed to rebuild. Until I find a better solution for detecting changes in the assimp repo. | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- if: steps.cache-ogre-linux.outputs.cache-hit != 'true' | |
name: install openGL | |
run: | | |
sudo apt update | |
sudo apt-get install freeglut3-dev libxrandr-dev | |
- if: steps.cache-ogre-linux.outputs.cache-hit != 'true' | |
name: Check out ogre repo | |
uses: actions/checkout@master | |
with: | |
repository: OGRECave/ogre | |
path: /home/runner/work/QtMeshEditor/QtMeshEditor/ogre | |
- if: steps.cache-ogre-linux.outputs.cache-hit != 'true' | |
name: Build Ogre3D repo | |
run: | | |
sudo cmake -B /home/runner/work/QtMeshEditor/QtMeshEditor/ogre-build \ | |
-S /home/runner/work/QtMeshEditor/QtMeshEditor/ogre \ | |
-DOGRE_BUILD_PLUGIN_ASSIMP=ON -Dassimp_DIR=/usr/local/lib/cmake/assimp-5.2 \ | |
-DOGRE_BUILD_PLUGIN_DOT_SCENE=ON -DOGRE_BUILD_RENDERSYSTEM_GL=ON \ | |
-DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=ON -DOGRE_BUILD_RENDERSYSTEM_GLES2=OFF \ | |
-DOGRE_BUILD_TESTS=OFF -DOGRE_BUILD_TOOLS=OFF -DOGRE_BUILD_SAMPLES=OFF \ | |
-DOGRE_BUILD_COMPONENT_CSHARP=OFF -DOGRE_BUILD_COMPONENT_JAVA=OFF \ | |
-DOGRE_BUILD_COMPONENT_BULLET=OFF \ | |
-DOGRE_BUILD_COMPONENT_PYTHON=OFF -DOGRE_INSTALL_TOOLS=OFF \ | |
-DOGRE_INSTALL_DOCS=OFF -DOGRE_INSTALL_SAMPLES=OFF \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
cd /home/runner/work/QtMeshEditor/QtMeshEditor/ogre-build/ | |
sudo make install -j8 | |
build-linux: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
needs: [build-n-cache-assimp-linux, build-n-cache-ogre-linux] | |
runs-on: ubuntu-latest | |
env: | |
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.1/x64/lib:/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/:/usr/local/lib/:/usr/local/lib/OGRE/:/usr/local/lib/pkgconfig/ | |
steps: | |
- uses: actions/checkout@v3.5.3 | |
with: | |
submodules: true | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: '==2.1.*' | |
version: '6.5.0' | |
host: 'linux' | |
target: 'desktop' | |
arch: 'gcc_64' | |
- name: change folder permissions | |
run: | | |
sudo chmod -R 777 /usr/local/lib | |
sudo chmod -R 777 /usr/local/include | |
sudo chmod -R 777 /usr/local/share | |
- name: Cache Assimp | |
id: cache-assimp-linux | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-linux | |
with: | |
path: | | |
/usr/local/lib/cmake/ | |
/usr/local/include/assimp | |
/usr/local/include/contrib | |
/usr/local/lib/pkgconfig/assimp.pc | |
/usr/local/lib/libassimp* | |
/usr/local/lib/libzlibstatic.a | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Cache Ogre | |
id: cache-ogre-linux | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-ogre-linux | |
with: | |
path: | | |
/usr/local/lib/lib* | |
/usr/local/share/OGRE/ | |
/usr/local/share/OGRE* | |
/usr/local/include/OGRE/ | |
/usr/local/lib/OGRE/ | |
/usr/local/lib/pkgconfig/ | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- name: Configure CMake | |
run: | | |
sudo cmake -S . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DASSIMP_DIR=/usr/local/lib/cmake/assimp-5.2 \ | |
-DASSIMP_INCLUDE_DIR=/usr/local/include/assimp \ | |
-DQt6_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 \ | |
-DQT_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 \ | |
-DQt6GuiTools_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6GuiTools | |
- name: Build | |
run: sudo make install -j8 | |
- name: Add missing libraries | |
run: | | |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicui18n.* ./bin | |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicuuc.* ./bin | |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicudata.* ./bin | |
- name: Manual Pack | |
run: | | |
echo "Creating folders 'n files" | |
mkdir -p ./pack-deb/usr/local/bin | |
mkdir -p ./pack-deb/usr/share/qtmesheditor/ | |
mkdir ./pack-deb/usr/share/qtmesheditor/cfg/ | |
mkdir ./pack-deb/usr/share/qtmesheditor/media/ | |
mkdir ./pack-deb/usr/share/qtmesheditor/platforms/ | |
mkdir -p ./pack-deb/lib/x86_64-linux-gnu/ | |
mkdir ./pack-deb/DEBIAN/ | |
cp ./bin/DEBIAN-control ./pack-deb/DEBIAN/control | |
cp ./bin/QtMeshEditor ./pack-deb/usr/share/qtmesheditor/qtmesheditor | |
touch ./pack-deb/usr/local/bin/qtmesheditor | |
echo "/usr/share/qtmesheditor/qtmesheditor" >> ./pack-deb/usr/local/bin/qtmesheditor | |
sudo chmod 755 ./pack-deb/usr/local/bin/qtmesheditor | |
cp -R ./bin/cfg/ ./pack-deb/usr/share/qtmesheditor/ | |
sudo chmod -R 755 ./pack-deb/usr/share/qtmesheditor/cfg | |
cp -R ./bin/media/ ./pack-deb/usr/share/qtmesheditor/ | |
cp -R ./bin/platforms/ ./pack-deb/usr/share/qtmesheditor/ | |
cp -R ./bin/*.so* ./pack-deb/lib/x86_64-linux-gnu/ | |
dpkg-deb --build --root-owner-group pack-deb | |
mv pack-deb.deb qtmesheditor_amd64.deb | |
# - name: CPack | |
# env: | |
# LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.1/x64/lib:/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/:/usr/local/lib/:/usr/local/lib/OGRE/:/usr/local/lib/pkgconfig/ | |
# run: | | |
# sudo apt install libxcb-cursor0 | |
# sudo cp -R ${{github.workspace}}/bin/Plugin_PCZSceneManager.* /usr/local/lib/ | |
# sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/ /usr/local/lib/ | |
# sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicui18n.* /usr/local/lib/ | |
# sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicuuc.* /usr/local/lib/ | |
# sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicudata.* /usr/local/lib/ | |
# sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicui18n.* ./bin | |
# sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicuuc.* ./bin | |
# sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicudata.* ./bin | |
# sudo ls /usr/local/lib/ | |
# sudo cpack -G DEB -C ./bin -P QtMeshEditor.deb | |
# - run: tar -zcvf QtMeshEditor-bin-Linux.tar.gz ./bin | |
- uses: actions/upload-artifact@v3 | |
if: github.event_name == 'release' && github.event.action == 'published' | |
with: | |
name: linux-binaries | |
path: ${{github.workspace}}/*.deb | |
- if: github.event_name == 'release' && github.event.action == 'published' | |
uses: xresloader/upload-to-github-release@main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: ${{github.workspace}}/*.deb | |
update_latest_release: true | |
overwrite: false | |
verbose: true | |
#################################################################### | |
# Unit Tests - on Linux | |
#################################################################### | |
unit-tests-linux: | |
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. | |
# You can convert this to a matrix build if you need cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
needs: [build-n-cache-assimp-linux, build-n-cache-ogre-linux] | |
runs-on: ubuntu-latest | |
permissions: read-all | |
env: | |
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.11.1/x64/lib:/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/:/usr/local/lib/:/usr/local/lib/OGRE/:/usr/local/lib/pkgconfig/:/lib/x86_64-linux-gnu/ | |
BUILD_WRAPPER_OUT_DIR: ./ | |
steps: | |
- uses: actions/checkout@v3.5.3 | |
with: | |
submodules: true | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: '==2.1.*' | |
version: '6.5.0' | |
host: 'linux' | |
target: 'desktop' | |
arch: 'gcc_64' | |
- name: change folder permissions | |
run: | | |
sudo chmod -R 777 /usr/local/lib | |
sudo chmod -R 777 /usr/local/include | |
sudo chmod -R 777 /usr/local/share | |
- name: Cache Assimp | |
id: cache-assimp-linux | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-linux | |
with: | |
path: | | |
/usr/local/lib/cmake/ | |
/usr/local/include/assimp | |
/usr/local/include/contrib | |
/usr/local/lib/pkgconfig/assimp.pc | |
/usr/local/lib/libassimp* | |
/usr/local/lib/libzlibstatic.a | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Cache Ogre | |
id: cache-ogre-linux | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-ogre-linux | |
with: | |
path: | | |
/usr/local/lib/lib* | |
/usr/local/share/OGRE/ | |
/usr/local/share/OGRE* | |
/usr/local/include/OGRE/ | |
/usr/local/lib/OGRE/ | |
/usr/local/lib/pkgconfig/ | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
# - name: Install CodeQL | |
# run: | | |
# wget https://github.com/github/codeql-cli-binaries/releases/latest/download/codeql-linux64.zip | |
# unzip codeql-linux64.zip | |
# ./codeql/codeql --version | |
# mkdir ${{github.workspace}}/CodeQL-database | |
# ./codeql/codeql database create ${{github.workspace}}/CodeQL-database --language=cpp | |
- name: Configure CMake | |
run: | | |
mkdir build | |
sudo cmake -S . -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DASSIMP_DIR=/usr/local/lib/cmake/assimp-5.2 \ | |
-DASSIMP_INCLUDE_DIR=/usr/local/include/assimp \ | |
-DQt6_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 \ | |
-DQT_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6 \ | |
-DQt6GuiTools_DIR=/home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/cmake/Qt6GuiTools \ | |
-DBUILD_TESTS=ON -DCMAKE_CXX_FLAGS=--coverage -DCMAKE_EXE_LINKER_FLAGS=--coverage \ | |
-DBUILD_QT_MESH_EDITOR=OFF | |
#- name: Build | |
# Build your program with the given configuration | |
# run: sudo make install -j8 | |
- name: Install sonar-scanner and build-wrapper | |
uses: SonarSource/sonarcloud-github-c-cpp@v2 | |
- name: Run build-wrapper | |
run: | | |
sudo ./.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} sudo cmake --build . --target install | |
- name: Add missing libraries | |
run: | | |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicui18n.* ./bin | |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicuuc.* ./bin | |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/libicudata.* ./bin | |
sudo cp -R ./bin/*.so* /lib/x86_64-linux-gnu | |
sudo cp -R /usr/local/lib/OGRE/* /lib/x86_64-linux-gnu | |
sudo cp -R /usr/local/lib/OGRE/* ./bin | |
- name: Test | |
env: | |
QT_QPA_PLATFORM: minimal | |
QT_DEBUG_PLUGINS: 1 | |
DISPLAY: :99 | |
run: | | |
export QT_QPA_PLATFORM="minimal" | |
export QT_DEBUG_PLUGINS=1 | |
sudo cp -R /home/runner/work/QtMeshEditor/Qt/6.5.0/gcc_64/lib/ /lib/x86_64-linux-gnu/ | |
sudo apt -y install libxcb-xinerama0 libxcb-cursor0 libx11-dev xvfb | |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | |
export DISPLAY=:99 | |
echo "DISPLAY=:99" >> $GITHUB_ENV | |
sudo ./bin/UnitTests | |
# sudo ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure | |
- name: Set up Python 3.8 for gcovr | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: install gcovr 5.0 | |
run: | | |
pip install gcovr==5.0 | |
- run: sudo gcov ${{github.workspace}}/src/CMakeFiles/UnitTests.dir/*.o | |
- name: Collect coverage into one XML report | |
run: | | |
gcovr --sonarqube > coverage.xml | |
- name: Run sonar-scanner | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
run: | | |
sonar-scanner \ | |
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ | |
--define sonar.coverageReportPaths=coverage.xml | |
- name: Run lcov | |
run: | | |
sudo apt install lcov | |
lcov --capture --directory . --output-file coverage.info | |
lcov --remove coverage.info '/usr/*' '/home/runner/work/QtMeshEditor/Qt/*' -o filtered_coverage.info | |
- run: | | |
cd ${{github.workspace}} | |
curl -L -O codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 | |
sudo chmod +x test-reporter-latest-linux-amd64 | |
sudo ./test-reporter-latest-linux-amd64 format-coverage --input-type lcov --output coverage.json filtered_coverage.info | |
sudo ./test-reporter-latest-linux-amd64 upload-coverage --input coverage.json -r ${{secrets.CODECLIMATE_COVERAGE_ID}} | |
#################################################################### | |
# MacOS Deploy | |
#################################################################### | |
build-n-cache-assimp-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Cache Assimp | |
id: cache-assimp-macos | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-macos | |
with: | |
path: | | |
/usr/local/lib/cmake/ | |
/usr/local/include/assimp | |
/usr/local/include/contrib | |
/usr/local/lib/pkgconfig/assimp.pc | |
/usr/local/lib/libassimp* | |
/usr/local/lib/libzlibstatic.a | |
#key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('/home/runner/work/QtMeshEditor/QtMeshEditor/assimp') }} | |
# Need to delete manually if needed to rebuild. Until I find a better solution for detecting changes in the assimp repo. | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- if: steps.cache-assimp-macos.outputs.cache-hit != 'true' | |
name: Check out Assimp repo | |
uses: actions/checkout@master | |
with: | |
repository: assimp/assimp | |
path: /Users/runner/work/QtMeshEditor/QtMeshEditor/assimp | |
- if: steps.cache-assimp-macos.outputs.cache-hit != 'true' | |
name: Workaround to fix the need of utf8.h file https://github.com/assimp/assimp/issues/5005 | |
run: cp -R /Users/runner/work/QtMeshEditor/QtMeshEditor/assimp/contrib /usr/local/include/contrib | |
- if: steps.cache-assimp-macos.outputs.cache-hit != 'true' | |
name: Build Assimp repo | |
run: | | |
cmake -B /Users/runner/work/QtMeshEditor/QtMeshEditor/assimp-build -S /Users/runner/work/QtMeshEditor/QtMeshEditor/assimp -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
cd /Users/runner/work/QtMeshEditor/QtMeshEditor/assimp-build/ | |
sudo make install -j8 | |
build-n-cache-ogre-macos: | |
needs: build-n-cache-assimp-macos | |
runs-on: macos-latest | |
steps: | |
- name: Cache Assimp | |
id: cache-assimp-macos | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-macos | |
with: | |
path: | | |
/usr/local/lib/cmake/ | |
/usr/local/include/assimp | |
/usr/local/include/contrib | |
/usr/local/lib/pkgconfig/assimp.pc | |
/usr/local/lib/libassimp* | |
/usr/local/lib/libzlibstatic.a | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Cache Ogre | |
id: cache-ogre-macos | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-ogre-macos | |
with: | |
path: ${{github.workspace}}/ogre/SDK | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- if: steps.cache-ogre-macos.outputs.cache-hit != 'true' | |
name: Check out ogre repo | |
uses: actions/checkout@master | |
with: | |
repository: OGRECave/ogre | |
path: ${{github.workspace}}/ogre | |
- if: steps.cache-ogre-macos.outputs.cache-hit != 'true' | |
name: Build Ogre3D repo | |
run: | | |
cd ${{github.workspace}}/ogre/ | |
sudo cmake -S . -DOGRE_BUILD_PLUGIN_ASSIMP=ON -Dassimp_DIR=/usr/local/lib/cmake/assimp-5.2/ \ | |
-DOGRE_BUILD_PLUGIN_DOT_SCENE=ON -DOGRE_BUILD_RENDERSYSTEM_GL=ON -DOGRE_BUILD_RENDERSYSTEM_GL3PLUS=ON \ | |
-DOGRE_BUILD_RENDERSYSTEM_GLES2=OFF -DOGRE_BUILD_TESTS=OFF -DOGRE_BUILD_TOOLS=OFF -DOGRE_BUILD_SAMPLES=OFF \ | |
-DOGRE_BUILD_COMPONENT_CSHARP=OFF -DOGRE_BUILD_COMPONENT_JAVA=OFF -DOGRE_BUILD_COMPONENT_PYTHON=OFF \ | |
-DOGRE_INSTALL_TOOLS=OFF -DOGRE_INSTALL_DOCS=OFF -DOGRE_INSTALL_SAMPLES=OFF -DOGRE_BUILD_LIBS_AS_FRAMEWORKS=OFF \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
sudo make install -j8 | |
build-macos: | |
needs: [build-n-cache-assimp-macos, build-n-cache-ogre-macos] | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- run: | | |
ls ${{github.workspace}}/src/dependencies/ogre-procedural | |
cd ${{github.workspace}}/src/dependencies/ogre-procedural | |
git checkout master | |
git pull | |
- name: Install Qt | |
uses: jurplel/install-qt-action@v3 | |
with: | |
aqtversion: '==2.1.*' | |
version: '6.5.0' | |
host: 'mac' | |
target: 'desktop' | |
arch: 'clang_64' | |
tools: 'tools_cmake' | |
- name: Cache Assimp | |
id: cache-assimp-macos | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-assimp-macos | |
with: | |
path: | | |
/usr/local/lib/cmake/ | |
/usr/local/include/assimp | |
/usr/local/include/contrib | |
/usr/local/lib/pkgconfig/assimp.pc | |
/usr/local/lib/libassimp* | |
/usr/local/lib/libzlibstatic.a | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- name: Cache Ogre | |
id: cache-ogre-macos | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-ogre-macos | |
with: | |
path: ${{github.workspace}}/ogre/SDK | |
key: ${{ runner.os }}-build-${{ env.cache-name }} | |
- name: Configure CMake | |
env: | |
OGRE_DIR: ${{github.workspace}}/ogre/SDK/CMake/ | |
run: | | |
sudo cmake -S . \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DASSIMP_DIR=/usr/local/lib/cmake/assimp-5.2 \ | |
-DASSIMP_INCLUDE_DIR=/usr/local/include/assimp \ | |
-DQt6_DIR=/Users/runner/work/QtMeshEditor/Qt/6.5.0/clang_64/lib/cmake/Qt6 \ | |
-DQT_DIR=/Users/runner/work/QtMeshEditor/Qt/6.5.0/clang_64/lib/cmake/Qt6 \ | |
-DQt6GuiTools_DIR=/Users/runner/work/QtMeshEditor/Qt/6.5.0/clang_64/lib/cmake/Qt6GuiTools \ | |
-DOGRE_DIR=${{github.workspace}}/ogre/SDK/CMake/ | |
- name: Build | |
# Build your program with the given configuration | |
run: | | |
sudo make install -j8 | |
- name: Copy Qt libs to app folder | |
run: | | |
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/lib/QtWidgets.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtWidgets.framework | |
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/lib/QtCore.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtCore.framework | |
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/lib/QtGui.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtGui.framework | |
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/lib/QtDBus.framework ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtDBus.framework | |
sudo cp -R /Users/runner/work/QtMeshEditor/Qt/6.5.0/macos/plugins/platforms ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/platforms | |
sudo cp -R /usr/local/lib/libassimp* ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/ | |
- name: Prepare for packing | |
run: | | |
sudo cp -R ${{github.workspace}}/bin/media ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/media | |
sudo cp -R ${{github.workspace}}/bin/cfg ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/cfg | |
sudo cp -R ${{github.workspace}}/resources/icon.icns ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/media | |
sudo mkdir ${{github.workspace}}/bin/QtMeshEditor.app/Contents/Resources | |
sudo cp -R ${{github.workspace}}/resources/icon.icns ${{github.workspace}}/bin/QtMeshEditor.app/Contents/Resources | |
sudo cp -R ${{github.workspace}}/bin/Info.plist ${{github.workspace}}/bin/QtMeshEditor.app/Contents/ | |
sudo install_name_tool -add_rpath @loader_path/ ${{github.workspace}}/bin/QtMeshEditor.app/Contents/MacOS/QtMeshEditor | |
- name: Pack | |
run: | | |
brew install create-dmg | |
sudo create-dmg \ | |
--volname "QtMeshEditor Installer" \ | |
--volicon "${{github.workspace}}/resources/icon.icns" \ | |
--window-pos 200 120 \ | |
--window-size 800 400 \ | |
--icon-size 100 \ | |
--icon "QtMeshEditor.app" 200 190 \ | |
--app-drop-link 600 185 \ | |
QtMeshEditor-${{github.ref_name}}-MacOS.dmg \ | |
${{github.workspace}}/bin/QtMeshEditor.app | |
# using create-dmg instead sudo cpack -G DragNDrop | |
- if: github.event_name == 'release' && github.event.action == 'published' | |
uses: actions/upload-artifact@v3.1.2 | |
with: | |
name: QtMeshEditor-MacOS | |
path: ${{github.workspace}}/QtMeshEditor-${{github.ref_name}}-MacOS.dmg | |
- if: github.event_name == 'release' && github.event.action == 'published' | |
uses: xresloader/upload-to-github-release@main | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
file: QtMeshEditor-${{github.ref_name}}-MacOS.dmg | |
update_latest_release: true | |
overwrite: false | |
verbose: true |