Skip to content

Continuous Integration

CRiSTiK24 edited this page Sep 7, 2022 · 2 revisions

Tag

  1. Update version
  2. Compile as release
  3. Upload on GitHub

PR

  1. Format code
  2. Static analysis
  3. Unit test

Briefing

The CI/CD structure of LibreCAD3 has been developed during GSoC 2022.

In this document you will find instructions towards different possible modifications to the current scripts and code.

The workflow file

Github Actions uses a yaml file with instructions in order to build, package and upload the application. So the first file that you should check out is ".github/workflows/main.yml". I recommend checking out https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions if it's the first time you see a workflow file in Github Actions.

One of the things that you might want to change is when does the workflow trigger. For example let's say you want it to trigger everytime that there is a pull request. Check out https://docs.github.com/en/actions/using-workflows/triggering-a-workflow, here you will see with what you can change the beggining of the program.

After that, you will see the steps (scripts or raw lines of console input) that every Runner (The VM from Github. Right now there is a Windows one and a linux one) is executing. You can check the scripts in "master/scripts".

Here is a diagram where you can see an overview of what is hapenning:

image

Changing the type of build

The current builds use RelWithDebInfo. You can choose between Debug, Release, RelWithDebInfo and MinSizeRel.

scripts/windows-install/createConanDirAndInstallDependencies.bat

Here in the lines:

batch conan install .. -s build_type=RelWithDebInfo --build missing

You can change "RelWithDebInfo" with any other type of the above.

scripts/windows-install/buildLibrecadAndCreatePackage.bat

Here you will do the same as before. Change "RelWithDebInfo" with your prefered choice in all the lines where it appears.

batch cmake -S cmake --build . --config RelWithDebInfo cpack -C RelWithDebInfo

Changing install paths

Install paths are set in the CMake files "CMakeLists.txt" that are in the main directory and its subdirectories. Most of them are hardcoded in the "install" CMake function such as:

cmake install( 
    DIRECTORY ${CMAKE_SOURCE_DIR}/lcviewernoqt/painters/opengl/resources/shaders
    DESTINATION $CMAKE_INSTALL_BINDIR/../resources 
)

If you change an install path, it's very possible that you also want to change the paths that LibreCAD3 uses in order to find the files that it needs. For this, comes the next section:

Changing search paths

Most paths that are used to search resources are stored as CMake variables in CMakeLists.txt . For example, let's see how the path towards the settings is set: SETTINGS_PATH.

cmake set(SETTINGS_PATH "") #The settings will be at the same place as executable.

After being set from here, the c++ file in "lckernel/buildconstants.h" imports its value:

cpp extern IMPORT_API const char* SETTINGS_PATH;

After that, it gets stored in a class called ModuleSettings in "lckernel/cad/storage/settings/modulesettings.cpp"

_filePaths["settings_load"] = SETTINGS_PATH;

And then a class that inherits from module settings ( the _filePaths object) is used to final path in "lcUI/managers/uisettings.cpp"

std::ofstream outFile(QCoreApplication::applicationDirPath().toStdString() + _filePaths["settings_load"] + settingsFileName);

So it's very important to see how the diferent files pass the values in order to get a good final path. Also it's important to know that all the paths must be absolute. In this case, we would modify this last line in uisettings, with the new path of the files.