FreeCAD
1# ***************************************************************************
2# * Copyright (c) 2023 0penBrain *
3# * *
4# * This program is free software; you can redistribute it and/or modify *
5# * it under the terms of the GNU Lesser General Public License (LGPL) *
6# * as published by the Free Software Foundation; either version 2 of *
7# * the License, or (at your option) any later version. *
8# * for detail see the LICENCE text file. *
9# * *
10# * This program is distributed in the hope that it will be useful, *
11# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13# * GNU Library General Public License for more details. *
14# * *
15# * You should have received a copy of the GNU Library General Public *
16# * License along with this program; if not, write to the Free Software *
17# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
18# * USA *
19# * *
20# ***************************************************************************
21
22# This is a build and test workflow for CI of FreeCAD.
23# This workflow aims at building and testing FreeCAD using a Conda environment on Windows with MSVC.
24
25name: Build Windows (Conda)26on:27workflow_call:28inputs:29artifactBasename:30type: string31required: true32allowedToFail:33default: false34type: boolean35required: false36outputs:37reportFile:38value: ${{ jobs.Build.outputs.reportFile }}39
40jobs:41Build:42runs-on: windows-latest43continue-on-error: ${{ inputs.allowedToFail }}44env:45CCACHE_DIR: C:/FC/cache/46CCACHE_COMPILERCHECK: "%compiler%" # default:mtime47CCACHE_MAXSIZE: 1G48CCACHE_COMPRESS: true49CCACHE_COMPRESSLEVEL: 150CCACHE_NOHASHDIR: true51CCACHE_DIRECT: true52#CCACHE_SLOPPINESS: "pch_defines,time_macros" # Can't get PCH to work on Windows53CCACHE_LOGFILE: C:/logs/ccache.log54## Have to use C:\ because not enough space on workspace drive55builddir: C:/FC/build/56logdir: C:/logs/57reportdir: C:/report/58reportfilename: ${{ inputs.artifactBasename }}-report.md59outputs:60reportFile: ${{ steps.Init.outputs.reportFile }}61
62steps:63- name: Checking out source code64uses: actions/checkout@v465with:66submodules: true67- name: Setup Miniconda68env:69CONDA_VERBOSITY: 270uses: conda-incubator/setup-miniconda@v371with:72activate-environment: .conda/freecad73environment-file: conda/conda-env.yaml74channels: conda-forge,defaults75channel-priority: true76miniforge-version: latest77- name: Install FreeCAD dependencies78env:79CONDA_VERBOSITY: 280run: |81conda config --add envs_dirs $PWD/.conda
82mamba-devenv --no-prune -f conda/environment.devenv.yml
83- name: Make needed directories, files and initializations84id: Init85run: |86mkdir ${{ env.CCACHE_DIR }}
87mkdir ${{ env.builddir }}
88mkdir ${{ env.logdir }}
89mkdir ${{ env.reportdir }}
90echo "reportFile=${{ env.reportfilename }}" >> $GITHUB_OUTPUT
91- name: Restore compiler cache92uses: actions/cache@v493with:94save-always: true95path: ${{ env.CCACHE_DIR }}96key: FC-Windows-Conda-${{ github.ref }}-${{ github.run_id }}97restore-keys: |98FC-Windows-Conda-${{ github.ref }}-
99FC-Windows-Conda-
100- name: Print Ccache statistics before build, reset stats and print config101run: |102ccache -s
103ccache -z
104ccache -p
105- name: Configuring CMake106shell: cmd /C CALL {0}107run: >108conda\cmake.cmd --preset conda-windows-release -DFREECAD_USE_PCH:BOOL=OFF -DFREECAD_RELEASE_PDB:BOOL=OFF -DFREECAD_USE_CCACHE:BOOL=ON
109- name: Compiling sources110shell: cmd /C CALL {0}111run: >112conda\cmake.cmd --build build\release
113- name: Print Ccache statistics after build114run: |115ccache -s
116- name: CMake Install117shell: cmd /C CALL {0}118run: |119conda\cmake.cmd --install build\release
120- name: C++ unit tests121timeout-minutes: 1122run: |123. build\release\tests\Tests_run --gtest_output=json:${{ env.reportdir }}gtest_results.json # 2>&1 | tee -filepath ${{ env.logdir }}/unitTests.log
124- name: FreeCAD CLI tests125run: |126. build\release\bin\FreeCADCmd -t 0 # 2>&1 | tee -filepath ${{ env.logdir }}/integrationTests.log
127- name: Upload logs128if: always()129uses: actions/upload-artifact@v4130with:131name: ${{ inputs.artifactBasename }}-Logs132path: |133${{ env.logdir }}
134