# SPDX-License-Identifier: LGPL-2.1-or-later # *************************************************************************** # * * # * Copyright (c) 2023 0penBrain. * # * * # * This file is part of FreeCAD. * # * * # * FreeCAD is free software: you can redistribute it and/or modify it * # * under the terms of the GNU Lesser General Public License as * # * published by the Free Software Foundation, either version 2.1 of the * # * License, or (at your option) any later version. * # * * # * FreeCAD is distributed in the hope that it will be useful, but * # * WITHOUT ANY WARRANTY; without even the implied warranty of * # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * # * Lesser General Public License for more details. * # * * # * You should have received a copy of the GNU Lesser General Public * # * License along with FreeCAD. If not, see * # * . * # * * # *************************************************************************** # This is a build and test workflow for CI of FreeCAD. # This workflow aims at building and testing FreeCAD on Ubuntu 22.04 using GCC. name: Build Ubuntu 22.04 on: workflow_call: inputs: artifactBasename: type: string required: true testOnBuildDir: default: false type: boolean required: false allowedToFail: default: false type: boolean required: false outputs: reportFile: value: ${{ jobs.Build.outputs.reportFile }} jobs: Build: runs-on: ubuntu-22.04 continue-on-error: ${{ inputs.allowedToFail }} env: CCACHE_DIR: ${{ github.workspace }}/ccache CCACHE_CONFIGPATH: ${{ github.workspace }}/ccache/config CCACHE_MAXSIZE: 1G CCACHE_COMPILERCHECK: "%compiler% -dumpfullversion -dumpversion" # default:mtime CCACHE_COMPRESS: true CCACHE_COMPRESSLEVEL: 1 CC: /usr/bin/gcc CXX: /usr/bin/g++ #CC: /usr/bin/clang #CXX: /usr/bin/clang++ builddir: ${{ github.workspace }}/build/release/ logdir: /tmp/logs/ reportdir: /tmp/report/ reportfilename: ${{ inputs.artifactBasename }}-report.md defaults: run: shell: bash outputs: reportFile: ${{ steps.Init.outputs.reportFile }} steps: - name: Harden the runner (Audit all outbound calls) uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0 with: egress-policy: audit - name: Checking out source code uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: submodules: true - name: Install FreeCAD dependencies run: ./package/ubuntu/install-apt-packages.sh - name: Make needed directories, files and initializations id: Init run: | mkdir -p ${{ env.CCACHE_DIR }} mkdir -p ${{ env.CCACHE_CONFIGPATH }} mkdir -p ${{ env.builddir }} mkdir -p ${{ env.logdir }} mkdir -p ${{ env.reportdir }} echo "reportFile=${{ env.reportfilename }}" >> $GITHUB_OUTPUT - name: Generate cache key id: genCacheKey uses: ./.github/workflows/actions/linux/generateCacheKey with: compiler: ${{ env.CXX }} qt_major_version: 5 - name: Restore Compiler Cache uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: save-always: true path: ${{ env.CCACHE_DIR }} key: FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}-${{ github.run_id }} restore-keys: | FC-${{ steps.genCacheKey.outputs.cacheKey }}-${{ github.ref }}- FC-${{ steps.genCacheKey.outputs.cacheKey }}- - name: Print CCache statistics before build, reset stats and print config run: | ccache -s ccache -z ccache -p - name: Install cmake uses: jwlawson/actions-setup-cmake@802fa1a2c4e212495c05bf94dba2704a92a472be # v2.0.2 with: cmake-version: '3.31.6' - name: CMake Configure uses: ./.github/workflows/actions/linux/configure with: extraParameters: -G Ninja --preset release builddir: ${{ env.builddir }} logFile: ${{ env.logdir }}Cmake.log errorFile: ${{ env.logdir }}CmakeErrors.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: CMake Build uses: ./.github/workflows/actions/linux/build with: builddir: ${{ env.builddir }} logFile: ${{ env.logdir }}Build.log errorFile: ${{ env.logdir }}BuildErrors.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: Print ccache statistics after Build run: | ccache -s - name: FreeCAD CLI tests on build dir if: inputs.testOnBuildDir timeout-minutes: 10 uses: ./.github/workflows/actions/runPythonTests with: testDescription: "CLI tests on build dir" testCommand: ${{ env.builddir }}/bin/FreeCADCmd -t 0 logFile: ${{ env.logdir }}TestCLIBuild.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: FreeCAD GUI tests on build dir if: inputs.testOnBuildDir timeout-minutes: 15 uses: ./.github/workflows/actions/runPythonTests with: testDescription: "GUI tests on build dir" testCommand: xvfb-run ${{ env.builddir }}/bin/FreeCAD -t 0 logFile: ${{ env.logdir }}TestGUIBuild.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: C++ tests timeout-minutes: 1 uses: ./.github/workflows/actions/runCPPTests/runAllTests with: reportdir: ${{ env.reportdir }} builddir: ${{ env.builddir }} reportFile: ${{ env.reportdir }}${{ env.reportfilename }} - name: CMake Install uses: ./.github/workflows/actions/linux/install with: builddir: ${{ env.builddir }} logFile: ${{ env.logdir }}Install.log errorFile: ${{ env.logdir }}InstallErrors.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: FreeCAD CLI tests on install timeout-minutes: 10 uses: ./.github/workflows/actions/runPythonTests with: testDescription: "CLI tests on install" testCommand: FreeCADCmd -t 0 logFile: ${{ env.logdir }}TestCLIInstall.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: FreeCAD GUI tests on install timeout-minutes: 15 uses: ./.github/workflows/actions/runPythonTests with: testDescription: "GUI tests on install" testCommand: xvfb-run FreeCAD -t 0 logFile: ${{ env.logdir }}TestGUIInstall.log reportFile: ${{env.reportdir}}${{ env.reportfilename }} - name: Upload logs if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: ${{ inputs.artifactBasename }}-Logs path: | ${{ env.logdir }} /var/crash/*FreeCAD* - name: Upload report if: always() uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 with: name: ${{ env.reportfilename }} path: | ${{env.reportdir}}${{ env.reportfilename }}